summaryrefslogtreecommitdiff
path: root/Penguloon/Controls
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon/Controls')
-rw-r--r--Penguloon/Controls/MuteButton.cs44
-rw-r--r--Penguloon/Controls/UpgradeMenu.cs12
2 files changed, 55 insertions, 1 deletions
diff --git a/Penguloon/Controls/MuteButton.cs b/Penguloon/Controls/MuteButton.cs
new file mode 100644
index 0000000..fdd1d91
--- /dev/null
+++ b/Penguloon/Controls/MuteButton.cs
@@ -0,0 +1,44 @@
+using Microsoft.Xna.Framework;
+using Penguloon.Scenes;
+
+namespace Penguloon.Controls
+{
+ public class MuteButton : ControlBase
+ {
+ public bool Muted { get; set; } = false;
+
+ public MuteButton(SceneBase parentScene, Vector2 position, Vector2 size) : base(parentScene, position, size)
+ {
+ this.BackgroundIdle = ContentManager.GetTexture("UI/BtnMuteIdle");
+ this.BackgroundPressed = ContentManager.GetTexture("UI/BtnMutePressed");
+ this.BackgroundDisabled = ContentManager.GetTexture("UI/BtnMutePressed");
+
+ this.ForeColor = Color.White;
+ this.BorderColor = Color.Gray;
+ this.BorderWidth = 0;
+ this.Font = ContentManager.GetFont(StaticUIValues.MenuFont);
+
+ OnClick += Button_OnClick;
+ }
+
+ private void Button_OnClick(object sender, ClickArgs e)
+ {
+ Muted = !Muted;
+
+ SoundManager.Muted = Muted;
+
+ if (Muted)
+ {
+ this.BackgroundIdle = ContentManager.GetTexture("UI/BtnUnmuteIdle");
+ this.BackgroundPressed = ContentManager.GetTexture("UI/BtnUnmutePressed");
+ }
+ else
+ {
+ this.BackgroundIdle = ContentManager.GetTexture("UI/BtnMuteIdle");
+ this.BackgroundPressed = ContentManager.GetTexture("UI/BtnMutePressed");
+ }
+
+ SoundManager.PlayClickSound();
+ }
+ }
+} \ No newline at end of file
diff --git a/Penguloon/Controls/UpgradeMenu.cs b/Penguloon/Controls/UpgradeMenu.cs
index 6156018..cd6e6bb 100644
--- a/Penguloon/Controls/UpgradeMenu.cs
+++ b/Penguloon/Controls/UpgradeMenu.cs
@@ -31,9 +31,19 @@ namespace Penguloon.Controls
SellConfirmationBox = new MessageBox(parentScene,
new Vector2((StaticUIValues.ScreenViewport.X / 2) - (MsgBoxSize.X / 2), (StaticUIValues.ScreenViewport.Y / 2) - (MsgBoxSize.Y / 2)),
- MsgBoxSize, parentScene.Main.Resources.GetString(Resource.String.IngameOptionsQuitConfirmation));
+ MsgBoxSize, parentScene.Main.Resources.GetString(Resource.String.UpgradeMenuSellConfirmation));
UpgradeMenuSell.OnClick += UpgradeMenuSell_OnClick;
+
+ SellConfirmationBox.OnYes += SellConfirmationBox_OnYes;
+ }
+
+ private void SellConfirmationBox_OnYes(object sender, EventArgs e)
+ {
+ SoundManager.PlaySellSound();
+ Level.Money += 100;
+ Level.Map.Objects.Remove(Level.SelectedObject);
+ Level.SelectedObject = null;
}
private void UpgradeMenuSell_OnClick(object sender, ClickArgs e)