RemarkCell() public method

public RemarkCell ( int rowIndex, int columnIndex ) : Cell
rowIndex int
columnIndex int
return Cell
示例#1
0
        private void GameButtonMouseClick(object sender, MouseEventArgs e)
        {
            int buttonIndex = _gameButtons.ToList().IndexOf((Button)sender);
            int rowIndex    = buttonIndex / _gameSettings.GameFieldWidth;
            int columnIndex = buttonIndex % _gameSettings.GameFieldWidth;

            if (e.Button == MouseButtons.Right)
            {
                RefreshButton(_game.RemarkCell(rowIndex, columnIndex));
            }
            else
            {
                RefreshButtons(_game.OpenCells(rowIndex, columnIndex));
            }

            if (_game.State != GameState.PlayerLose)
            {
                if (_game.PlayerWins())
                {
                    EndGame("You are win!");
                    return;
                }
            }
            else
            {
                EndGame("You are lose!");
                return;
            }

            Invalidate();
        }