Exemplo n.º 1
0
        public static void Run()
        {
            GameSettingForm gameSetting = new GameSettingForm();

            if (gameSetting.ShowDialog() == DialogResult.OK)
            {
                MemoryGameForm MemoryGame = new MemoryGameForm(gameSetting);
                MemoryGame.ShowDialog();
            }
        }
Exemplo n.º 2
0
        public MemoryGameForm(GameSettingForm i_GameSettingForm)
        {
            Text            = "Memory Game";
            FormBorderStyle = FormBorderStyle.FixedToolWindow;
            StartPosition   = FormStartPosition.CenterScreen;
            Player firstPlayer  = new Player(i_GameSettingForm.FirstPlayerName);
            Player secondPlayer = new Player(i_GameSettingForm.SecondPlayerName);

            r_GameManager = new GameManager(i_GameSettingForm.BoardColumns, i_GameSettingForm.BoardRows, firstPlayer, secondPlayer);
            r_GameManager.FirstPlayer.Turn = true;
            r_GameManager.GameOver        += gameManager_GameOver;
            r_GameManager.BoardChanged    += gameManager_BoardChanged;
            r_Board = new Button[i_GameSettingForm.BoardRows, i_GameSettingForm.BoardColumns];
            int widthBoard  = (i_GameSettingForm.BoardColumns * k_ButtonSquareSize) + ((i_GameSettingForm.BoardColumns - 1) * k_Space);
            int heightBoard = (i_GameSettingForm.BoardRows * k_ButtonSquareSize) + ((i_GameSettingForm.BoardRows - 1) * k_Space);

            Size               = new Size(widthBoard + 35, heightBoard + 120);
            r_ListOfImages     = buildListOfImages();
            m_MouseClickStatus = eClickMode.UnClickedMouse;
        }