/// <summary> /// Displays dialog if game won. /// </summary> public async void CheckIfWon() { if (game.Success()) { double gameDuration = (DateTime.Now - gameStartTime).TotalSeconds; Timer.Stop(); var newFastest = settings.UpdateTime(prevGameComplexity.Complexity, gameDuration); var wonDialog = new ContentDialog { Title = newFastest ? $"New High Score: {gameDuration}" : "Game Won", Content = "You've successfully avoided all bombs", PrimaryButtonText = "Restart", SecondaryButtonText = "Close" }; if (newFastest) { HighScorePanel.Refresh(); } var dialogReturn = await wonDialog.ShowAsync(); switch (dialogReturn) { case ContentDialogResult.Primary: StartNewGame(); break; case ContentDialogResult.Secondary: break; } } }
public void OpenHighScore() { highScore.SetActive(true); HighScorePanel panel = highScore.GetComponent <HighScorePanel>(); panel.OpenHighScore(); }
public override void LoadContent() { EnabledGestures = ScrollTracker.GesturesNeeded; ContentManager content = ScreenManager.Game.Content; RootControl = new HighScorePanel(content); base.LoadContent(); }
private void CreateUI() { // Pause button this.b_pause = new Button() { IsBorder = false, Text = string.Empty, BackgroundImage = WaveContent.Assets.Textures.pause_bt_PNG, PressedBackgroundImage = WaveContent.Assets.Textures.pause_bt_pressed_PNG, HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, WaveServices.ViewportManager.TopEdge + 10, 10, 0), }; this.b_pause.Click += (s, o) => { SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button); WaveServices.ScreenContextManager.Push(new ScreenContext(new PauseScene(this))); }; EntityManager.Add(this.b_pause); // Ready! Go! Timeout! this.messagePanel = new MessagePanel(MessagePanel.MessageType.HurryUp) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; EntityManager.Add(this.messagePanel); // Stadistics this.stadisticsPanel = new StadisticsPanel() { HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, WaveServices.ViewportManager.TopEdge, 0, 0), }; EntityManager.Add(this.stadisticsPanel); // HighScore this.highScorePanel = new HighScorePanel() { HorizontalAlignment = HorizontalAlignment.Right, Margin = new Thickness(0, 100, 0, 0), }; EntityManager.Add(this.highScorePanel); // Combo this.comboPanel = new ComboPanel(new Vector2(WaveServices.ViewportManager.VirtualWidth / 2, WaveServices.ViewportManager.TopEdge + 150)); EntityManager.Add(this.comboPanel); // Scoreboard this.scoreboardPanel = new ScoreboardPanel(this.comboPanel) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Top, Margin = new Thickness(0, WaveServices.ViewportManager.TopEdge, 0, 0), }; EntityManager.Add(this.scoreboardPanel); }
/// <summary> /// Initializes a new instance of the <see cref="MainPage"/> class. /// </summary> public MainPage() { this.InitializeComponent(); PlayingField_ViewBox.Stretch = Stretch.Uniform; InitialiseComplexityOptions(); RestorePlayingField(); HighScorePanel.Refresh(); Timer.Tick += Timer_Tick; Timer.Interval = new TimeSpan(0, 0, 0, 0, 1); gameStartTime = DateTime.Now; Timer.Start(); }
void Update() { if (!showNewgame) { if (Input.GetMouseButton(0) && !highScorePanel.activeSelf) { highScorePanel.SetActive(true); HighScorePanel panel = highScorePanel.GetComponent <HighScorePanel>(); panel.OpenHighScore(); showNewgame = true; } } else { newGameButton.gameObject.SetActive(true); } }
public void SetDeath() { if (CurrentScore > HighScore) { HIGHSCOREBOARD.text = "New High Score - " + CurrentScore.ToString(); HighScorePanel.SetActive(true); RegisterHighScore(CurrentScore); } else { GameOverPanelInsider.SetActive(true); } isDead = true; OnGamePanel.SetActive(false); GameOverPanel.SetActive(true); gameOverHighScore.text = "High Score - " + HighScore.ToString(); gameOverScore.text = "Current Score - " + CurrentScore.ToString(); }