diff options
Diffstat (limited to 'Penguloon/Scenes/ShopScene.cs')
| -rw-r--r-- | Penguloon/Scenes/ShopScene.cs | 86 |
1 files changed, 86 insertions, 0 deletions
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 |
