private void playChoise(GameSlot i_SlotClicked) { GameLogic.Point pointChosen = i_SlotClicked.SlotPoint; exposeSlot(pointChosen); if (m_IsFirstChoise) { m_GameManager.PlayChoise(pointChosen); m_FirstChoise = i_SlotClicked; m_IsFirstChoise = false; } else { System.Threading.Thread.Sleep(1000); if (m_GameManager.PlayChoise(m_IsFirstPlayerTurn, m_FirstChoise.SlotPoint, pointChosen)) { updatePlayersInfoLabels(); if (m_GameManager.IsGameOver()) { gameOverDialog(); } } else { m_GameManager.m_GameBoard.FlipSlot(pointChosen); m_GameManager.m_GameBoard.FlipSlot(m_FirstChoise.SlotPoint); hideSlot(pointChosen); hideSlot(m_FirstChoise.SlotPoint); m_IsFirstPlayerTurn = !m_IsFirstPlayerTurn; updateCurrentPlayerLabel(); if (!m_GameManager.IsSecondPlayerReal()) { computerTurn(); } } m_IsFirstChoise = true; } }
private void initializeGameSlots() { m_SlotButtons = new GameSlot[r_Rows, r_Columns]; for (int i = 0; i < r_Rows; i++) { for (int j = 0; j < r_Columns; j++) { m_SlotButtons[i, j] = new GameSlot(i, j) { BackgroundImageLayout = ImageLayout.Stretch, Size = new Size(k_SquareCardSize, k_SquareCardSize), Left = (i * (k_SquareCardSize + k_MarginBorders)) + k_MarginBorders, Top = (j * (k_SquareCardSize + k_MarginBorders)) + k_MarginBorders }; Controls.Add(m_SlotButtons[i, j]); } } }