diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2017-12-23 19:14:34 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2017-12-23 19:14:34 +0100 |
| commit | ad0d29bf5d881ab619a90ffb8a1f3352eba21615 (patch) | |
| tree | c69fe6ea7212f2d839ca52e3adb523b27dc532b9 /Penguloon/Scenes/GameScene.cs | |
| parent | 1276593bfbbfcdbac24b48cf8b574da25945d763 (diff) | |
Communism
Diffstat (limited to 'Penguloon/Scenes/GameScene.cs')
| -rw-r--r-- | Penguloon/Scenes/GameScene.cs | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/Penguloon/Scenes/GameScene.cs b/Penguloon/Scenes/GameScene.cs index 0647539..7248730 100644 --- a/Penguloon/Scenes/GameScene.cs +++ b/Penguloon/Scenes/GameScene.cs @@ -16,6 +16,7 @@ namespace Penguloon.Scenes public ButtonIngame StartRoundBtn { get; set; } public SpeedButton ChangeSpeedBtn { get; set; } public ButtonIngame OptionsBtn { get; set; } + public IngameOptions OptionsMenu { get; set; } public ObjectSelector ObjectSeletor { get; set; } @@ -26,18 +27,24 @@ namespace Penguloon.Scenes StartRoundBtn = new ButtonIngame(this, new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, StaticUIValues.ScreenViewport.Y - StaticUIValues.IngameUIPlayButtonHeight), - new Vector2(StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth), StaticUIValues.IngameUIPlayButtonHeight), "Start"); + new Vector2(StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth), StaticUIValues.IngameUIPlayButtonHeight), Main.Resources.GetString(Resource.String.IngameStart)); OptionsBtn = new ButtonIngame(this, new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, StaticUIValues.ScreenViewport.Y - StaticUIValues.IngameUIPlayButtonHeight - StaticUIValues.IngameUIPlayButtonHeight - StaticUIValues.BorderWidth), - new Vector2(StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth), StaticUIValues.IngameUIPlayButtonHeight), "Options"); + new Vector2(StaticUIValues.ScreenViewport.X - (Level.Map.MapWidth + StaticUIValues.BorderWidth), StaticUIValues.IngameUIPlayButtonHeight), Main.Resources.GetString(Resource.String.IngameOptions)); ChangeSpeedBtn = new SpeedButton(this, - new Vector2(Level.Map.MapWidth - 200, StaticUIValues.ScreenViewport.Y - StaticUIValues.IngameUIPlayButtonHeight), - new Vector2(200, StaticUIValues.IngameUIPlayButtonHeight), "X1"); + new Vector2(Level.Map.MapWidth - StaticUIValues.ChangeSpeedButtonWidth, StaticUIValues.ScreenViewport.Y - StaticUIValues.IngameUIPlayButtonHeight), + new Vector2(StaticUIValues.ChangeSpeedButtonWidth, StaticUIValues.IngameUIPlayButtonHeight), "X1"); + + OptionsMenu = new IngameOptions(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; ObjectSeletor = new ObjectSelector(level.Map, this, new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight + StaticUIValues.BorderWidth), @@ -46,6 +53,15 @@ namespace Penguloon.Scenes } + private void OptionsBtn_OnClick(object sender, ClickArgs e) + { + if (OptionsMenu.State == IngameOptionsState.Hide) + { + OptionsMenu.ShowTime = DateTime.Now; + OptionsMenu.State = IngameOptionsState.Show; + } + } + private void ChangeSpeedBtn_OnClick(object sender, ClickArgs e) { switch (Speed) @@ -88,6 +104,7 @@ namespace Penguloon.Scenes ObjectSeletor.Draw(deltaTime); ChangeSpeedBtn.Draw(deltaTime); OptionsBtn.Draw(deltaTime); + OptionsMenu.Draw(deltaTime); } private void DrawUI(float deltaTime) @@ -122,17 +139,17 @@ namespace Penguloon.Scenes DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), "Gold: " + Level.Money, new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, 10), new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight), - TextAllignment.CenterTop, Color.White, Color.Black, 2); + TextAllignment.LeftTop, Color.White, Color.Black, 2); DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), "Wave: " + 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.CenterMiddle, Color.White, Color.Black, 2); + TextAllignment.LeftMiddle, Color.White, Color.Black, 2); DrawText(ContentManager.GetFont(StaticUIValues.IngameFont), "Health: " + Level.Health, new Vector2(Level.Map.MapWidth + StaticUIValues.BorderWidth, 0), new Vector2(StaticUIValues.ScreenViewport.X - Level.Map.MapWidth - StaticUIValues.BorderWidth, StaticUIValues.IngameUITextAreaHeight), - TextAllignment.CenterBottom, Color.White, Color.Black, 2); + TextAllignment.LeftBottom, Color.White, Color.Black, 2); } public override void Update(float deltaTime, TouchLocation[] touchLocations) @@ -145,6 +162,7 @@ namespace Penguloon.Scenes ObjectSeletor.Update(deltaTime, touchLocations); ChangeSpeedBtn.Update(deltaTime, touchLocations); OptionsBtn.Update(deltaTime, touchLocations); + OptionsMenu.Update(deltaTime, touchLocations); } if (StartRoundBtn.ControlState == ControlState.Disabled && !Level.Map.WaveManager.RoundActive && !Level.Finished) |
