using System;

namespace SharpQuake
{
	internal class QuitMenu : MenuBase
	{
		public override void Show()
		{
			if (MenuBase.CurrentMenu == this)
			{
				return;
			}
			Key.Destination = keydest_t.key_menu;
			this._PrevMenu = MenuBase.CurrentMenu;
			base.Show();
		}

		public override void KeyEvent(int key)
		{
			if (key > 78)
			{
				if (key != 89)
				{
					if (key == 110)
					{
						goto IL_20;
					}
					if (key != 121)
					{
						return;
					}
				}
				Key.Destination = keydest_t.key_console;
				host.Quit_f();
				return;
			}
			if (key != 27 && key != 78)
			{
				return;
			}
			IL_20:
			if (this._PrevMenu != null)
			{
				this._PrevMenu.Show();
				return;
			}
			MenuBase.Hide();
		}

		public override void Draw()
		{
			menu.DrawTextBox(0, 0, 38, 23);
			menu.PrintWhite(16, 12, "  Quake version 1.09 by id Software\n\n");
			menu.PrintWhite(16, 28, "Programming        Art \n");
			menu.Print(16, 36, " John Carmack       Adrian Carmack\n");
			menu.Print(16, 44, " Michael Abrash     Kevin Cloud\n");
			menu.Print(16, 52, " John Cash          Paul Steed\n");
			menu.Print(16, 60, " Dave 'Zoid' Kirsch\n");
			menu.PrintWhite(16, 68, "Design             Biz\n");
			menu.Print(16, 76, " John Romero        Jay Wilbur\n");
			menu.Print(16, 84, " Sandy Petersen     Mike Wilson\n");
			menu.Print(16, 92, " American McGee     Donna Jackson\n");
			menu.Print(16, 100, " Tim Willits        Todd Hollenshead\n");
			menu.PrintWhite(16, 108, "Support            Projects\n");
			menu.Print(16, 116, " Barrett Alexander  Shawn Green\n");
			menu.PrintWhite(16, 124, "Sound Effects\n");
			menu.Print(16, 132, " Trent Reznor and Nine Inch Nails\n\n");
			menu.PrintWhite(16, 140, "Quake is a trademark of Id Software,\n");
			menu.PrintWhite(16, 148, "inc., (c)1996 Id Software, inc. All\n");
			menu.PrintWhite(16, 156, "rights reserved. NIN logo is a\n");
			menu.PrintWhite(16, 164, "registered trademark licensed to\n");
			menu.PrintWhite(16, 172, "Nothing Interactive, Inc. All rights\n");
			menu.PrintWhite(16, 180, "reserved. Press y to exit\n");
		}

		private MenuBase _PrevMenu;
	}
}
