コード例 #1
0
        private void doWhenGameEnded()
        {
            this.Controls.Clear();

            m_FirstPlayerTotalScore  += m_Board.FirstPlayerTotalScore;
            m_SecondPlayerTotalScore += m_Board.SecondPlayerTotalScore;

            m_Board = new CheckersBoard(m_TableSize, m_PlayerOneName, m_PlayerTwoName, m_ComputerMode);
            m_Board.AttachObserver(new ReportOnGameEnd(this.doWhenGameEnded));

            initControls();
        }
コード例 #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            m_FormGameSettings.FormClosed += m_FormGameSettings_OnClose;
            m_FormGameSettings.ShowDialog();

            // init game
            m_ComputerMode  = !m_FormGameSettings.CheckBoxPlayerTwo.Checked;
            m_TableSize     = m_FormGameSettings.getTableSize();
            m_PlayerOneName = m_FormGameSettings.TextBoxPlayerOne.Text.ToString();
            m_PlayerTwoName = m_FormGameSettings.TextBoxPlayerTwo.Text.ToString();

            m_Board = new CheckersBoard(m_TableSize, m_PlayerOneName, m_PlayerTwoName, m_ComputerMode);
            m_Board.AttachObserver(new ReportOnGameEnd(this.doWhenGameEnded));
            initControls();
        }