示例#1
0
		/// <summary>
		/// Constructor
		/// </summary>
		public PartyForm()
		{
			InitializeComponent();

			GameScreen = new GameScreen();

			LoadParty();
		}
示例#2
0
		/// <summary>
		/// Default constructor
		/// </summary>
		public CampDialog(GameScreen game)
		{
			Game = game;
			Windows = new Stack<Window>();

			Buttons = new List<ScreenButton>();

			Rectangle = new Rectangle(0, 0, 352, 288);

			AddWindow(new MainWindow(this));

			// Set default cursor
			Mouse.SetTile(0);
		}
示例#3
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		void PlayButton_Selected(object sender, EventArgs e)
		{
			if (Heroes.Any(hero => hero == null)) return;
			var screen = new GameScreen();

			// Generate the team
			GameSettings.SaveGameName = string.Empty;

			Team gsteam = new Team();
			for (int i = 0; i < 4; i++)
				gsteam.AddHero(Heroes[i], (HeroPosition)i);

			screen.NewGame(gsteam);

			ScreenManager.AddScreen(screen);

			ExitScreen();
		}
示例#4
0
		/// <summary>
		/// Update logic
		/// </summary>
		/// <param name="time"></param>
		/// <param name="hasFocus"></param>
		/// <param name="isCovered"></param>
		public override void Update(GameTime time, bool hasFocus, bool isCovered)
		{
			// No focus byebye
			if (!hasFocus)
				return;

			// Play sound
		//	if (Theme.State != AudioSourceState.Playing)
		//		Theme.Play();

			if (Keyboard.IsNewKeyPress(System.Windows.Forms.Keys.S))
				Theme.Stop();

			if (Keyboard.IsNewKeyPress(System.Windows.Forms.Keys.P))
				Theme.Play();


			// Does the default language changed ?
			if (Game.LanguageName != StringTable.LanguageName)
			{
				StringTable.LanguageName = Game.LanguageName;

				for (int id = 0; id < Buttons.Count; id++)
					Buttons[id].Text = StringTable.GetString(id+1);
			}


			// Mouse interaction
			Point mousePos = Mouse.Location;


			if (LoadGame == null)
			#region Main menu
			{
				for (int id = 0; id < Buttons.Count; id++)
				{
					ScreenButton button = Buttons[id];

					// Mouse over ?
					if (button.Rectangle.Contains(mousePos))
					{
						//button.TextColor = Color.FromArgb(255, 85, 85);
						MenuID = id;
						if (Mouse.IsNewButtonDown(System.Windows.Forms.MouseButtons.Left))
							button.OnSelectEntry();
					}

				}

				// Bye bye
				if (Keyboard.IsNewKeyPress(System.Windows.Forms.Keys.Escape))
					Game.Exit();

				// Run intro
				if (Keyboard.IsNewKeyPress(System.Windows.Forms.Keys.I))
					ScreenManager.AddScreen(new IntroScreen());


				// Key up
				if (Keyboard.IsNewKeyPress(System.Windows.Forms.Keys.Up))
				{
					MenuID--;
					if (MenuID < 0)
						MenuID = Buttons.Count - 1;
				}
				// Key down
				else if (Keyboard.IsNewKeyPress(System.Windows.Forms.Keys.Down))
				{
					MenuID++;
					if (MenuID >= Buttons.Count)
						MenuID = 0;
				}
				// Enter
				else if (Keyboard.IsNewKeyPress(System.Windows.Forms.Keys.Enter))
				{
					Buttons[MenuID].OnSelectEntry();
				}
			}
			#endregion
			else
			#region Load game
			{

				// Load a game
				LoadGame.Update(time);

				// A slot is selected
				if (LoadGame.SelectedSlot != -1)
				{
					// close window
					LoadGame.Close();

					// Run the game
					GameScreen scr = new GameScreen();
					ScreenManager.AddScreen(scr);

					// Load saved game
					scr.LoadGameSlot(LoadGame.SelectedSlot);
				}


				// Close the window
				if (LoadGame.Closing)
					LoadGame = null;

			}
			#endregion
		}