summaryrefslogtreecommitdiff
path: root/Penguloon
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon')
-rw-r--r--Penguloon/Activity.cs2
-rw-r--r--Penguloon/Enums.cs3
-rw-r--r--Penguloon/Main.cs8
-rw-r--r--Penguloon/Objects/ObjectBase.cs2
-rw-r--r--Penguloon/Penguloon.csproj1
-rw-r--r--Penguloon/Resources/Resource.Designer.cs81
-rw-r--r--Penguloon/Resources/Values/Strings.xml5
-rw-r--r--Penguloon/SceneManager.cs6
-rw-r--r--Penguloon/Scenes/MenuScene.cs14
-rw-r--r--Penguloon/Scenes/SupportScene.cs78
10 files changed, 159 insertions, 41 deletions
diff --git a/Penguloon/Activity.cs b/Penguloon/Activity.cs
index d5c5562..156a1b5 100644
--- a/Penguloon/Activity.cs
+++ b/Penguloon/Activity.cs
@@ -18,7 +18,7 @@ namespace Penguloon
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
- var g = new Main(Resources, ApplicationContext);
+ var g = new Main(Resources, this);
SetContentView((View)g.Services.GetService(typeof(View)));
g.Run();
}
diff --git a/Penguloon/Enums.cs b/Penguloon/Enums.cs
index 4305744..d501087 100644
--- a/Penguloon/Enums.cs
+++ b/Penguloon/Enums.cs
@@ -22,7 +22,8 @@ namespace Penguloon
Loading,
LevelSelection,
Stats,
- Credits
+ Credits,
+ Support
}
public enum ControlState
diff --git a/Penguloon/Main.cs b/Penguloon/Main.cs
index d9d8003..703f900 100644
--- a/Penguloon/Main.cs
+++ b/Penguloon/Main.cs
@@ -38,9 +38,13 @@ namespace Penguloon
public Context Context { get; set; }
- public Main(Resources resources, Context context)
+ public Context Activity_ { get; set; }
+
+ public Main(Resources resources, Activity context)
{
- Context = context;
+ Context = context.ApplicationContext;
+ Activity_ = context;
+
Resources = resources;
Graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
diff --git a/Penguloon/Objects/ObjectBase.cs b/Penguloon/Objects/ObjectBase.cs
index 5bfdcb9..c5b17be 100644
--- a/Penguloon/Objects/ObjectBase.cs
+++ b/Penguloon/Objects/ObjectBase.cs
@@ -65,7 +65,7 @@ namespace Penguloon.Objects
// loop from back of list to front so we always focus the balloons in front
for (int i = Map.Enemies.Count - 1; i >= 0; i--)
{
- if (Contains(Map.Enemies[i].Box.Center.ToVector2()))
+ if (Map.Enemies[i] != null && Contains(Map.Enemies[i].Box.Center.ToVector2()))
{
if(ShouldRotate)
Rotation = (float)GetRotation(Map.Enemies[i].Box.Center.ToVector2());
diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj
index 3fabc72..3021ee7 100644
--- a/Penguloon/Penguloon.csproj
+++ b/Penguloon/Penguloon.csproj
@@ -106,6 +106,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SceneManager.cs" />
<Compile Include="Scenes\LevelSelectionScene.cs" />
+ <Compile Include="Scenes\SupportScene.cs" />
<Compile Include="Scenes\LoadingScene.cs" />
<Compile Include="Scenes\MenuScene.cs" />
<Compile Include="Scenes\SceneBase.cs" />
diff --git a/Penguloon/Resources/Resource.Designer.cs b/Penguloon/Resources/Resource.Designer.cs
index 0cb9ca0..fc3d585 100644
--- a/Penguloon/Resources/Resource.Designer.cs
+++ b/Penguloon/Resources/Resource.Designer.cs
@@ -66,29 +66,29 @@ namespace Penguloon
// aapt resource value: 0x7f030000
public const int ApplicationName = 2130903040;
- // aapt resource value: 0x7f03000f
- public const int IngameNo = 2130903055;
-
- // aapt resource value: 0x7f030005
- public const int IngameOptions = 2130903045;
+ // aapt resource value: 0x7f030010
+ public const int IngameNo = 2130903056;
- // aapt resource value: 0x7f03000b
- public const int IngameOptionsContinue = 2130903051;
+ // aapt resource value: 0x7f030006
+ public const int IngameOptions = 2130903046;
// aapt resource value: 0x7f03000c
- public const int IngameOptionsQuit = 2130903052;
+ public const int IngameOptionsContinue = 2130903052;
// aapt resource value: 0x7f03000d
- public const int IngameOptionsQuitConfirmation = 2130903053;
-
- // aapt resource value: 0x7f030006
- public const int IngameStart = 2130903046;
+ public const int IngameOptionsQuit = 2130903053;
// aapt resource value: 0x7f03000e
- public const int IngameYes = 2130903054;
+ public const int IngameOptionsQuitConfirmation = 2130903054;
- // aapt resource value: 0x7f030004
- public const int LevelSelectionBack = 2130903044;
+ // aapt resource value: 0x7f030007
+ public const int IngameStart = 2130903047;
+
+ // aapt resource value: 0x7f03000f
+ public const int IngameYes = 2130903055;
+
+ // aapt resource value: 0x7f030005
+ public const int LevelSelectionBack = 2130903045;
// aapt resource value: 0x7f030003
public const int MenuBtnCredits = 2130903043;
@@ -99,41 +99,50 @@ namespace Penguloon
// aapt resource value: 0x7f030002
public const int MenuBtnStats = 2130903042;
+ // aapt resource value: 0x7f030004
+ public const int MenuBtnSupport = 2130903044;
+
+ // aapt resource value: 0x7f03000a
+ public const int ObjectCannon = 2130903050;
+
// aapt resource value: 0x7f030009
- public const int ObjectCannon = 2130903049;
+ public const int ObjectGoldPenguin = 2130903049;
+
+ // aapt resource value: 0x7f03000b
+ public const int ObjectHospital = 2130903051;
// aapt resource value: 0x7f030008
- public const int ObjectGoldPenguin = 2130903048;
+ public const int ObjectPenguin = 2130903048;
- // aapt resource value: 0x7f03000a
- public const int ObjectHospital = 2130903050;
+ // aapt resource value: 0x7f030019
+ public const int StatsBestKills = 2130903065;
- // aapt resource value: 0x7f030007
- public const int ObjectPenguin = 2130903047;
+ // aapt resource value: 0x7f03001a
+ public const int StatsBestRound = 2130903066;
- // aapt resource value: 0x7f030016
- public const int StatsBestKills = 2130903062;
+ // aapt resource value: 0x7f030018
+ public const int StatsBestStatsTitle = 2130903064;
- // aapt resource value: 0x7f030017
- public const int StatsBestRound = 2130903063;
+ // aapt resource value: 0x7f030011
+ public const int StatsLevel = 2130903057;
+
+ // aapt resource value: 0x7f030016
+ public const int StatsTotalGames = 2130903062;
// aapt resource value: 0x7f030015
- public const int StatsBestStatsTitle = 2130903061;
+ public const int StatsTotalKills = 2130903061;
- // aapt resource value: 0x7f030010
- public const int StatsLevel = 2130903056;
+ // aapt resource value: 0x7f030017
+ public const int StatsTotalMoneySpent = 2130903063;
+
+ // aapt resource value: 0x7f030014
+ public const int StatsTotalStatsTitle = 2130903060;
// aapt resource value: 0x7f030013
- public const int StatsTotalGames = 2130903059;
+ public const int SupportDonate = 2130903059;
// aapt resource value: 0x7f030012
- public const int StatsTotalKills = 2130903058;
-
- // aapt resource value: 0x7f030014
- public const int StatsTotalMoneySpent = 2130903060;
-
- // aapt resource value: 0x7f030011
- public const int StatsTotalStatsTitle = 2130903057;
+ public const int SupportRate = 2130903058;
static String()
{
diff --git a/Penguloon/Resources/Values/Strings.xml b/Penguloon/Resources/Values/Strings.xml
index 4ceed7b..b62b209 100644
--- a/Penguloon/Resources/Values/Strings.xml
+++ b/Penguloon/Resources/Values/Strings.xml
@@ -6,6 +6,7 @@
<string name="MenuBtnPlay">Play</string>
<string name="MenuBtnStats">Stats</string>
<string name="MenuBtnCredits">Credits</string>
+ <string name="MenuBtnSupport">Support</string>
<!-- level selection -->
<string name="LevelSelectionBack">Back</string>
@@ -30,6 +31,10 @@
<!-- stats -->
<string name="StatsLevel">level</string>
+
+ <!-- support -->
+ <string name="SupportRate">Rate</string>
+ <string name="SupportDonate">Donate</string>
<string name="StatsTotalStatsTitle">Career total</string>
<string name="StatsTotalKills">Kills</string>
diff --git a/Penguloon/SceneManager.cs b/Penguloon/SceneManager.cs
index 8ce887e..3aaea41 100644
--- a/Penguloon/SceneManager.cs
+++ b/Penguloon/SceneManager.cs
@@ -20,6 +20,8 @@ namespace Penguloon
public static SceneBase CreditsScene { get; set; }
+ public static SceneBase SupportScene { get; set; }
+
/// <summary>
/// Initialize scene manager.
/// </summary>
@@ -48,6 +50,8 @@ namespace Penguloon
StatsScene.Draw(deltaTime); break;
case SelectedScene.Credits:
CreditsScene.Draw(deltaTime); break;
+ case SelectedScene.Support:
+ SupportScene.Draw(deltaTime); break;
default:
return;
@@ -77,6 +81,8 @@ namespace Penguloon
StatsScene.Update(deltaTime, touchLocations); break;
case SelectedScene.Credits:
CreditsScene.Update(deltaTime, touchLocations); break;
+ case SelectedScene.Support:
+ SupportScene.Update(deltaTime, touchLocations); break;
default:
return;
diff --git a/Penguloon/Scenes/MenuScene.cs b/Penguloon/Scenes/MenuScene.cs
index cab9f8c..e0b1709 100644
--- a/Penguloon/Scenes/MenuScene.cs
+++ b/Penguloon/Scenes/MenuScene.cs
@@ -26,13 +26,27 @@ 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));
+ 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));
+
btnStart.OnClick += BtnStart_OnClick;
btnStats.OnClick += BtnStats_OnClick;
btnCredits.OnClick += BtnCredits_OnClick;
+ btnSupport.OnClick += BtnSupport_OnClick;
Controls.Add(btnStart);
Controls.Add(btnStats);
Controls.Add(btnCredits);
+ Controls.Add(btnSupport);
+ }
+
+ private void BtnSupport_OnClick(object sender, ClickArgs e)
+ {
+ if (SceneManager.SupportScene == null)
+ SceneManager.SupportScene = new SupportScene(Main);
+
+ SceneManager.SelectedScene = SelectedScene.Support;
}
private void BtnCredits_OnClick(object sender, ClickArgs e)
diff --git a/Penguloon/Scenes/SupportScene.cs b/Penguloon/Scenes/SupportScene.cs
new file mode 100644
index 0000000..71367ca
--- /dev/null
+++ b/Penguloon/Scenes/SupportScene.cs
@@ -0,0 +1,78 @@
+using Android.Content;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Audio;
+using Microsoft.Xna.Framework.Input.Touch;
+using Penguloon.Controls;
+using Penguloon.Scenes;
+using System;
+using System.Collections.Generic;
+
+namespace Penguloon.Scenes
+{
+ public class SupportScene : SceneBase
+ {
+ public SupportScene(Main main) : base(main)
+ {
+
+ }
+
+ public override void CreateControls()
+ {
+ Button btnBack = new Button(this,
+ new Vector2(50, 50),
+ StaticUIValues.MenuButtonSize, Main.Resources.GetString(Resource.String.LevelSelectionBack));
+
+ Button btnRate = new Button(this,
+ new Vector2(50, 50 + (25 * 1) + (StaticUIValues.MenuButtonSize.Y * 1)),
+ StaticUIValues.MenuButtonSize, Main.Resources.GetString(Resource.String.SupportRate));
+
+ Button btnDonate = new Button(this,
+ new Vector2(50, 50 + (25 * 2) + (StaticUIValues.MenuButtonSize.Y * 2)),
+ StaticUIValues.MenuButtonSize, Main.Resources.GetString(Resource.String.SupportDonate));
+
+ btnBack.OnClick += BtnBack_OnClick;
+ btnRate.OnClick += BtnRate_OnClick;
+
+ Controls.Add(btnBack);
+ Controls.Add(btnRate);
+ Controls.Add(btnDonate);
+ }
+
+ private void BtnRate_OnClick(object sender, ClickArgs e)
+ {
+ try
+ {
+ Intent rateIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("market://details?id=" + Main.Context.PackageName));
+
+ Main.Activity_.StartActivity(rateIntent);
+ }
+ catch (ActivityNotFoundException ex)
+ {
+ Intent rateIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("https://play.google.com/store/apps/details?id=" + Main.Context.PackageName));
+ Main.Activity_.StartActivity(rateIntent);
+ }
+ }
+
+ private void BtnBack_OnClick(object sender, ClickArgs e)
+ {
+ SceneManager.SelectedScene = SelectedScene.Menu;
+ }
+
+ public override void Draw(float deltaTime)
+ {
+ // background
+ Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/background"),
+ destinationRectangle: new Rectangle(0, 0, (int)StaticUIValues.ScreenViewport.X, (int)StaticUIValues.ScreenViewport.Y));
+
+ DrawSnowflakes();
+
+ base.Draw(deltaTime);
+ }
+
+
+ public override void Update(float deltaTime, TouchLocation[] touchLocations)
+ {
+ base.Update(deltaTime, touchLocations);
+ }
+ }
+} \ No newline at end of file