summaryrefslogtreecommitdiff
path: root/Penguloon
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon')
-rw-r--r--Penguloon/Controls/IngameEndStats.cs106
-rw-r--r--Penguloon/Levels/LevelBase.cs40
-rw-r--r--Penguloon/Levels/Map.cs2
-rw-r--r--Penguloon/Levels/WaveManager.cs1
-rw-r--r--Penguloon/Penguloon.csproj1
-rw-r--r--Penguloon/Resources/Resource.Designer.cs117
-rw-r--r--Penguloon/Resources/Values/Strings.xml15
-rw-r--r--Penguloon/Scenes/GameScene.cs20
-rw-r--r--Penguloon/StaticUIValues.cs4
9 files changed, 250 insertions, 56 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
diff --git a/Penguloon/Levels/LevelBase.cs b/Penguloon/Levels/LevelBase.cs
index 31f94fa..013bd94 100644
--- a/Penguloon/Levels/LevelBase.cs
+++ b/Penguloon/Levels/LevelBase.cs
@@ -21,8 +21,10 @@ namespace Penguloon.Levels
public Map Map { get; set; }
public int Health { get; set; }
+ public int Money { get; set; }
- public int Money { get; set; } = 0;
+ public int HealthBase { get; set; }
+ public int MoneyBase { get; set; }
public int MoneySpent { get; set; } = 0;
@@ -37,16 +39,21 @@ namespace Penguloon.Levels
public TouchLocation[] PrevTouchLocations { get; set; }
public DateTime StartDate { get; set; }
+ public DateTime EndDate { get; set; }
+
+ public bool NewPR { get; set; } = false;
public LevelBase()
{
-
+
}
public abstract void CreateMap();
public virtual void Initialize(GameScene sceneBase)
{
+ MoneyBase = Money;
+ HealthBase = Health;
StartDate = DateTime.Now;
this.ParentScene = sceneBase;
CreateMap();
@@ -62,12 +69,31 @@ namespace Penguloon.Levels
DrawSelectedObject();
- string time = (DateTime.Now - StartDate).ToString("hh':'mm':'ss");
+ string time = "";
+
+ if (!Finished)
+ time = (DateTime.Now - StartDate).ToString("hh':'mm':'ss");
+ else
+ time = (EndDate - StartDate).ToString("hh':'mm':'ss");
ParentScene.DrawText(ContentManager.GetFont("Fonts/GWENT/36"), time, new Vector2(10, StaticUIValues.ScreenViewport.Y - ContentManager.GetFont("Fonts/GWENT/36").MeasureString("XD").Y - 10),
new Vector2(), TextAllignment.LeftTop, Color.White, Color.Black, 2);
}
+ public void Restart()
+ {
+ CreateMap();
+ Map.WaveManager.CurrentWave = 1;
+
+ ParentScene.StartRoundBtn.ControlState = ControlState.Idle;
+ StartDate = DateTime.Now;
+ Kills = 0;
+ MoneySpent = 0;
+ Money = MoneyBase;
+ Health = HealthBase;
+ Finished = false;
+ }
+
private void DrawSelectedObject()
{
if (ParentScene.ObjectSeletor.State == Controls.State.Idle || ParentScene.ObjectSeletor.SelectedObjectIndex == -1) return;
@@ -110,9 +136,12 @@ namespace Penguloon.Levels
{
Map.Update(deltaTime);
- if(Health <= 0)
+ if(Health <= 0 && !Finished)
{
Finished = true;
+ EndDate = DateTime.Now;
+ ParentScene.IngameEndStats.State = IngameOptionsState.Show;
+ FinishGame();
}
UpdateUnique(deltaTime, touchLocations);
@@ -249,7 +278,10 @@ namespace Penguloon.Levels
UserdataManager.HighestKills = Kills;
if (Map.WaveManager.CurrentWave - 1 > UserdataManager.HighestRound)
+ {
UserdataManager.HighestRound = Map.WaveManager.CurrentWave - 1;
+ NewPR = true;
+ }
UserdataManager.WriteData(ParentScene.Main.Context);
diff --git a/Penguloon/Levels/Map.cs b/Penguloon/Levels/Map.cs
index c4dadaf..7f06cd0 100644
--- a/Penguloon/Levels/Map.cs
+++ b/Penguloon/Levels/Map.cs
@@ -158,6 +158,8 @@ namespace Penguloon.Levels
Enemies[i].Update(deltaTime);
}
+ if (ParentScene.Level.Finished) return;
+
for (int i = 0; i < Objects.Count; i++)
{
Objects[i].Update(deltaTime);
diff --git a/Penguloon/Levels/WaveManager.cs b/Penguloon/Levels/WaveManager.cs
index b7dd192..d7be1ba 100644
--- a/Penguloon/Levels/WaveManager.cs
+++ b/Penguloon/Levels/WaveManager.cs
@@ -75,6 +75,7 @@ namespace Penguloon.Levels
internal void FinishRound()
{
+ if (!Map.Level.Finished)
CurrentWave++;
}
}
diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj
index 5721bb6..3d1b5b2 100644
--- a/Penguloon/Penguloon.csproj
+++ b/Penguloon/Penguloon.csproj
@@ -68,6 +68,7 @@
<Compile Include="Controls\Button.cs" />
<Compile Include="Controls\ButtonIngame.cs" />
<Compile Include="Controls\ControlBase.cs" />
+ <Compile Include="Controls\IngameEndStats.cs" />
<Compile Include="Controls\IngameOptions.cs" />
<Compile Include="Controls\MessageBox.cs" />
<Compile Include="Controls\ObjectSelector.cs" />
diff --git a/Penguloon/Resources/Resource.Designer.cs b/Penguloon/Resources/Resource.Designer.cs
index 37ce646..c4c15b9 100644
--- a/Penguloon/Resources/Resource.Designer.cs
+++ b/Penguloon/Resources/Resource.Designer.cs
@@ -66,26 +66,53 @@ namespace Penguloon
// aapt resource value: 0x7f030000
public const int ApplicationName = 2130903040;
- // aapt resource value: 0x7f030012
- public const int IngameNo = 2130903058;
-
// aapt resource value: 0x7f030006
- public const int IngameOptions = 2130903046;
+ public const int EndScreenExit = 2130903046;
- // aapt resource value: 0x7f03000e
- public const int IngameOptionsContinue = 2130903054;
+ // aapt resource value: 0x7f030007
+ public const int EndScreenGameOver = 2130903047;
+
+ // aapt resource value: 0x7f030008
+ public const int EndScreenKills = 2130903048;
+
+ // aapt resource value: 0x7f03000a
+ public const int EndScreenPR = 2130903050;
+
+ // aapt resource value: 0x7f03000b
+ public const int EndScreenRestart = 2130903051;
+
+ // aapt resource value: 0x7f030009
+ public const int EndScreenWave = 2130903049;
// aapt resource value: 0x7f03000f
- public const int IngameOptionsQuit = 2130903055;
+ public const int IngameGold = 2130903055;
- // aapt resource value: 0x7f030010
- public const int IngameOptionsQuitConfirmation = 2130903056;
+ // aapt resource value: 0x7f03000e
+ public const int IngameHealth = 2130903054;
- // aapt resource value: 0x7f030007
- public const int IngameStart = 2130903047;
+ // aapt resource value: 0x7f03001b
+ public const int IngameNo = 2130903067;
- // aapt resource value: 0x7f030011
- public const int IngameYes = 2130903057;
+ // aapt resource value: 0x7f03000c
+ public const int IngameOptions = 2130903052;
+
+ // aapt resource value: 0x7f030017
+ public const int IngameOptionsContinue = 2130903063;
+
+ // aapt resource value: 0x7f030018
+ public const int IngameOptionsQuit = 2130903064;
+
+ // aapt resource value: 0x7f030019
+ public const int IngameOptionsQuitConfirmation = 2130903065;
+
+ // aapt resource value: 0x7f03000d
+ public const int IngameStart = 2130903053;
+
+ // aapt resource value: 0x7f030010
+ public const int IngameWave = 2130903056;
+
+ // aapt resource value: 0x7f03001a
+ public const int IngameYes = 2130903066;
// aapt resource value: 0x7f030005
public const int LevelSelectionBack = 2130903045;
@@ -102,53 +129,53 @@ namespace Penguloon
// aapt resource value: 0x7f030004
public const int MenuBtnSupport = 2130903044;
- // aapt resource value: 0x7f03000a
- public const int ObjectCannon = 2130903050;
+ // aapt resource value: 0x7f030013
+ public const int ObjectCannon = 2130903059;
- // aapt resource value: 0x7f030009
- public const int ObjectGoldPenguin = 2130903049;
+ // aapt resource value: 0x7f030012
+ public const int ObjectGoldPenguin = 2130903058;
- // aapt resource value: 0x7f03000b
- public const int ObjectHospital = 2130903051;
+ // aapt resource value: 0x7f030014
+ public const int ObjectHospital = 2130903060;
- // aapt resource value: 0x7f03000d
- public const int ObjectKingPenguin = 2130903053;
+ // aapt resource value: 0x7f030016
+ public const int ObjectKingPenguin = 2130903062;
- // aapt resource value: 0x7f03000c
- public const int ObjectMortar = 2130903052;
+ // aapt resource value: 0x7f030015
+ public const int ObjectMortar = 2130903061;
- // aapt resource value: 0x7f030008
- public const int ObjectPenguin = 2130903048;
+ // aapt resource value: 0x7f030011
+ public const int ObjectPenguin = 2130903057;
- // aapt resource value: 0x7f03001b
- public const int StatsBestKills = 2130903067;
+ // aapt resource value: 0x7f030024
+ public const int StatsBestKills = 2130903076;
- // aapt resource value: 0x7f03001c
- public const int StatsBestRound = 2130903068;
+ // aapt resource value: 0x7f030025
+ public const int StatsBestRound = 2130903077;
- // aapt resource value: 0x7f03001a
- public const int StatsBestStatsTitle = 2130903066;
+ // aapt resource value: 0x7f030023
+ public const int StatsBestStatsTitle = 2130903075;
- // aapt resource value: 0x7f030013
- public const int StatsLevel = 2130903059;
+ // aapt resource value: 0x7f03001c
+ public const int StatsLevel = 2130903068;
- // aapt resource value: 0x7f030018
- public const int StatsTotalGames = 2130903064;
+ // aapt resource value: 0x7f030021
+ public const int StatsTotalGames = 2130903073;
- // aapt resource value: 0x7f030017
- public const int StatsTotalKills = 2130903063;
+ // aapt resource value: 0x7f030020
+ public const int StatsTotalKills = 2130903072;
- // aapt resource value: 0x7f030019
- public const int StatsTotalMoneySpent = 2130903065;
+ // aapt resource value: 0x7f030022
+ public const int StatsTotalMoneySpent = 2130903074;
- // aapt resource value: 0x7f030016
- public const int StatsTotalStatsTitle = 2130903062;
+ // aapt resource value: 0x7f03001f
+ public const int StatsTotalStatsTitle = 2130903071;
- // aapt resource value: 0x7f030015
- public const int SupportDonate = 2130903061;
+ // aapt resource value: 0x7f03001e
+ public const int SupportDonate = 2130903070;
- // aapt resource value: 0x7f030014
- public const int SupportRate = 2130903060;
+ // aapt resource value: 0x7f03001d
+ public const int SupportRate = 2130903069;
static String()
{
diff --git a/Penguloon/Resources/Values/Strings.xml b/Penguloon/Resources/Values/Strings.xml
index 46cdc4c..aa5679f 100644
--- a/Penguloon/Resources/Values/Strings.xml
+++ b/Penguloon/Resources/Values/Strings.xml
@@ -10,11 +10,22 @@
<!-- level selection -->
<string name="LevelSelectionBack">Back</string>
-
+
+ <!-- ingame endscreen -->
+ <string name="EndScreenExit">Exit</string>
+ <string name="EndScreenGameOver">Game Over</string>
+ <string name="EndScreenKills">Kills</string>
+ <string name="EndScreenWave">Wave</string>
+ <string name="EndScreenPR">New PR!</string>
+ <string name="EndScreenRestart">Restart</string>
+
<!-- ingame -->
<string name="IngameOptions">Options</string>
<string name="IngameStart">Start</string>
-
+ <string name="IngameHealth">Health</string>
+ <string name="IngameGold">Gold</string>
+ <string name="IngameWave">Wave</string>
+
<!-- objects info text -->
<string name="ObjectPenguin">This penguin does not like \n balloons</string>
<string name="ObjectGoldPenguin">This gold penguin shoots \n even faster than regular \n penguins</string>
diff --git a/Penguloon/Scenes/GameScene.cs b/Penguloon/Scenes/GameScene.cs
index 5412147..40a7650 100644
--- a/Penguloon/Scenes/GameScene.cs
+++ b/Penguloon/Scenes/GameScene.cs
@@ -17,6 +17,7 @@ namespace Penguloon.Scenes
public SpeedButton ChangeSpeedBtn { get; set; }
public ButtonIngame OptionsBtn { get; set; }
public IngameOptions OptionsMenu { get; set; }
+ public IngameEndStats IngameEndStats { get; set; }
public ObjectSelector ObjectSeletor { get; set; }
@@ -42,6 +43,11 @@ namespace Penguloon.Scenes
(StaticUIValues.ScreenViewport.Y / 2) - (StaticUIValues.IngameOptionsSize.Y / 2)),
StaticUIValues.IngameOptionsSize);
+ IngameEndStats = new IngameEndStats(this,
+ new Vector2((StaticUIValues.ScreenViewport.X / 2) - (StaticUIValues.IngameOptionsSize.X / 2),
+ (StaticUIValues.ScreenViewport.Y / 2) - (StaticUIValues.IngameOptionsSize.Y / 2)),
+ StaticUIValues.IngameOptionsSize);
+
ChangeSpeedBtn.OnClick += ChangeSpeedBtn_OnClick;
StartRoundBtn.OnClick += StartRoundBtn_OnClick;
OptionsBtn.OnClick += OptionsBtn_OnClick;
@@ -136,20 +142,23 @@ namespace Penguloon.Scenes
(int)StaticUIValues.ScreenViewport.Y - StaticUIValues.IngameUIPlayButtonHeight - StaticUIValues.BorderWidth,
(int)StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth - 5), StaticUIValues.BorderWidth));
- DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), "Gold: " + Level.Money,
+ DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), Main.Resources.GetString(Resource.String.IngameGold) + ": " + Level.Money,
new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, 10),
new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight),
TextAllignment.LeftTop, Color.White, Color.Black, 2);
- DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), "Wave: " + Level.Map.WaveManager.CurrentWave.ToString(),
+ DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), Main.Resources.GetString(Resource.String.IngameWave) + ": " + Level.Map.WaveManager.CurrentWave.ToString(),
new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, 0),
new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight),
TextAllignment.LeftMiddle, Color.White, Color.Black, 2);
- DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), "Health: " + Level.Health,
+ DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), Main.Resources.GetString(Resource.String.IngameHealth) + ": " + Level.Health,
new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, 0),
new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight),
TextAllignment.LeftBottom, Color.White, Color.Black, 2);
+
+ // draw finished controls here
+ IngameEndStats.Draw(deltaTime);
}
public override void Update(float deltaTime, TouchLocation[] touchLocations)
@@ -164,6 +173,11 @@ namespace Penguloon.Scenes
OptionsBtn.Update(deltaTime, touchLocations);
OptionsMenu.Update(deltaTime, touchLocations);
}
+ // update finished controls here
+ else
+ {
+ IngameEndStats.Update(deltaTime, touchLocations);
+ }
if (StartRoundBtn.ControlState == ControlState.Disabled && !Level.Map.WaveManager.RoundActive && !Level.Finished)
{
diff --git a/Penguloon/StaticUIValues.cs b/Penguloon/StaticUIValues.cs
index b436283..b3238bd 100644
--- a/Penguloon/StaticUIValues.cs
+++ b/Penguloon/StaticUIValues.cs
@@ -95,7 +95,7 @@ namespace Penguloon
MenuFont = "Fonts/GWENT/48";
IngameUIPlayButtonHeight = 80;
ChangeSpeedButtonWidth = 130;
- IngameOptionsSize = new Vector2((int)(800 * 0.7), (int)(1000 * 0.7));
+ IngameOptionsSize = new Vector2((int)(800 * 0.6), (int)(1000 * 0.6));
IngameFont = "Fonts/GWENT/24";
StatsFont = "Fonts/GWENT/48";
StatsSpacingY = 60;
@@ -113,7 +113,7 @@ namespace Penguloon
MenuFont = "Fonts/GWENT/48";
IngameUIPlayButtonHeight = 80;
ChangeSpeedButtonWidth = 130;
- IngameOptionsSize = new Vector2((int)(800 * 0.7), (int)(1000 * 0.7));
+ IngameOptionsSize = new Vector2((int)(800 * 0.6), (int)(1000 * 0.6));
IngameFont = "Fonts/GWENT/24";
StatsFont = "Fonts/GWENT/48";
StatsSpacingY = 60;