コード例 #1
0
        private void handleEndTurn(GameManager.eEndGameStatus i_GameStatus, int i_ChipCol) //Perform a move according to status
        {
            if (i_GameStatus == GameManager.eEndGameStatus.AnotherTurn)                    //continue playing
            {
                if (!GameManager.IsColumnAvailable(i_ChipCol))
                {
                    m_NumberButtons[i_ChipCol].Enabled = false;
                }
            }
            else //Game over, show messageBox
            {
                DialogResult i_Result;
                if (i_GameStatus == GameManager.eEndGameStatus.Winning)
                {
                    i_Result = MessageBox.Show(string.Format("{0} Won!!! {1}Another Round?", GameManager.CurrentPlayer.PlayerName, Environment.NewLine), "A Win!", MessageBoxButtons.YesNo);
                }
                else
                {
                    i_Result = MessageBox.Show(string.Format("Tie!!!{0}Another Round?", Environment.NewLine), "A Tie!", MessageBoxButtons.YesNo);
                }

                if (i_Result == DialogResult.Yes)
                {
                    restart(GameManager.CurrentPlayer);
                }
                else if (i_Result == DialogResult.No || i_Result == DialogResult.Cancel)
                {
                    this.Close();
                }
            }
        }
コード例 #2
0
 private void button_Click(object sender, EventArgs e, int i_ChipCol)
 {
     GameManager.eEndGameStatus i_GameStatus = GameManager.PlayTurn(i_ChipCol, updateButtonCube);
     handleEndTurn(i_GameStatus, i_ChipCol);
 }