コード例 #1
0
ファイル: Form1.cs プロジェクト: babbincocks/FoxInTheForest
 private void choosePlayerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ongoingGame == true)
     {
         frmPlayerChangeWarning newWarning = new frmPlayerChangeWarning();
         newWarning.ShowDialog();
         if (newWarning.DialogResult == DialogResult.Yes)
         {
             frmPlayerChoice newForm = new frmPlayerChoice();
             newForm.ShowDialog();
             setNamePosition();
             //TODO: Have it so if the player chooses a new player, the game will reset.
             if (newForm.DialogResult == DialogResult.OK)
             {
                 RestartGame();
             }
         }
     }
     else
     {
         frmPlayerChoice newForm = new frmPlayerChoice();
         newForm.ShowDialog();
         setNamePosition();
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: babbincocks/FoxInTheForest
        private void newGameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!ongoingGame)
            {
                List <string> preCards = new List <string>();
                //TODO: Change how retrieving scores is set up.

                try
                {
                    if (Player.CurrentPlayer().Name == "Guest")
                    {
                        frmNamePrompt newPrompt = new frmNamePrompt();
                        newPrompt.ShowDialog();
                        if (newPrompt.DialogResult == DialogResult.OK)
                        {
                            frmPlayerChoice newForm = new frmPlayerChoice();
                            newForm.ShowDialog();
                            setNamePosition();
                        }
                    }
                    //Since the game won't be going on, it will "restart" the game by really just starting the game.
                    RestartGame();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                //Alert if the player tries to start a new game while one is ongoing.
                frmNewGameAlert newForm = new frmNewGameAlert();
                newForm.ShowDialog();
                if (newForm.DialogResult == DialogResult.Yes)
                {
                    RestartGame();
                }
            }
        }