summaryrefslogtreecommitdiff
path: root/Penguloon/Controls
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon/Controls')
-rw-r--r--Penguloon/Controls/IngameEndStats.cs106
1 files changed, 106 insertions, 0 deletions
diff --git a/Penguloon/Controls/IngameEndStats.cs b/Penguloon/Controls/IngameEndStats.cs
new file mode 100644
index 0000000..62d903d
--- /dev/null
+++ b/Penguloon/Controls/IngameEndStats.cs
@@ -0,0 +1,106 @@
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input.Touch;
+using Penguloon.Scenes;
+using System;
+
+namespace Penguloon.Controls
+{
+ public class IngameEndStats : ControlBase
+ {
+ public IngameOptionsState State { get; set; } = IngameOptionsState.Hide;
+
+ public DateTime ShowTime { get; set; }
+
+ public Button BtnExit { get; set; }
+ public Button BtnRestart { get; set; }
+
+ public IngameEndStats(SceneBase parentScene, Vector2 position, Vector2 size) : base(parentScene, position, size)
+ {
+ this.DrawText = false;
+ this.BackgroundIdle = ContentManager.GetTexture("UI/optionsMenuBackground");
+ this.BackgroundPressed = ContentManager.GetTexture("UI/optionsMenuBackground");
+ this.BackgroundDisabled = ContentManager.GetTexture("UI/optionsMenuBackground");
+
+ Vector2 BtnSize = new Vector2(Size.X - 90, StaticUIValues.IngameUIPlayButtonHeight);
+ Vector2 MsgBoxSize = new Vector2(900, 550);
+
+ BtnExit = new Button(parentScene,
+ new Vector2(position.X + (Size.X / 2) - (BtnSize.X / 2), Position.Y + Size.Y - 50 - BtnSize.Y),
+ BtnSize, parentScene.Main.Resources.GetString(Resource.String.EndScreenExit));
+
+ BtnRestart = new Button(parentScene,
+ new Vector2(position.X + (Size.X / 2) - (BtnSize.X / 2), Position.Y + Size.Y - 50 - BtnSize.Y - BtnSize.Y - 20),
+ BtnSize, parentScene.Main.Resources.GetString(Resource.String.EndScreenRestart));
+
+ BtnExit.OnClick += BtnExit_OnClick;
+ BtnRestart.OnClick += BtnRestart_OnClick;
+ }
+
+ private void BtnRestart_OnClick(object sender, ClickArgs e)
+ {
+ GameScene gameScene = (GameScene)ParentScene;
+ this.State = IngameOptionsState.Hide;
+
+ gameScene.Level.Restart();
+ }
+
+ private void BtnExit_OnClick(object sender, ClickArgs e)
+ {
+ GameScene gameScene = (GameScene)ParentScene;
+ SceneManager.SelectedScene = SelectedScene.Menu;
+ }
+
+ public override void Draw(float deltaTime)
+ {
+ if (State == IngameOptionsState.Hide) return;
+
+ base.Draw(deltaTime);
+
+ SpriteFont font_ = ContentManager.GetFont(StaticUIValues.MenuFont);
+ int textHeight = (int)font_.MeasureString("Y").Y;
+ GameScene scene = (GameScene)ParentScene;
+
+ // game over
+ ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.MenuFont),
+ ParentScene.Main.Resources.GetString(Resource.String.EndScreenGameOver), new Vector2(Position.X, Position.Y + 40),
+ new Vector2(Size.X, 0), TextAllignment.CenterTop,
+ Color.FromNonPremultiplied(111, 138, 183, 255), Color.Black, 2);
+
+ // kills
+ ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.MenuFont),
+ ParentScene.Main.Resources.GetString(Resource.String.EndScreenKills) + ": " + scene.Level.Kills,
+ new Vector2(Position.X, Position.Y + (30 * 2) + (textHeight * 1)),
+ new Vector2(Size.X, 0), TextAllignment.CenterTop,
+ Color.White, Color.Black, 2);
+
+ // wave
+ ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.MenuFont),
+ ParentScene.Main.Resources.GetString(Resource.String.EndScreenWave) + ": " + (scene.Level.Map.WaveManager.CurrentWave - 1).ToString(),
+ new Vector2(Position.X, Position.Y + (20 * 3) + (textHeight * 2)),
+ new Vector2(Size.X, 0), TextAllignment.CenterTop,
+ Color.White, Color.Black, 2);
+
+ // pr
+ if (scene.Level.NewPR)
+ ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.MenuFont),
+ ParentScene.Main.Resources.GetString(Resource.String.EndScreenPR),
+ new Vector2(Position.X, Position.Y + (20 * 4) + (textHeight * 3)),
+ new Vector2(Size.X, 0), TextAllignment.CenterTop,
+ Color.FromNonPremultiplied(220, 0, 0, 255), Color.Black, 2);
+
+ BtnExit.Draw(deltaTime);
+ BtnRestart.Draw(deltaTime);
+ }
+
+ public override void Update(float deltaTime, TouchLocation[] touchLocations)
+ {
+ if (State == IngameOptionsState.Hide) return;
+
+ base.Update(deltaTime, touchLocations);
+
+ BtnExit.Update(deltaTime, touchLocations);
+ BtnRestart.Update(deltaTime, touchLocations);
+ }
+ }
+} \ No newline at end of file