Ejemplo n.º 1
0
        private void addCellButton(Point i_LogicCordinates)
        {
            TicTacToeCellButton cellButton = new TicTacToeCellButton(i_LogicCordinates)
            {
                Size     = DefaultButtonSize,
                Location = calculateVisualPoint(i_LogicCordinates, DefaultButtonSize, DefaultPadding)
            };

            CellButtons.Add(cellButton);
            cellButton.Click      += CellButton_Click;
            cellButton.MouseEnter += CellButton_MouseEnter;
            cellButton.MouseLeave += CellButton_MouseLeave;
            Controls.Add(cellButton);
        }
Ejemplo n.º 2
0
        private void CellButton_Click(object i_Sender, EventArgs i_EventArgs)
        {
            TicTacToeCellButton ticTacToeCellButton = i_Sender as TicTacToeCellButton;

            if (CurrentPlayer.PlayerName == PlayerOneInfo.PlayerName)
            {
                DrawLabelsBoldAndRegularRespectively(labelPlayer2N, labelPlayer1N);
            }
            else
            {
                DrawLabelsBoldAndRegularRespectively(labelPlayer1N, labelPlayer2N);
            }

            if (ticTacToeCellButton != null)
            {
                GameLogicManager.PlayerMove(ticTacToeCellButton.CellLocation);
            }
        }
Ejemplo n.º 3
0
        private void r_TicTacToe_OnGUIBoardChange(Point i_Point, eCellValue i_Symbol)
        {
            TicTacToeCellButton button = getButtonByPoint(i_Point);

            button.SetSymbol(i_Symbol);
            button.Enabled = false;

            switch (GameLogicManager.GameState)
            {
            case eGameState.Tie:
                showNewGameMessage(tieMessage());
                break;

            case eGameState.HasWinner:
                showNewGameMessage(winnerMessage());
                break;

            case eGameState.Active:
                togglePlayers();
                break;
            }
        }