예제 #1
0
        protected virtual void GameControl_OnRender(object sender, GraphicsDeviceEventArgs e)
        {
            e.GraphicsDevice.Clear(Color.CornflowerBlue);

            if (_paused)
            {
                _persistentGameMain?.Update();
            }
            else
            {
                GameMain?.Update();
            }

            if ((GameMain != null) &&
                !_isFinishedGame &&
                GameMain.LazyFinished)
            {
                Application.DoEvents();

                GameLogger.WriteLine(GameMain.CurrentState.ToString());

                if (_currentMatch == _playingReplayGameData.MatchesCount - 1)
                {
                    _isFinishedGame = true;
                    return;
                }

                Player1InputTextBox.Text  = "";
                Player1OutputTextBox.Text = "";
                Player2InputTextBox.Text  = "";
                Player2OutputTextBox.Text = "";

                _currentMatch++;

                var player1ReplayData = _playingReplayGameData.Matches[_currentMatch].Player1ReplayData;
                var player1Name       = player1ReplayData.OutputLines[0];
                Player1NameTextBlock.Text = player1Name;

                var player2ReplayData = _playingReplayGameData.Matches[_currentMatch].Player2ReplayData;
                var player2Name       = player2ReplayData.OutputLines[0];
                Player2NameTextBlock.Text = player2Name;

                BuildGame(_currentMatch);
                StartGame(_currentMatch);
            }

            if (!_isBuilding)
            {
                UpdateTurnChangeComponent();
            }
        }