/// <summary> /// Initializes a new instance of the <see cref="ScoreboardPanel" /> class. /// </summary> public ScoreboardPanel(ComboPanel comboPanel) { this.comboPanel = comboPanel; this.entity = new Entity("scoreboardPanel") .AddComponent(new Transform2D()) .AddComponent(new PanelControl(345, 96)) .AddComponent(new PanelControlRenderer()) .AddChild(new Image(WaveContent.Assets.Textures.scoreboard_PNG) { DrawOrder = 0.6f, }.Entity); this.time = TimeSpan.FromSeconds(timeSeconds); // Time this.timeText = new TextBlock("timeText") { Width = 132, Height = 42, FontPath = WaveContent.Assets.Fonts.spritefont_time_ttf, Text = this.time.ToString(@"ss\:ff"), Margin = new Thickness(34, 19, 0, 0), Foreground = Color.LightGreen }; this.entity.AddChild(this.timeText.Entity); // Scores this.scoreText = new TextBlock("scoreText") { Width = 132, Height = 42, FontPath = WaveContent.Assets.Fonts.spritefont_time_ttf, Text = string.Format("{0:0000}", this.scores), Margin = new Thickness(207, 19, 0, 0), }; this.entity.AddChild(this.scoreText.Entity); // Lights this.timeIn = new Image(WaveContent.Assets.Textures.scoreboard_timein_PNG) { DrawOrder = 0.45f, Margin = new Thickness(162, 27, 0, 0), }; this.entity.AddChild(this.timeIn.Entity); this.timeOut = new Image(WaveContent.Assets.Textures.scoreboard_timeout_PNG) { DrawOrder = 0.45f, Margin = new Thickness(162, 42, 0, 0), }; this.entity.AddChild(this.timeOut.Entity); }
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="ScoreboardPanel" /> class. /// </summary> public ScoreboardPanel(ComboPanel comboPanel) { this.comboPanel = comboPanel; this.entity = new Entity("scoreboardPanel") .AddComponent(new Transform2D()) .AddComponent(new PanelControl(345, 96)) .AddComponent(new PanelControlRenderer()) .AddChild(new Image(WaveContent.Assets.Textures.scoreboard_PNG) { DrawOrder = 0.6f, }.Entity); this.time = TimeSpan.FromSeconds(timeSeconds); // Time this.timeText = new TextBlock("timeText") { Width = 132, Height = 42, FontPath = WaveContent.Assets.Fonts.spritefont_time_ttf, Text = this.time.ToString(@"ss\:ff"), Margin = new Thickness(34, 19, 0, 0), Foreground = Color.LightGreen }; this.entity.AddChild(this.timeText.Entity); // Scores this.scoreText = new TextBlock("scoreText") { Width = 132, Height = 42, FontPath = WaveContent.Assets.Fonts.spritefont_time_ttf, Text = string.Format("{0:0000}", this.scores), Margin = new Thickness(207, 19, 0, 0), }; this.entity.AddChild(this.scoreText.Entity); // Lights this.timeIn = new Image(WaveContent.Assets.Textures.scoreboard_timein_PNG) { DrawOrder = 0.45f, Margin = new Thickness(162, 27, 0, 0), }; this.entity.AddChild(this.timeIn.Entity); this.timeOut = new Image(WaveContent.Assets.Textures.scoreboard_timeout_PNG) { DrawOrder = 0.45f, Margin = new Thickness(162, 42, 0, 0), }; this.entity.AddChild(this.timeOut.Entity); }