summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2018-01-26 14:22:18 +0100
committeraldrikboy <aldrikboy@gmail.com>2018-01-26 14:22:18 +0100
commitfae272bc77b1c523a8af7a52bb220b684a2a6c1b (patch)
tree3b99c6740f4100f704c82042808731f1ff826b24
parent60f1bddda04ec5fa22778abf176171a547dde949 (diff)
map packHEADmaster
-rw-r--r--Penguloon/BillingManager.cs94
-rw-r--r--Penguloon/Content/Content.mgcb12
-rw-r--r--Penguloon/Content/UI/star.pngbin0 -> 3939 bytes
-rw-r--r--Penguloon/ContentManager.cs15
-rw-r--r--Penguloon/ContentPathManager.cs1
-rw-r--r--Penguloon/Controls/LevelSelector.cs80
-rw-r--r--Penguloon/Enums.cs3
-rw-r--r--Penguloon/Levels/SandLevel2.cs2
-rw-r--r--Penguloon/Levels/SandLevel3.cs2
-rw-r--r--Penguloon/Levels/SpaceLevel1.cs2
-rw-r--r--Penguloon/Levels/SpaceLevel2.cs2
-rw-r--r--Penguloon/MainApplication.cs39
-rw-r--r--Penguloon/Penguloon.csproj16
-rw-r--r--Penguloon/Properties/AndroidManifest.xml2
-rw-r--r--Penguloon/Resources/Resource.Designer.cs141
-rw-r--r--Penguloon/Resources/Values/Strings.xml1
-rw-r--r--Penguloon/SceneManager.cs6
-rw-r--r--Penguloon/Scenes/MenuScene.cs17
-rw-r--r--Penguloon/Scenes/ShopScene.cs86
-rw-r--r--Penguloon/packages.config2
20 files changed, 432 insertions, 91 deletions
diff --git a/Penguloon/BillingManager.cs b/Penguloon/BillingManager.cs
new file mode 100644
index 0000000..2611414
--- /dev/null
+++ b/Penguloon/BillingManager.cs
@@ -0,0 +1,94 @@
+using Plugin.InAppBilling;
+using Plugin.InAppBilling.Abstractions;
+using System;
+using Penguloon.Controls;
+
+namespace Penguloon.Scenes
+{
+ public static class BillingManager
+ {
+ public static bool MapPackPurchased { get; set; } = false;
+
+ public static async System.Threading.Tasks.Task PurchaseMapPackAsync(SceneBase sceneBase)
+ {
+ try
+ {
+ var productId = "map_pack";
+
+ //CrossInAppBilling.Current.InTestingMode = true;
+
+
+ var connected = await CrossInAppBilling.Current.ConnectAsync();
+
+ if (!connected)
+ {
+ Alert.Show("Not connected", 3000, sceneBase);
+ return;
+ }
+
+ //try to purchase item
+ var purchase = await CrossInAppBilling.Current.PurchaseAsync(productId, ItemType.InAppPurchase, "apppayload");
+ if (purchase == null)
+ {
+ Alert.Show("Purchase failed", 3000, sceneBase);
+ }
+ else
+ {
+ Alert.Show("Maps unlocked", 4000, sceneBase);
+ //Purchased, save this information
+ var id = purchase.Id;
+ var token = purchase.PurchaseToken;
+ var state = purchase.State;
+
+ MapPackPurchased = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ //Something bad has occurred, alert user
+ Alert.Show("An error occured", 3000, sceneBase);
+ }
+
+ //Disconnect, it is okay if we never connected
+ await CrossInAppBilling.Current.DisconnectAsync();
+ }
+
+ public static async System.Threading.Tasks.Task CheckPurchasesAsync()
+ {
+ try
+ {
+ var connected = await CrossInAppBilling.Current.ConnectAsync();
+
+ if (!connected)
+ {
+ return;
+ }
+
+ //try to purchase item
+ var purchase = await CrossInAppBilling.Current.GetPurchasesAsync(ItemType.InAppPurchase);
+ if (purchase == null)
+ {
+ return;
+ }
+ else
+ {
+ foreach(InAppBillingPurchase item in purchase)
+ {
+ if (item.ProductId == "map_pack")
+ MapPackPurchased = true;
+
+ //if (item.ProductId == "android.test.purchased")
+ // MapPackPurchased = true;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ //Something bad has occurred
+ }
+
+ //Disconnect, it is okay if we never connected
+ await CrossInAppBilling.Current.DisconnectAsync();
+ }
+ }
+} \ No newline at end of file
diff --git a/Penguloon/Content/Content.mgcb b/Penguloon/Content/Content.mgcb
index 09b34a0..6b02fb4 100644
--- a/Penguloon/Content/Content.mgcb
+++ b/Penguloon/Content/Content.mgcb
@@ -1171,3 +1171,15 @@
/processorParam:TextureFormat=Color
/build:SplashArt/7.png
+#begin UI/star.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/star.png
+
diff --git a/Penguloon/Content/UI/star.png b/Penguloon/Content/UI/star.png
new file mode 100644
index 0000000..5e687f8
--- /dev/null
+++ b/Penguloon/Content/UI/star.png
Binary files differ
diff --git a/Penguloon/ContentManager.cs b/Penguloon/ContentManager.cs
index 50b3566..e4a2b61 100644
--- a/Penguloon/ContentManager.cs
+++ b/Penguloon/ContentManager.cs
@@ -2,6 +2,8 @@
using Microsoft.Xna.Framework.Graphics;
using System.Threading;
using Microsoft.Xna.Framework.Audio;
+using System;
+using Penguloon.Scenes;
namespace Penguloon
{
@@ -21,7 +23,7 @@ namespace Penguloon
{
//AdManager.Load(main);
- new Thread(() =>
+ new Thread(async () =>
{
Thread.CurrentThread.IsBackground = true;
@@ -29,9 +31,18 @@ namespace Penguloon
LoadContent_(main);
+ await LoadPlaystorePurchasesAsync();
+
+ DoneLoading = true;
+
}).Start();
}
+ private static async System.Threading.Tasks.Task LoadPlaystorePurchasesAsync()
+ {
+ await BillingManager.CheckPurchasesAsync();
+ }
+
private static void LoadContent_(Main main)
{
float totalItemsToLoad = ContentPathManager.TexturePaths.Count + ContentPathManager.FontPaths.Count + ContentPathManager.SoundPaths.Count;
@@ -63,8 +74,6 @@ namespace Penguloon
LoadPercentage = (int)((itemsLoaded / totalItemsToLoad) * 100);
LoadPercentageF = (itemsLoaded / totalItemsToLoad);
}
-
- DoneLoading = true;
}
private static void PreLoadContent(Main main)
diff --git a/Penguloon/ContentPathManager.cs b/Penguloon/ContentPathManager.cs
index 915b93e..eaa0f64 100644
--- a/Penguloon/ContentPathManager.cs
+++ b/Penguloon/ContentPathManager.cs
@@ -86,6 +86,7 @@ namespace Penguloon
"UI/heart",
"UI/explosion",
"UI/radar",
+ "UI/star",
"SplashArt/locked",
"SplashArt/1",
diff --git a/Penguloon/Controls/LevelSelector.cs b/Penguloon/Controls/LevelSelector.cs
index 885d6c1..6322b79 100644
--- a/Penguloon/Controls/LevelSelector.cs
+++ b/Penguloon/Controls/LevelSelector.cs
@@ -60,6 +60,8 @@ namespace Penguloon.Controls
if (Panel2.Intersects(fingerRec) && Levels[selectedMap].MinimumLevel <= UserdataManager.Level)
{
+ if (Levels[selectedMap].MinimumLevel == 0 && !BillingManager.MapPackPurchased) return;
+
SoundManager.PlayClickSound();
SceneManager.GameScene = new GameScene(ParentScene.Main, Levels[selectedMap]);
SceneManager.SelectedScene = SelectedScene.Ingame;
@@ -107,11 +109,15 @@ namespace Penguloon.Controls
Levels.Add(new IceLevel3());
Levels.Add(new SandLevel1());
- Levels.Add(new SandLevel2());
- Levels.Add(new SandLevel3());
- Levels.Add(new SpaceLevel1());
- Levels.Add(new SpaceLevel2());
+ //if (BillingManager.MapPackPurchased)
+ {
+ Levels.Add(new SandLevel2());
+ Levels.Add(new SandLevel3());
+
+ Levels.Add(new SpaceLevel1());
+ Levels.Add(new SpaceLevel2());
+ }
}
public override void Draw(float deltaTime)
@@ -139,6 +145,18 @@ namespace Penguloon.Controls
//DrawLevel(new Vector2(Panel0.X + 25, Panel0.Y + Panel0.Height - 20), Levels[selectedMap - 2].MinimumLevel);
}
+ else if (Levels[selectedMap - 2].MinimumLevel == 0)
+ {
+ if (!BillingManager.MapPackPurchased)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel0);
+ }
+
+ // draw star here
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/star"),
+ destinationRectangle: new Rectangle(Panel0.X + 25, Panel0.Y + 25, 100, 100));
+ }
}
if (selectedMap - 1 >= 0)
@@ -154,6 +172,19 @@ namespace Penguloon.Controls
ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
destinationRectangle: new Rectangle(Panel1.X + 25, Panel1.Y + 25, 100, 100));
}
+ else if (Levels[selectedMap - 1].MinimumLevel == 0)
+ {
+ if (!BillingManager.MapPackPurchased)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel1);
+ }
+
+ // draw star here
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/star"),
+ destinationRectangle: new Rectangle(Panel1.X + 25, Panel1.Y + 25, 100, 100));
+ }
+
DrawLevel(new Vector2(Panel1.X + 25, Panel1.Y + Panel1.Height - 10), Levels[selectedMap - 1].MinimumLevel);
}
@@ -170,6 +201,19 @@ namespace Penguloon.Controls
ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
destinationRectangle: new Rectangle(Panel4.X + 25, Panel4.Y + 25, 100, 100));
}
+ else if (Levels[selectedMap + 2].MinimumLevel == 0)
+ {
+ if (!BillingManager.MapPackPurchased)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel4);
+ }
+
+ // draw star here
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/star"),
+ destinationRectangle: new Rectangle(Panel4.X + 25, Panel4.Y + 25, 100, 100));
+ }
+
DrawLevel(new Vector2(Panel4.X + 25, Panel4.Y + Panel4.Height - 10), Levels[selectedMap + 2].MinimumLevel);
}
@@ -186,6 +230,19 @@ namespace Penguloon.Controls
ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
destinationRectangle: new Rectangle(Panel3.X + 25, Panel3.Y + 25, 100, 100));
}
+ else if (Levels[selectedMap + 1].MinimumLevel == 0)
+ {
+ if (!BillingManager.MapPackPurchased)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel3);
+ }
+
+ // draw star here
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/star"),
+ destinationRectangle: new Rectangle(Panel3.X + 25, Panel3.Y + 25, 100, 100));
+ }
+
DrawLevel(new Vector2(Panel3.X + 25, Panel3.Y + Panel3.Height - 10), Levels[selectedMap + 1].MinimumLevel);
}
@@ -197,15 +254,30 @@ namespace Penguloon.Controls
ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
destinationRectangle: Panel2);
+
ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/lock"),
destinationRectangle: new Rectangle(Panel2.X + 25, Panel2.Y + 25, 100, 100));
}
+ else if (Levels[selectedMap].MinimumLevel == 0)
+ {
+ if (!BillingManager.MapPackPurchased)
+ {
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("SplashArt/locked"),
+ destinationRectangle: Panel2);
+ }
+
+ // draw star here
+ ParentScene.Main.SpriteBatch.Draw(ContentManager.GetTexture("UI/star"),
+ destinationRectangle: new Rectangle(Panel2.X + 25, Panel2.Y + 25, 100, 100));
+ }
DrawLevel(new Vector2(Panel2.X + 25, Panel2.Y + Panel2.Height - 10), Levels[selectedMap].MinimumLevel);
}
private void DrawLevel(Vector2 position, int minLevel)
{
+ if (minLevel == 0) return;
+
ParentScene.DrawText(ContentManager.GetFont(StaticUIValues.StatsFont),
minLevel.ToString(),
new Vector2((int)position.X + ContentManager.GetFont(StaticUIValues.StatsFont).MeasureString(ParentScene.Main.Resources.GetString(Resource.String.StatsLevel) + " ").X, position.Y),
diff --git a/Penguloon/Enums.cs b/Penguloon/Enums.cs
index 0b800a6..5499bf5 100644
--- a/Penguloon/Enums.cs
+++ b/Penguloon/Enums.cs
@@ -23,7 +23,8 @@ namespace Penguloon
LevelSelection,
Stats,
Credits,
- Support
+ Support,
+ Shop
}
public enum ControlState
diff --git a/Penguloon/Levels/SandLevel2.cs b/Penguloon/Levels/SandLevel2.cs
index 006737a..89c437e 100644
--- a/Penguloon/Levels/SandLevel2.cs
+++ b/Penguloon/Levels/SandLevel2.cs
@@ -14,7 +14,7 @@ namespace Penguloon.Levels
this.Money = 350;
this.Health = 200;
this.ID = 5;
- this.MinimumLevel = 20;
+ this.MinimumLevel = 0;
LevelType = LevelType.Sand;
}
diff --git a/Penguloon/Levels/SandLevel3.cs b/Penguloon/Levels/SandLevel3.cs
index a158544..057167f 100644
--- a/Penguloon/Levels/SandLevel3.cs
+++ b/Penguloon/Levels/SandLevel3.cs
@@ -14,7 +14,7 @@ namespace Penguloon.Levels
this.Money = 350;
this.Health = 200;
this.ID = 6;
- this.MinimumLevel = 25;
+ this.MinimumLevel = 0;
LevelType = LevelType.Sand;
}
diff --git a/Penguloon/Levels/SpaceLevel1.cs b/Penguloon/Levels/SpaceLevel1.cs
index b07ad66..979873f 100644
--- a/Penguloon/Levels/SpaceLevel1.cs
+++ b/Penguloon/Levels/SpaceLevel1.cs
@@ -14,7 +14,7 @@ namespace Penguloon.Levels
this.Money = 350;
this.Health = 200;
this.ID = 7;
- this.MinimumLevel = 30;
+ this.MinimumLevel = 0;
LevelType = LevelType.Space;
}
diff --git a/Penguloon/Levels/SpaceLevel2.cs b/Penguloon/Levels/SpaceLevel2.cs
index 6de68ba..e31c63f 100644
--- a/Penguloon/Levels/SpaceLevel2.cs
+++ b/Penguloon/Levels/SpaceLevel2.cs
@@ -14,7 +14,7 @@ namespace Penguloon.Levels
this.Money = 350;
this.Health = 200;
this.ID = 8;
- this.MinimumLevel = 35;
+ this.MinimumLevel = 0;
LevelType = LevelType.Space;
}
diff --git a/Penguloon/MainApplication.cs b/Penguloon/MainApplication.cs
index 767d6f3..7737a1c 100644
--- a/Penguloon/MainApplication.cs
+++ b/Penguloon/MainApplication.cs
@@ -36,10 +36,12 @@ namespace Penguloon
public void OnActivityDestroyed(Activity activity)
{
+ CrossCurrentActivity.Current.Activity = activity;
}
public void OnActivityPaused(Activity activity)
{
+ CrossCurrentActivity.Current.Activity = activity;
}
public void OnActivityResumed(Activity activity)
@@ -49,6 +51,7 @@ namespace Penguloon
public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
{
+ CrossCurrentActivity.Current.Activity = activity;
}
public void OnActivityStarted(Activity activity)
@@ -58,6 +61,42 @@ namespace Penguloon
public void OnActivityStopped(Activity activity)
{
+ CrossCurrentActivity.Current.Activity = activity;
+ }
+
+ public void OnActivityCreated(Android.App.Activity activity, Bundle savedInstanceState)
+ {
+ CrossCurrentActivity.Current.Activity = activity;
+ }
+
+ public void OnActivityDestroyed(Android.App.Activity activity)
+ {
+ CrossCurrentActivity.Current.Activity = activity;
+ }
+
+ public void OnActivityPaused(Android.App.Activity activity)
+ {
+ CrossCurrentActivity.Current.Activity = activity;
+ }
+
+ public void OnActivityResumed(Android.App.Activity activity)
+ {
+ CrossCurrentActivity.Current.Activity = activity;
+ }
+
+ public void OnActivitySaveInstanceState(Android.App.Activity activity, Bundle outState)
+ {
+ CrossCurrentActivity.Current.Activity = activity;
+ }
+
+ public void OnActivityStarted(Android.App.Activity activity)
+ {
+ CrossCurrentActivity.Current.Activity = activity;
+ }
+
+ public void OnActivityStopped(Android.App.Activity activity)
+ {
+ CrossCurrentActivity.Current.Activity = activity;
}
}
} \ No newline at end of file
diff --git a/Penguloon/Penguloon.csproj b/Penguloon/Penguloon.csproj
index 837942b..3602286 100644
--- a/Penguloon/Penguloon.csproj
+++ b/Penguloon/Penguloon.csproj
@@ -19,7 +19,7 @@
<AndroidSupportedAbis>armeabi-v7a%3bx86</AndroidSupportedAbis>
<AndroidStoreUncompressedFileExtensions>.m4a</AndroidStoreUncompressedFileExtensions>
<MandroidI18n />
- <TargetFrameworkVersion>v4.4</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
<MonoGamePlatform>Android</MonoGamePlatform>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
@@ -65,14 +65,14 @@
<Reference Include="Plugin.CurrentActivity, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Plugin.CurrentActivity.1.0.1\lib\MonoAndroid10\Plugin.CurrentActivity.dll</HintPath>
</Reference>
- <Reference Include="Plugin.InAppBilling, Version=1.2.4.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Plugin.InAppBilling.1.2.4\lib\MonoAndroid10\Plugin.InAppBilling.dll</HintPath>
+ <Reference Include="Plugin.InAppBilling, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\Plugin.InAppBilling.1.2.1\lib\MonoAndroid10\Plugin.InAppBilling.dll</HintPath>
</Reference>
- <Reference Include="Plugin.InAppBilling.Abstractions, Version=1.2.4.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Plugin.InAppBilling.1.2.4\lib\MonoAndroid10\Plugin.InAppBilling.Abstractions.dll</HintPath>
+ <Reference Include="Plugin.InAppBilling.Abstractions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\Plugin.InAppBilling.1.2.1\lib\MonoAndroid10\Plugin.InAppBilling.Abstractions.dll</HintPath>
</Reference>
- <Reference Include="Plugin.InAppBilling.VendingLibrary, Version=1.2.4.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\Plugin.InAppBilling.1.2.4\lib\MonoAndroid10\Plugin.InAppBilling.VendingLibrary.dll</HintPath>
+ <Reference Include="Plugin.InAppBilling.VendingLibrary, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\Plugin.InAppBilling.1.2.1\lib\MonoAndroid10\Plugin.InAppBilling.VendingLibrary.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -141,6 +141,7 @@
<Compile Include="Projectiles\CannonballProjectile.cs" />
<Compile Include="Projectiles\ProjectileBase.cs" />
<Compile Include="Projectiles\SnowballProjectile.cs" />
+ <Compile Include="BillingManager.cs" />
<Compile Include="Scenes\CreditsScene.cs" />
<Compile Include="Scenes\GameScene.cs" />
<Compile Include="Controls\LevelSelector.cs" />
@@ -153,6 +154,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SceneManager.cs" />
<Compile Include="Scenes\LevelSelectionScene.cs" />
+ <Compile Include="Scenes\ShopScene.cs" />
<Compile Include="Scenes\SupportScene.cs" />
<Compile Include="Scenes\LoadingScene.cs" />
<Compile Include="Scenes\MenuScene.cs" />
diff --git a/Penguloon/Properties/AndroidManifest.xml b/Penguloon/Properties/AndroidManifest.xml
index 04d8e47..b4785aa 100644
--- a/Penguloon/Properties/AndroidManifest.xml
+++ b/Penguloon/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.release.penguloon" android:versionCode="9" android:versionName="1.4.1" android:installLocation="preferExternal">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.release.penguloon" android:versionCode="10" android:versionName="1.5" android:installLocation="preferExternal">
<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/Penguloon/Resources/Resource.Designer.cs b/Penguloon/Resources/Resource.Designer.cs
index fd8c221..adb5fa1 100644
--- a/Penguloon/Resources/Resource.Designer.cs
+++ b/Penguloon/Resources/Resource.Designer.cs
@@ -1531,59 +1531,59 @@ namespace Penguloon
// aapt resource value: 0x7f05002d
public const int ApplicationName = 2131034157;
- // aapt resource value: 0x7f050033
- public const int EndScreenExit = 2131034163;
-
// aapt resource value: 0x7f050034
- public const int EndScreenGameOver = 2131034164;
+ public const int EndScreenExit = 2131034164;
// aapt resource value: 0x7f050035
- public const int EndScreenKills = 2131034165;
+ public const int EndScreenGameOver = 2131034165;
- // aapt resource value: 0x7f050037
- public const int EndScreenPR = 2131034167;
+ // aapt resource value: 0x7f050036
+ public const int EndScreenKills = 2131034166;
// aapt resource value: 0x7f050038
- public const int EndScreenRestart = 2131034168;
+ public const int EndScreenPR = 2131034168;
- // aapt resource value: 0x7f050036
- public const int EndScreenWave = 2131034166;
+ // aapt resource value: 0x7f050039
+ public const int EndScreenRestart = 2131034169;
- // aapt resource value: 0x7f05003c
- public const int IngameGold = 2131034172;
+ // aapt resource value: 0x7f050037
+ public const int EndScreenWave = 2131034167;
- // aapt resource value: 0x7f05003b
- public const int IngameHealth = 2131034171;
+ // aapt resource value: 0x7f05003d
+ public const int IngameGold = 2131034173;
- // aapt resource value: 0x7f05004b
- public const int IngameNo = 2131034187;
+ // aapt resource value: 0x7f05003c
+ public const int IngameHealth = 2131034172;
- // aapt resource value: 0x7f050039
- public const int IngameOptions = 2131034169;
+ // aapt resource value: 0x7f05004c
+ public const int IngameNo = 2131034188;
- // aapt resource value: 0x7f050048
- public const int IngameOptionsAutoStart = 2131034184;
+ // aapt resource value: 0x7f05003a
+ public const int IngameOptions = 2131034170;
- // aapt resource value: 0x7f050046
- public const int IngameOptionsContinue = 2131034182;
+ // aapt resource value: 0x7f050049
+ public const int IngameOptionsAutoStart = 2131034185;
// aapt resource value: 0x7f050047
- public const int IngameOptionsQuit = 2131034183;
+ public const int IngameOptionsContinue = 2131034183;
- // aapt resource value: 0x7f050049
- public const int IngameOptionsQuitConfirmation = 2131034185;
+ // aapt resource value: 0x7f050048
+ public const int IngameOptionsQuit = 2131034184;
- // aapt resource value: 0x7f05003a
- public const int IngameStart = 2131034170;
+ // aapt resource value: 0x7f05004a
+ public const int IngameOptionsQuitConfirmation = 2131034186;
- // aapt resource value: 0x7f05003d
- public const int IngameWave = 2131034173;
+ // aapt resource value: 0x7f05003b
+ public const int IngameStart = 2131034171;
- // aapt resource value: 0x7f05004a
- public const int IngameYes = 2131034186;
+ // aapt resource value: 0x7f05003e
+ public const int IngameWave = 2131034174;
- // aapt resource value: 0x7f050032
- public const int LevelSelectionBack = 2131034162;
+ // aapt resource value: 0x7f05004b
+ public const int IngameYes = 2131034187;
+
+ // aapt resource value: 0x7f050033
+ public const int LevelSelectionBack = 2131034163;
// aapt resource value: 0x7f050030
public const int MenuBtnCredits = 2131034160;
@@ -1591,68 +1591,71 @@ namespace Penguloon
// aapt resource value: 0x7f05002e
public const int MenuBtnPlay = 2131034158;
+ // aapt resource value: 0x7f050032
+ public const int MenuBtnShop = 2131034162;
+
// aapt resource value: 0x7f05002f
public const int MenuBtnStats = 2131034159;
// aapt resource value: 0x7f050031
public const int MenuBtnSupport = 2131034161;
- // aapt resource value: 0x7f050042
- public const int ObjectCannon = 2131034178;
-
- // aapt resource value: 0x7f050041
- public const int ObjectGoldPenguin = 2131034177;
-
// aapt resource value: 0x7f050043
- public const int ObjectHospital = 2131034179;
+ public const int ObjectCannon = 2131034179;
- // aapt resource value: 0x7f050045
- public const int ObjectKingPenguin = 2131034181;
+ // aapt resource value: 0x7f050042
+ public const int ObjectGoldPenguin = 2131034178;
// aapt resource value: 0x7f050044
- public const int ObjectMortar = 2131034180;
+ public const int ObjectHospital = 2131034180;
- // aapt resource value: 0x7f050040
- public const int ObjectPenguin = 2131034176;
+ // aapt resource value: 0x7f050046
+ public const int ObjectKingPenguin = 2131034182;
- // aapt resource value: 0x7f050055
- public const int StatsBestKills = 2131034197;
+ // aapt resource value: 0x7f050045
+ public const int ObjectMortar = 2131034181;
+
+ // aapt resource value: 0x7f050041
+ public const int ObjectPenguin = 2131034177;
// aapt resource value: 0x7f050056
- public const int StatsBestRound = 2131034198;
+ public const int StatsBestKills = 2131034198;
- // aapt resource value: 0x7f050054
- public const int StatsBestStatsTitle = 2131034196;
+ // aapt resource value: 0x7f050057
+ public const int StatsBestRound = 2131034199;
- // aapt resource value: 0x7f05004e
- public const int StatsLevel = 2131034190;
+ // aapt resource value: 0x7f050055
+ public const int StatsBestStatsTitle = 2131034197;
// aapt resource value: 0x7f05004f
- public const int StatsResetConfirmation = 2131034191;
+ public const int StatsLevel = 2131034191;
- // aapt resource value: 0x7f050052
- public const int StatsTotalGames = 2131034194;
-
- // aapt resource value: 0x7f050051
- public const int StatsTotalKills = 2131034193;
+ // aapt resource value: 0x7f050050
+ public const int StatsResetConfirmation = 2131034192;
// aapt resource value: 0x7f050053
- public const int StatsTotalMoneySpent = 2131034195;
+ public const int StatsTotalGames = 2131034195;
- // aapt resource value: 0x7f050050
- public const int StatsTotalStatsTitle = 2131034192;
+ // aapt resource value: 0x7f050052
+ public const int StatsTotalKills = 2131034194;
- // aapt resource value: 0x7f05004d
- public const int SupportDonate = 2131034189;
+ // aapt resource value: 0x7f050054
+ public const int StatsTotalMoneySpent = 2131034196;
- // aapt resource value: 0x7f05004c
- public const int SupportRate = 2131034188;
+ // aapt resource value: 0x7f050051
+ public const int StatsTotalStatsTitle = 2131034193;
- // aapt resource value: 0x7f05003e
- public const int UpgradeMenuSell = 2131034174;
+ // aapt resource value: 0x7f05004e
+ public const int SupportDonate = 2131034190;
+
+ // aapt resource value: 0x7f05004d
+ public const int SupportRate = 2131034189;
// aapt resource value: 0x7f05003f
- public const int UpgradeMenuSellConfirmation = 2131034175;
+ public const int UpgradeMenuSell = 2131034175;
+
+ // aapt resource value: 0x7f050040
+ public const int UpgradeMenuSellConfirmation = 2131034176;
// aapt resource value: 0x7f050007
public const int abc_action_bar_home_description = 2131034119;
@@ -2626,7 +2629,7 @@ namespace Penguloon
16843055,
16843056,
16843057,
- 16843829};
+ 18219096};
// aapt resource value: 4
public const int MenuView_android_headerBackground = 4;
diff --git a/Penguloon/Resources/Values/Strings.xml b/Penguloon/Resources/Values/Strings.xml
index 311e278..69a075e 100644
--- a/Penguloon/Resources/Values/Strings.xml
+++ b/Penguloon/Resources/Values/Strings.xml
@@ -7,6 +7,7 @@
<string name="MenuBtnStats">Stats</string>
<string name="MenuBtnCredits">Credits</string>
<string name="MenuBtnSupport">Support</string>
+ <string name="MenuBtnShop">Shop</string>
<!-- level selection -->
<string name="LevelSelectionBack">Back</string>
diff --git a/Penguloon/SceneManager.cs b/Penguloon/SceneManager.cs
index 3aaea41..15fd93d 100644
--- a/Penguloon/SceneManager.cs
+++ b/Penguloon/SceneManager.cs
@@ -22,6 +22,8 @@ namespace Penguloon
public static SceneBase SupportScene { get; set; }
+ public static SceneBase ShopScene { get; set; }
+
/// <summary>
/// Initialize scene manager.
/// </summary>
@@ -52,6 +54,8 @@ namespace Penguloon
CreditsScene.Draw(deltaTime); break;
case SelectedScene.Support:
SupportScene.Draw(deltaTime); break;
+ case SelectedScene.Shop:
+ ShopScene.Draw(deltaTime); break;
default:
return;
@@ -83,6 +87,8 @@ namespace Penguloon
CreditsScene.Update(deltaTime, touchLocations); break;
case SelectedScene.Support:
SupportScene.Update(deltaTime, touchLocations); break;
+ case SelectedScene.Shop:
+ ShopScene.Update(deltaTime, touchLocations); break;
default:
return;
diff --git a/Penguloon/Scenes/MenuScene.cs b/Penguloon/Scenes/MenuScene.cs
index 986657b..2923e64 100644
--- a/Penguloon/Scenes/MenuScene.cs
+++ b/Penguloon/Scenes/MenuScene.cs
@@ -33,6 +33,11 @@ namespace Penguloon.Scenes
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 btnShop = 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.MenuBtnShop));
+
+
//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));
@@ -40,15 +45,25 @@ namespace Penguloon.Scenes
btnStart.OnClick += BtnStart_OnClick;
btnStats.OnClick += BtnStats_OnClick;
btnCredits.OnClick += BtnCredits_OnClick;
+ btnShop.OnClick += BtnShop_OnClick; ;
//btnSupport.OnClick += BtnSupport_OnClick;
Controls.Add(btnStart);
Controls.Add(btnStats);
Controls.Add(btnCredits);
Controls.Add(BtnMute);
+ Controls.Add(btnShop);
//Controls.Add(btnSupport);
-
+
+ }
+
+ private void BtnShop_OnClick(object sender, ClickArgs e)
+ {
+ if (SceneManager.ShopScene == null)
+ SceneManager.ShopScene = new ShopScene(Main);
+
+ SceneManager.SelectedScene = SelectedScene.Shop;
}
private void BtnSupport_OnClick(object sender, ClickArgs e)
diff --git a/Penguloon/Scenes/ShopScene.cs b/Penguloon/Scenes/ShopScene.cs
new file mode 100644
index 0000000..ad272d7
--- /dev/null
+++ b/Penguloon/Scenes/ShopScene.cs
@@ -0,0 +1,86 @@
+using Android.Content;
+using Android.Views;
+using Android.Views.InputMethods;
+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 ShopScene : SceneBase
+ {
+ public ShopScene(Main main) : base(main)
+ {
+
+ }
+
+ public override void CreateControls()
+ {
+ Button btnBack = new Button(this,
+ new Vector2((StaticUIValues.ScreenViewport.X - StaticUIValues.MenuButtonSize.X) / 2, 100 + (StaticUIValues.MenuButtonSize.Y * 0) + (25 * 0)),
+ StaticUIValues.MenuButtonSize, Main.Resources.GetString(Resource.String.LevelSelectionBack));
+
+ Button btnRate = new Button(this,
+ new Vector2((StaticUIValues.ScreenViewport.X - StaticUIValues.MenuButtonSize.X) / 2, 100 + (StaticUIValues.MenuButtonSize.Y * 1) + (25 * 1)),
+ StaticUIValues.MenuButtonSize, Main.Resources.GetString(Resource.String.SupportRate));
+
+ Button btnMapPack = new Button(this,
+ new Vector2((StaticUIValues.ScreenViewport.X - StaticUIValues.MenuButtonSize.X) / 2, 100 + (StaticUIValues.MenuButtonSize.Y * 2) + (25 * 2)),
+ StaticUIValues.MenuButtonSize, "Map pack (5 Maps)");
+
+ btnBack.OnClick += BtnBack_OnClick;
+ btnRate.OnClick += BtnRate_OnClick;
+ btnMapPack.OnClick += BtnUpgrade_OnClickAsync;
+
+ Controls.Add(btnBack);
+ Controls.Add(btnRate);
+ Controls.Add(btnMapPack);
+ }
+
+ private async void BtnUpgrade_OnClickAsync(object sender, ClickArgs e)
+ {
+ await BillingManager.PurchaseMapPackAsync(this);
+ }
+
+ 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
diff --git a/Penguloon/packages.config b/Penguloon/packages.config
index 239ab89..96fc836 100644
--- a/Penguloon/packages.config
+++ b/Penguloon/packages.config
@@ -6,7 +6,7 @@
<package id="NETStandard.Library" version="1.6.1" targetFramework="monoandroid44" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="monoandroid44" />
<package id="Plugin.CurrentActivity" version="1.0.1" targetFramework="monoandroid44" />
- <package id="Plugin.InAppBilling" version="1.2.4" targetFramework="monoandroid44" />
+ <package id="Plugin.InAppBilling" version="1.2.1" targetFramework="monoandroid44" />
<package id="System.AppContext" version="4.3.0" targetFramework="monoandroid44" />
<package id="System.Collections" version="4.3.0" targetFramework="monoandroid44" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="monoandroid44" />