void quitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     const string message = "Are you sure you want to quit?";
     MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);
     confirmQuitMessageBox.Accepted += confirmQuitMessageBoxAccepted;
     ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
 }
 //event handlers:
 void restartGameMenuSelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen(p1name, p2name,
         mapName, p1ai, p2ai, p1aiLevel, p2aiLevel));
 }
 void restartDifferentGameMenuSelected(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new PlayGameScreen());
 }
 void confirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen());
 }
 void p2HumanOrAISelected(object sender, PlayerIndexEventArgs e)
 {
     currentP2HumanOrAi = (currentP2HumanOrAi + 1) % humanOrAI.Length;
     updateMenuEntries();
 }
        void playGameSelected(object sender, PlayerIndexEventArgs e)
        {
            bool player1IsAI;
            bool player2IsAI;
            string player1Name;
            string player2Name;

            if (currentP1HumanOrAi == 0)
                {
                player1IsAI = false;
                player1Name = "Player 1";
                }
            else
                {
                player1IsAI = true;
                player1Name = "Computer 1";
                }

            if (currentP2HumanOrAi == 0)
                {
                player2IsAI = false;
                player2Name = "Player 2";
                }
            else
                {
                player2IsAI = true;
                player2Name = "Computer 2";
                }

            string map = "map" + (currentMap + 1) + ".txt";

            LoadingScreen.Load(ScreenManager, true, e.PlayerIndex, new GameplayScreen(player1Name, player2Name,
                map, player1IsAI, player2IsAI, currentP1HumanOrAi, currentP2HumanOrAi));
        }
 void confirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new MainMenuScreen(), e.PlayerIndex);
 }
 void mapSelected(object sender, PlayerIndexEventArgs e)
 {
     currentMap = (currentMap + 1) % maps.Keys.Count;
     updateMenuEntries();
 }
Exemple #9
0
 protected void OnCancel(object sender, PlayerIndexEventArgs e)
 {
     OnCancel(e.PlayerIndex);
 }
 void helpMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new HelpMenuScreen(), e.PlayerIndex);
 }
 void confirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.Game.Exit();
 }
 void soundOnOrOffSelected(object sender, PlayerIndexEventArgs e)
 {
     soundsOn = !soundsOn;
     updateMenuEntries();
 }
 //event handlers:
 void playGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
 {
     ScreenManager.AddScreen(new PlayGameScreen(), e.PlayerIndex);
 }