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