Example #1
0
        private void resetBoardForRematch()
        {
            hideAllImages();
            m_FirstPlayer.ClearPoints();
            m_SecondPlayer.ClearPoints();
            m_CurrentPlayer = m_SecondPlayer;
            m_CurrentPlayer = m_CurrentPlayer.ChangePlayer(m_FirstPlayer, m_SecondPlayer);
            if (m_ComputerMemory != null)
            {
                m_ComputerMemory = new ComputerAI();
            }

            m_GameBoard = new MemoryGameBoard(m_NumberOfRows, m_NumberOfColumns);
            m_GameBoard.FillBoard();
            for (int i = 0; i < m_NumberOfRows; i++)
            {
                for (int j = 0; j < m_NumberOfColumns; j++)
                {
                    m_GameBoard.BoardMatrix[i, j].CardVisabilityChanged += card_CardVisabilityChanged;
                    m_CardsButtons[i, j].LogicMemoryGameCardReference    = m_GameBoard.BoardMatrix[i, j];
                    m_CardsButtons[i, j].RowNumber    = i;
                    m_CardsButtons[i, j].ColumnNumber = j;
                    m_CardsButtons[i, j].UpdateImageURL();
                }
            }

            this.Update();
        }
Example #2
0
        internal void UpdateGameSettings(string i_BoardSize, Player i_FirstPlayer, Player i_SecondPlayer, bool i_IsAgaintComputer)
        {
            m_NumberOfRows                     = i_BoardSize[0] - '0';
            m_NumberOfColumns                  = i_BoardSize[2] - '0';
            m_FirstPlayer                      = i_FirstPlayer;
            m_FirstPlayer.PlayerChanged       += player_CurrentPlayerChanged;
            m_FirstPlayer.PlayerScoreChanged  += player_PlayerScoreIncreased;
            m_SecondPlayer                     = i_SecondPlayer;
            m_SecondPlayer.PlayerChanged      += player_CurrentPlayerChanged;
            m_SecondPlayer.PlayerScoreChanged += player_PlayerScoreIncreased;
            m_CurrentPlayer                    = i_FirstPlayer;
            m_GameManager                      = new PlayMemoryGame();
            m_GameBoard         = new MemoryGameBoard(i_BoardSize[0] - '0', i_BoardSize[2] - '0');
            m_CardsButtons      = new MemoryGameCardButtuon[i_BoardSize[0] - '0', i_BoardSize[2] - '0'];
            m_IsAgainstComputer = i_IsAgaintComputer;
            if (m_IsAgainstComputer == true)
            {
                m_ComputerMemory = new ComputerAI();
            }

            initializeComponent();
        }