diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2018-01-26 14:22:18 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2018-01-26 14:22:18 +0100 |
| commit | fae272bc77b1c523a8af7a52bb220b684a2a6c1b (patch) | |
| tree | 3b99c6740f4100f704c82042808731f1ff826b24 /Penguloon/Scenes | |
| parent | 60f1bddda04ec5fa22778abf176171a547dde949 (diff) | |
Diffstat (limited to 'Penguloon/Scenes')
| -rw-r--r-- | Penguloon/Scenes/MenuScene.cs | 17 | ||||
| -rw-r--r-- | Penguloon/Scenes/ShopScene.cs | 86 |
2 files changed, 102 insertions, 1 deletions
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 |
