示例#1
0
        private static void Actually_StopGame(params object[] eventArgs)
        {
            if (_isInGameMode)
            {
                _isInGameMode = false;

                _mainGame.StopGameEarly();

                // Remove the ChessGame from the GuiChessBoard updates
                MainForm.chessBoardControl.PieceMovedByHuman -= _mainGame.WhitePlayer_HumanMovedPieceEvent;
                MainForm.chessBoardControl.PieceMovedByHuman -= _mainGame.BlackPlayer_HumanMovedPieceEvent;

                // Remove WinGui from the ChessGame updates event
                //_mainGame.Updated -= OnChessGameUpdated;
                _mainGame.UpdatedState -= GuiEventLoop.AddToHistory;

                _mainGame.SetGuiChessBoard_IsLocked -= GuiEventLoop.SetGuiChessBoard_IsLocked;

                // Remove WinGui from the DeclareResults event
                _mainGame.DeclareResults -= GuiEventLoop.DeclareResults;

                _mainGame.SetDecisionTree -= GuiEventLoop.SetDecisionTree;

                // Add WinGui to the GuiChessBoard updates
                MainForm.chessBoardControl.PieceMovedByHuman += MainForm.PieceMovedByHuman_Changed;

                Actually_EnableMenuItemsAfterPlay();
                Actually_EnableRadioBtnsAndComboBoxes();
                Actually_EnableHistoryWindowClicking();
                GuiEventLoop.Actually_SetGuiChessBoard_IsLocked(new object[] { false });

                _mainGame = null;
            }
        }
示例#2
0
        public WinGui()
        {
            InitializeComponent();

            MessageBox.MainForm   = this;
            GuiEventLoop.MainForm = this;

            GuiEventLoop.ResetHistory(new ChessState());

            GuiEventLoop.PollGuiOnce();

            chessBoardControl.PieceMovedByHuman += PieceMovedByHuman_Changed;
            chessBoardControl.SetChessFlagCombo(this.cmbChessFlags);
        }
示例#3
0
        private static void Actually_StartGame(params object[] eventArgs)
        {
            if (!_isInGameMode)
            {
                _isInGameMode = true;

                UvsChess.Framework.ChessState item = Actually_GetUpdated_LstHistory_SelectedItem();

                _mainGame = new UvsChess.Framework.ChessGame(item, GuiEventLoop.WhitePlayerName, GuiEventLoop.BlackPlayerName);

                // Remove WinGui from the GuiChessBoard updates
                MainForm.chessBoardControl.PieceMovedByHuman -= MainForm.PieceMovedByHuman_Changed;

                // Add the ChessGame to the GuiChessBoard updates
                MainForm.chessBoardControl.PieceMovedByHuman += _mainGame.WhitePlayer_HumanMovedPieceEvent;
                MainForm.chessBoardControl.PieceMovedByHuman += _mainGame.BlackPlayer_HumanMovedPieceEvent;

                // Add WinGui to the ChessGame updates event
                _mainGame.UpdatedState += GuiEventLoop.AddToHistory;

                _mainGame.SetGuiChessBoard_IsLocked += GuiEventLoop.SetGuiChessBoard_IsLocked;

                // Add WinGui to the DeclareResults event
                _mainGame.DeclareResults += GuiEventLoop.DeclareResults;

                _mainGame.SetDecisionTree += GuiEventLoop.SetDecisionTree;

                Actually_RemoveHistoryAfterSelected();

                Actually_DisableMenuItemsDuringPlay();
                Actually_DisableRadioBtnsAndComboBoxes();
                Actually_DisableHistoryWindowClicking();
                GuiEventLoop.Actually_SetGuiChessBoard_IsLocked(new object[] { true });

                _mainGame.StartGame();
            }
        }
示例#4
0
 public GuiEvent(GuiEventLoop.ObjectParameterCallback eventCallback, params object[] eventArgs)
 {
     EventCallback = eventCallback;
     EventArgs = eventArgs;
 }
示例#5
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     GuiEventLoop.SaveSelectedStateToDisk();
 }
示例#6
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     GuiEventLoop.OpenStateFromDisk();
 }
示例#7
0
 public void PieceMovedByHuman_Changed(ChessMove move)
 {
     GuiEventLoop.UpdateBoardBasedOnMove((ChessState)this.lstHistory.SelectedItem, move, this.radWhite.Checked);
 }
示例#8
0
 private void WinGui_FormClosing(object sender, FormClosingEventArgs e)
 {
     GuiEventLoop.ShutdownGuiEventLoop();
 }
示例#9
0
 private void viewDecisionTreeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     GuiEventLoop.ShowDecisionTree();
 }
示例#10
0
 private void btnSaveBlacksLog_Click(object sender, EventArgs e)
 {
     GuiEventLoop.SaveBlacksLogToDisk();
 }
示例#11
0
 private void btnClearBlacksLog_Click(object sender, EventArgs e)
 {
     GuiEventLoop.ClearBlacksLog();
 }
示例#12
0
 private void lstHistory_SelectedIndexChanged(object sender, EventArgs e)
 {
     GuiEventLoop.UpdateBoardBasedOnLstHistory((ChessState)this.lstHistory.SelectedItem);
 }
示例#13
0
 private void cmbBlack_SelectedIndexChanged(object sender, EventArgs e)
 {
     GuiEventLoop.UpdateBlacksName(this.cmbBlack.SelectedItem.ToString());
 }
示例#14
0
 private void cmbWhite_SelectedIndexChanged(object sender, EventArgs e)
 {
     GuiEventLoop.UpdateWhitesName(this.cmbWhite.SelectedItem.ToString());
 }
示例#15
0
 private void clearHistoryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     GuiEventLoop.ResetHistory(new ChessState());
 }
示例#16
0
 private void stopToolStripMenuItem_Click(object sender, EventArgs e)
 {
     GuiEventLoop.StopGame();
 }