summaryrefslogtreecommitdiff
path: root/Penguloon
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon')
-rw-r--r--Penguloon/Content/Content.mgcb54
-rw-r--r--Penguloon/Content/Sounds/sell.wavbin0 -> 45100 bytes
-rw-r--r--Penguloon/Content/UI/BtnMuteIdle.pngbin0 -> 5411 bytes
-rw-r--r--Penguloon/Content/UI/BtnMutePressed.pngbin0 -> 5517 bytes
-rw-r--r--Penguloon/Content/UI/BtnUnmuteIdle.pngbin0 -> 6342 bytes
-rw-r--r--Penguloon/Content/UI/BtnUnmutePressed.pngbin0 -> 6888 bytes
-rw-r--r--Penguloon/ContentPathManager.cs5
-rw-r--r--Penguloon/Controls/MuteButton.cs44
-rw-r--r--Penguloon/Controls/UpgradeMenu.cs12
-rw-r--r--Penguloon/Levels/LevelBase.cs2
-rw-r--r--Penguloon/Penguloon.csproj1
-rw-r--r--Penguloon/Resources/Resource.Designer.cs74
-rw-r--r--Penguloon/Resources/Values/Strings.xml11
-rw-r--r--Penguloon/Scenes/MenuScene.cs5
-rw-r--r--Penguloon/Scenes/StatsScene.cs2
-rw-r--r--Penguloon/SoundManager.cs63
16 files changed, 227 insertions, 46 deletions
diff --git a/Penguloon/Content/Content.mgcb b/Penguloon/Content/Content.mgcb
index 0c412ff..a65c337 100644
--- a/Penguloon/Content/Content.mgcb
+++ b/Penguloon/Content/Content.mgcb
@@ -949,3 +949,57 @@
/processorParam:TextureFormat=Color
/build:UI/darkred.png
+#begin Sounds/sell.wav
+/importer:WavImporter
+/processor:SoundEffectProcessor
+/processorParam:Quality=Best
+/build:Sounds/sell.wav
+
+#begin UI/BtnMuteIdle.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/BtnMuteIdle.png
+
+#begin UI/BtnMutePressed.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/BtnMutePressed.png
+
+#begin UI/BtnUnmuteIdle.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/BtnUnmuteIdle.png
+
+#begin UI/BtnUnmutePressed.png
+/importer:TextureImporter
+/processor:TextureProcessor
+/processorParam:ColorKeyColor=255,0,255,255
+/processorParam:ColorKeyEnabled=True
+/processorParam:GenerateMipmaps=False
+/processorParam:PremultiplyAlpha=True
+/processorParam:ResizeToPowerOfTwo=False
+/processorParam:MakeSquare=False
+/processorParam:TextureFormat=Color
+/build:UI/BtnUnmutePressed.png
+
diff --git a/Penguloon/Content/Sounds/sell.wav b/Penguloon/Content/Sounds/sell.wav
new file mode 100644
index 0000000..ec44b77
--- /dev/null
+++ b/Penguloon/Content/Sounds/sell.wav
Binary files differ
diff --git a/Penguloon/Content/UI/BtnMuteIdle.png b/Penguloon/Content/UI/BtnMuteIdle.png
new file mode 100644
index 0000000..0024be5
--- /dev/null
+++ b/Penguloon/Content/UI/BtnMuteIdle.png
Binary files differ
diff --git a/Penguloon/Content/UI/BtnMutePressed.png b/Penguloon/Content/UI/BtnMutePressed.png
new file mode 100644
index 0000000..b567260
--- /dev/null
+++ b/Penguloon/Content/UI/BtnMutePressed.png
Binary files differ
diff --git a/Penguloon/Content/UI/BtnUnmuteIdle.png b/Penguloon/Content/UI/BtnUnmuteIdle.png
new file mode 100644
index 0000000..5e49356
--- /dev/null
+++ b/Penguloon/Content/UI/BtnUnmuteIdle.png
Binary files differ
diff --git a/Penguloon/Content/UI/BtnUnmutePressed.png b/Penguloon/Content/UI/BtnUnmutePressed.png
new file mode 100644
index 0000000..441daa9
--- /dev/null
+++ b/Penguloon/Content/UI/BtnUnmutePressed.png
Binary files differ
diff --git a/Penguloon/ContentPathManager.cs b/Penguloon/ContentPathManager.cs
index eebe42d..a2f59ba 100644
--- a/Penguloon/ContentPathManager.cs
+++ b/Penguloon/ContentPathManager.cs
@@ -65,6 +65,10 @@ namespace Penguloon
"UI/darkred",
//"UI/objectinfo",
//"UI/objectinfo-line",
+ "UI/BtnMuteIdle",
+ "UI/BtnMutePressed",
+ "UI/BtnUnmuteIdle",
+ "UI/BtnUnmutePressed",
"UI/speed",
"UI/money",
@@ -110,6 +114,7 @@ namespace Penguloon
"Sounds/placeobject",
"Sounds/upgrade",
"Sounds/unavailable",
+ "Sounds/sell",
};
public static List<string> TexturePathsPreLoad { get; set; } = new List<string>()
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)
diff --git a/Penguloon/Levels/LevelBase.cs b/Penguloon/Levels/LevelBase.cs
index 93622c5..7d67d70 100644
--- a/Penguloon/Levels/LevelBase.cs
+++ b/Penguloon/Levels/LevelBase.cs
@@ -159,6 +159,8 @@ namespace Penguloon.Levels
private void CheckForObjectSelect(TouchLocation[] touchLocations)
{
+ if (ParentScene.UpgradeMenu.SellConfirmationBox.State == IngameOptionsState.Show) return;
+
bool found = false;
for (int i = 0; i < touchLocations.Length; i++)
{
diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj
index bb13d69..4ef5e9b 100644
--- a/Penguloon/Penguloon.csproj
+++ b/Penguloon/Penguloon.csproj
@@ -65,6 +65,7 @@
<Compile Include="ContentManager.cs" />
<Compile Include="ContentPathManager.cs" />
<Compile Include="Controls\Alert.cs" />
+ <Compile Include="Controls\MuteButton.cs" />
<Compile Include="Controls\ButtonUpgradeMenu.cs" />
<Compile Include="Controls\ButtonReset.cs" />
<Compile Include="Controls\Button.cs" />
diff --git a/Penguloon/Resources/Resource.Designer.cs b/Penguloon/Resources/Resource.Designer.cs
index 2858436..d3a404b 100644
--- a/Penguloon/Resources/Resource.Designer.cs
+++ b/Penguloon/Resources/Resource.Designer.cs
@@ -90,20 +90,20 @@ namespace Penguloon
// aapt resource value: 0x7f03000e
public const int IngameHealth = 2130903054;
- // aapt resource value: 0x7f03001c
- public const int IngameNo = 2130903068;
+ // aapt resource value: 0x7f03001d
+ public const int IngameNo = 2130903069;
// aapt resource value: 0x7f03000c
public const int IngameOptions = 2130903052;
- // aapt resource value: 0x7f030018
- public const int IngameOptionsContinue = 2130903064;
-
// aapt resource value: 0x7f030019
- public const int IngameOptionsQuit = 2130903065;
+ public const int IngameOptionsContinue = 2130903065;
// aapt resource value: 0x7f03001a
- public const int IngameOptionsQuitConfirmation = 2130903066;
+ public const int IngameOptionsQuit = 2130903066;
+
+ // aapt resource value: 0x7f03001b
+ public const int IngameOptionsQuitConfirmation = 2130903067;
// aapt resource value: 0x7f03000d
public const int IngameStart = 2130903053;
@@ -111,8 +111,8 @@ namespace Penguloon
// aapt resource value: 0x7f030010
public const int IngameWave = 2130903056;
- // aapt resource value: 0x7f03001b
- public const int IngameYes = 2130903067;
+ // aapt resource value: 0x7f03001c
+ public const int IngameYes = 2130903068;
// aapt resource value: 0x7f030005
public const int LevelSelectionBack = 2130903045;
@@ -129,47 +129,50 @@ namespace Penguloon
// aapt resource value: 0x7f030004
public const int MenuBtnSupport = 2130903044;
+ // aapt resource value: 0x7f030015
+ public const int ObjectCannon = 2130903061;
+
// aapt resource value: 0x7f030014
- public const int ObjectCannon = 2130903060;
+ public const int ObjectGoldPenguin = 2130903060;
- // aapt resource value: 0x7f030013
- public const int ObjectGoldPenguin = 2130903059;
+ // aapt resource value: 0x7f030016
+ public const int ObjectHospital = 2130903062;
- // aapt resource value: 0x7f030015
- public const int ObjectHospital = 2130903061;
+ // aapt resource value: 0x7f030018
+ public const int ObjectKingPenguin = 2130903064;
// aapt resource value: 0x7f030017
- public const int ObjectKingPenguin = 2130903063;
+ public const int ObjectMortar = 2130903063;
- // aapt resource value: 0x7f030016
- public const int ObjectMortar = 2130903062;
+ // aapt resource value: 0x7f030013
+ public const int ObjectPenguin = 2130903059;
- // aapt resource value: 0x7f030012
- public const int ObjectPenguin = 2130903058;
+ // aapt resource value: 0x7f030027
+ public const int StatsBestKills = 2130903079;
- // aapt resource value: 0x7f030025
- public const int StatsBestKills = 2130903077;
+ // aapt resource value: 0x7f030028
+ public const int StatsBestRound = 2130903080;
// aapt resource value: 0x7f030026
- public const int StatsBestRound = 2130903078;
-
- // aapt resource value: 0x7f030024
- public const int StatsBestStatsTitle = 2130903076;
+ public const int StatsBestStatsTitle = 2130903078;
- // aapt resource value: 0x7f03001d
- public const int StatsLevel = 2130903069;
-
- // aapt resource value: 0x7f030022
- public const int StatsTotalGames = 2130903074;
+ // aapt resource value: 0x7f030020
+ public const int StatsLevel = 2130903072;
// aapt resource value: 0x7f030021
- public const int StatsTotalKills = 2130903073;
+ public const int StatsResetConfirmation = 2130903073;
+
+ // aapt resource value: 0x7f030024
+ public const int StatsTotalGames = 2130903076;
// aapt resource value: 0x7f030023
- public const int StatsTotalMoneySpent = 2130903075;
+ public const int StatsTotalKills = 2130903075;
- // aapt resource value: 0x7f030020
- public const int StatsTotalStatsTitle = 2130903072;
+ // aapt resource value: 0x7f030025
+ public const int StatsTotalMoneySpent = 2130903077;
+
+ // aapt resource value: 0x7f030022
+ public const int StatsTotalStatsTitle = 2130903074;
// aapt resource value: 0x7f03001f
public const int SupportDonate = 2130903071;
@@ -180,6 +183,9 @@ namespace Penguloon
// aapt resource value: 0x7f030011
public const int UpgradeMenuSell = 2130903057;
+ // aapt resource value: 0x7f030012
+ public const int UpgradeMenuSellConfirmation = 2130903058;
+
static String()
{
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
diff --git a/Penguloon/Resources/Values/Strings.xml b/Penguloon/Resources/Values/Strings.xml
index a860f3f..55b842a 100644
--- a/Penguloon/Resources/Values/Strings.xml
+++ b/Penguloon/Resources/Values/Strings.xml
@@ -26,9 +26,9 @@
<string name="IngameGold">Gold</string>
<string name="IngameWave">Wave</string>
- <!-- UpgradeMen -->
+ <!-- UpgradeMenu -->
<string name="UpgradeMenuSell">Sell</string>
-
+ <string name="UpgradeMenuSellConfirmation">Are you sure you want to sell this object?</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>
@@ -45,13 +45,14 @@
<string name="IngameYes">Yes</string>
<string name="IngameNo">No</string>
- <!-- stats -->
- <string name="StatsLevel">level</string>
-
<!-- support -->
<string name="SupportRate">Rate</string>
<string name="SupportDonate">Donate</string>
+ <!-- stats -->
+ <string name="StatsLevel">level</string>
+ <string name="StatsResetConfirmation">Are you sure you want to reset your stats? This cannot be undone.</string>
+
<string name="StatsTotalStatsTitle">Career total</string>
<string name="StatsTotalKills">Kills</string>
<string name="StatsTotalGames">Games</string>
diff --git a/Penguloon/Scenes/MenuScene.cs b/Penguloon/Scenes/MenuScene.cs
index c109134..b8cbc78 100644
--- a/Penguloon/Scenes/MenuScene.cs
+++ b/Penguloon/Scenes/MenuScene.cs
@@ -26,6 +26,10 @@ namespace Penguloon.Scenes
new Vector2((StaticUIValues.ScreenViewport.X - StaticUIValues.MenuButtonSize.X) / 2, 100 + (StaticUIValues.MenuButtonSize.Y * 2) + (25 * 2)),
StaticUIValues.MenuButtonSize, Main.Resources.GetString(Resource.String.MenuBtnCredits));
+ MuteButton BtnMute = new MuteButton(this,
+ new Vector2(StaticUIValues.ScreenViewport.X - 50 - StaticUIValues.MenuButtonSize.Y, StaticUIValues.ScreenViewport.Y - 50 - StaticUIValues.MenuButtonSize.Y),
+ new Vector2(StaticUIValues.MenuButtonSize.Y, StaticUIValues.MenuButtonSize.Y));
+
//Button btnSupport = new Button(this,
// new Vector2((StaticUIValues.ScreenViewport.X - StaticUIValues.MenuButtonSize.X) / 2, 100 + (StaticUIValues.MenuButtonSize.Y * 3) + (25 * 3)),
// StaticUIValues.MenuButtonSize, Main.Resources.GetString(Resource.String.MenuBtnSupport));
@@ -38,6 +42,7 @@ namespace Penguloon.Scenes
Controls.Add(btnStart);
Controls.Add(btnStats);
Controls.Add(btnCredits);
+ Controls.Add(BtnMute);
//Controls.Add(btnSupport);
}
diff --git a/Penguloon/Scenes/StatsScene.cs b/Penguloon/Scenes/StatsScene.cs
index b6d4d3e..6ae76cd 100644
--- a/Penguloon/Scenes/StatsScene.cs
+++ b/Penguloon/Scenes/StatsScene.cs
@@ -26,7 +26,7 @@ namespace Penguloon.Scenes
ResetConfirmationBox = new MessageBox(this,
new Vector2((StaticUIValues.ScreenViewport.X / 2) - (MsgBoxSize.X / 2), (StaticUIValues.ScreenViewport.Y / 2) - (MsgBoxSize.Y / 2)),
- MsgBoxSize, Main.Resources.GetString(Resource.String.IngameOptionsQuitConfirmation));
+ MsgBoxSize, Main.Resources.GetString(Resource.String.StatsResetConfirmation));
btnBack.OnClick += BtnStart_OnClick;
resetBtn.OnClick += ResetBtn_OnClick;
diff --git a/Penguloon/SoundManager.cs b/Penguloon/SoundManager.cs
index ddc32fa..6722a4e 100644
--- a/Penguloon/SoundManager.cs
+++ b/Penguloon/SoundManager.cs
@@ -1,4 +1,5 @@
-using Microsoft.Xna.Framework.Audio;
+using System;
+using Microsoft.Xna.Framework.Audio;
namespace Penguloon
{
@@ -12,18 +13,41 @@ namespace Penguloon
public static SoundEffectInstance GameOver { get; set; }
public static SoundEffectInstance Upgrade { get; set; }
public static SoundEffectInstance Unavailable { get; set; }
+ public static SoundEffectInstance Sell { get; set; }
+
+ private static bool muted = false;
+
+ public static bool Muted
+ {
+ get { return muted; }
+ set { muted = value; if (!value) StartBaseline(); else StopBaseLine(); }
+ }
+
+ private static void StopBaseLine()
+ {
+ Baseline.Volume = 0.0f;
+ }
public static void StartBaseline()
{
- SoundEffect effect = ContentManager.GetSound("Sounds/baseline");
- Baseline = effect.CreateInstance();
+ if (Muted) return;
+
+ if (Baseline == null)
+ {
+ SoundEffect effect = ContentManager.GetSound("Sounds/baseline");
+ Baseline = effect.CreateInstance();
+ Baseline.Volume = 0.1f;
+ Baseline.IsLooped = true;
+ Baseline.Play();
+ }
+
Baseline.Volume = 0.1f;
- Baseline.IsLooped = true;
- Baseline.Play();
}
public static void PlayClickSound()
{
+ if (Muted) return;
+
if(BtnClick == null)
{
SoundEffect effect = ContentManager.GetSound("Sounds/click");
@@ -37,6 +61,8 @@ namespace Penguloon
public static void PlayClickSound2()
{
+ if (Muted) return;
+
if (BtnClick2 == null)
{
SoundEffect effect = ContentManager.GetSound("Sounds/click2");
@@ -50,6 +76,8 @@ namespace Penguloon
public static void PlayClickSound3()
{
+ if (Muted) return;
+
if (BtnClick3 == null)
{
SoundEffect effect = ContentManager.GetSound("Sounds/click3");
@@ -63,6 +91,8 @@ namespace Penguloon
public static void PlayPlaceObjectSound()
{
+ if (Muted) return;
+
if (PlaceObject == null)
{
SoundEffect effect = ContentManager.GetSound("Sounds/placeobject");
@@ -76,6 +106,8 @@ namespace Penguloon
public static void PlayGameOverSound()
{
+ if (Muted) return;
+
if (GameOver == null)
{
SoundEffect effect = ContentManager.GetSound("Sounds/gameover");
@@ -89,6 +121,8 @@ namespace Penguloon
public static void PlayUpgradeSound()
{
+ if (Muted) return;
+
if (Upgrade == null)
{
SoundEffect effect = ContentManager.GetSound("Sounds/upgrade");
@@ -102,6 +136,8 @@ namespace Penguloon
public static void PlayUnavailableSound()
{
+ if (Muted) return;
+
if (Unavailable == null)
{
SoundEffect effect = ContentManager.GetSound("Sounds/unavailable");
@@ -113,8 +149,25 @@ namespace Penguloon
Unavailable.Play();
}
+ public static void PlaySellSound()
+ {
+ if (Muted) return;
+
+ if (Sell == null)
+ {
+ SoundEffect effect = ContentManager.GetSound("Sounds/sell");
+ Sell = effect.CreateInstance();
+ Sell.Volume = 1f;
+ Sell.IsLooped = false;
+ }
+
+ Sell.Play();
+ }
+
public static void PlayBalloonPopSound()
{
+ if (Muted) return;
+
SoundEffect popEffect = ContentManager.GetSound("Sounds/pop");
popEffect.Play(0.5f, 0f, 0f);
}