diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2018-01-12 13:32:26 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2018-01-12 13:32:26 +0100 |
| commit | f93e133ede2a76be1aa20a33c9fcf01308cd6df8 (patch) | |
| tree | 1a906cc08cefd785628ba0e416136f843a37b7f3 /Penguloon/Scenes | |
| parent | 39b1a897eec86f532ca1417698057ae9e1130985 (diff) | |
dab
Diffstat (limited to 'Penguloon/Scenes')
| -rw-r--r-- | Penguloon/Scenes/MenuScene.cs | 14 | ||||
| -rw-r--r-- | Penguloon/Scenes/SupportScene.cs | 78 |
2 files changed, 92 insertions, 0 deletions
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 |
