OpenCells() 공개 메소드

public OpenCells ( int rowIndex, int columnIndex ) : List
rowIndex int
columnIndex int
리턴 List
예제 #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();
        }