From 8d30b5ac461e95cabfc74e46b610beabd81cb460 Mon Sep 17 00:00:00 2001 From: aldrikboy Date: Sun, 14 Jan 2018 13:42:38 +0100 Subject: upgrade menu --- Penguloon/Scenes/GameScene.cs | 48 +++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'Penguloon/Scenes') diff --git a/Penguloon/Scenes/GameScene.cs b/Penguloon/Scenes/GameScene.cs index 40a7650..06c171c 100644 --- a/Penguloon/Scenes/GameScene.cs +++ b/Penguloon/Scenes/GameScene.cs @@ -104,13 +104,34 @@ namespace Penguloon.Scenes this.Level.Draw(deltaTime); - DrawUI(deltaTime); + if (Level.SelectedObject == null) + { + DrawUI(deltaTime); + + StartRoundBtn.Draw(deltaTime); + ObjectSeletor.Draw(deltaTime); + ChangeSpeedBtn.Draw(deltaTime); + OptionsBtn.Draw(deltaTime); + OptionsMenu.Draw(deltaTime); + } + // show upgrade menu of object is selected + else + { + DrawUpgradeUI(); + } + } + + private void DrawUpgradeUI() + { + //background + Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/objectSelectionBackground"), + destinationRectangle: new Rectangle(Level.Map.MapWidth + StaticUIValues.BorderWidth, + 0, (int)StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth), (int)StaticUIValues.ScreenViewport.Y)); - StartRoundBtn.Draw(deltaTime); - ObjectSeletor.Draw(deltaTime); - ChangeSpeedBtn.Draw(deltaTime); - OptionsBtn.Draw(deltaTime); - OptionsMenu.Draw(deltaTime); + //border + Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/border"), + destinationRectangle: new Rectangle(Level.Map.MapWidth, + 0, StaticUIValues.BorderWidth, (int)StaticUIValues.ScreenViewport.Y)); } private void DrawUI(float deltaTime) @@ -143,17 +164,17 @@ namespace Penguloon.Scenes (int)StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth - 5), StaticUIValues.BorderWidth)); DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), Main.Resources.GetString(Resource.String.IngameGold) + ": " + Level.Money, - new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, 10), + new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth + 5, 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), Main.Resources.GetString(Resource.String.IngameWave) + ": " + Level.Map.WaveManager.CurrentWave.ToString(), - new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, 0), + new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth + 5, 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), Main.Resources.GetString(Resource.String.IngameHealth) + ": " + Level.Health, - new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, 0), + new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth + 5, 0), new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight), TextAllignment.LeftBottom, Color.White, Color.Black, 2); @@ -164,7 +185,7 @@ namespace Penguloon.Scenes public override void Update(float deltaTime, TouchLocation[] touchLocations) { // We shouldn't update controls when the game is finished to prevent the user from placing any more objects - if (!Level.Finished) + if (!Level.Finished && Level.SelectedObject == null) { base.Update(deltaTime, touchLocations); StartRoundBtn.Update(deltaTime, touchLocations); @@ -174,10 +195,15 @@ namespace Penguloon.Scenes OptionsMenu.Update(deltaTime, touchLocations); } // update finished controls here - else + else if (Level.Finished) { IngameEndStats.Update(deltaTime, touchLocations); } + // update upgrade menu here + else + { + + } if (StartRoundBtn.ControlState == ControlState.Disabled && !Level.Map.WaveManager.RoundActive && !Level.Finished) { -- cgit v1.2.3-70-g09d2