private void HideMainMenu() { mainMenuTimer.Stop(); label1.Hide(); label2.Hide(); label3.Hide(); label4.Hide(); label5.Hide(); label6.Hide(); MemoryLabel.Hide(); StartButton.Hide(); HiScoresButton.Hide(); QuitButton.Hide(); }
private void UpdateView() { if (_gameOver) { return; } UpdateState(); var match = _state.GetValue(); if (match.operationState == GameOperationState.WaitingForPlayers) { GameStatusLabel.Text = "Waiting for an opponent."; } else if (match.playerTurnId == Program.infoController.profile.id) { GameStatusLabel.Text = "Your Turn."; } else { GameStatusLabel.Text = "Opponents Turn."; } var board = new List <Button> { TopLeftButton, TopCenterButton, TopRightButton, MiddleLeftButton, MiddleCenterButton, MiddleRightButton, BottomLeftButton, BottomCenterButton, BottomRightButton, }; for (int i = 0; i < 9; i++) { var mark = match.inGameState.board[i]; if (mark == PlayerMark.X) { board[i].Text = "X"; } else if (mark == PlayerMark.O) { board[i].Text = "O"; } } if (match.operationState == GameOperationState.Completed) { _gameOver = true; UpdateTimer.Enabled = false; QuitButton.Hide(); if (match.winnerId == Program.infoController.profile.id) { MessageBox.Show("Congratulations you won!"); GameStatusLabel.Text = "You Won!"; } else { MessageBox.Show("Congratulations you lost!"); GameStatusLabel.Text = "You Lost!"; } BackButton.Show(); _state.Dispose(); } }