added rate request

This commit is contained in:
Ellpeck 2020-06-30 19:06:35 +02:00
parent 14158b700e
commit 75926e33df
7 changed files with 43 additions and 1 deletions

View file

@ -1,7 +1,9 @@
using System.Collections;
using System.Collections.Generic;
using Android.App;
using Android.Content;
using Android.Gms.Ads;
using Android.Net;
using Android.Views;
using Android.Widget;
using GameAnalyticsSDK;
@ -47,5 +49,9 @@ namespace Android {
}
}
public override void OpenRateLink() {
this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
}
}
}

View file

@ -17,6 +17,8 @@
"WhileYouWereAway": "While you were away, you sold <i ticket> at half the regular speed. You were away for <c Yellow>{0} minutes</c> and sold <c Yellow>{1} <i ticket></c> during that time. Nice!",
"WhileYouWereAwayMessage": "Display Offline Summary",
"KeepScreenOn": "Keep Screen On",
"RateInfo": "You've been playing the game for a while now, which probably means you're enjoying it.\nPlease <c Yellow>rate</c> the game, it really helps out! Thanks <3",
"Rate": "Rate",
"----- Tutorial -----": "",
"Tutorial1": "Hi! Welcome to Touchy Tickets. To start the game, simply tap the ticket booth to sell a <i ticket>. Start by racking up 50<i ticket>!",
"Tutorial2": "Great! Now, you can buy your first attraction. Access the menu on the right by swiping and purchase a carousel.",

View file

@ -22,6 +22,7 @@ namespace TouchyTickets {
public Ui Ui { get; private set; }
public bool DrawMap;
public DateTime LastUpdate;
public TimeSpan PlayTime;
private double saveCounter;
public GameImpl(Platform platform) {
@ -97,6 +98,12 @@ namespace TouchyTickets {
}
}
// play time stuff
var lastTime = this.PlayTime;
this.PlayTime += gameTime.ElapsedGameTime;
if (lastTime.TotalHours >= 1 != this.PlayTime.TotalHours >= 1)
Ui.DisplayRatePlease();
this.Ui?.Update(gameTime);
this.Tutorial?.Update(this);
}

View file

@ -11,5 +11,7 @@ namespace TouchyTickets {
public abstract void SetKeepScreenOn(bool keep);
public abstract void OpenRateLink();
}
}

View file

@ -25,7 +25,8 @@ namespace TouchyTickets {
Stars = game.Stars,
TimesRestarted = game.TimesRestarted,
Upgrades = game.AppliedUpgrades.Select(u => u.Name).ToList(),
TutorialStep = game.Tutorial.CurrentStep
TutorialStep = game.Tutorial.CurrentStep,
PlayTime = game.PlayTime
};
Serializer.Serialize(stream, data);
}
@ -48,6 +49,7 @@ namespace TouchyTickets {
foreach (var name in data.Upgrades)
game.AppliedUpgrades.Add(Upgrade.Upgrades[name]);
game.Tutorial.CurrentStep = data.TutorialStep;
game.PlayTime = data.PlayTime;
// version 1 had smaller maps
if (data.SaveVersion <= 1) {
@ -88,6 +90,7 @@ namespace TouchyTickets {
public int TimesRestarted;
public List<string> Upgrades;
public int TutorialStep;
public TimeSpan PlayTime;
}
}

View file

@ -560,6 +560,24 @@ namespace TouchyTickets {
GameImpl.Instance.UiSystem.Add("WhileYouWereAway", infoBox);
}
public static void DisplayRatePlease() {
var infoBox = new Group(Anchor.TopLeft, Vector2.One, false) {
OnDrawn = (e2, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e2.DisplayArea, Color.Black * 0.35F)
};
var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true));
panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, string.Format(Localization.Get("RateInfo"))));
panel.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) {
OnPressed = e2 => e2.System.Remove(e2.Root.Name)
});
panel.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Rate")) {
OnPressed = e2 => {
GameImpl.Instance.Platform.OpenRateLink();
e2.System.Remove(e2.Root.Name);
}
});
GameImpl.Instance.UiSystem.Add("RatePlease", infoBox);
}
private void FadeUi(bool fadeOut, Action after = null) {
IEnumerator<Wait> Impl() {
// disable input handling during fade

View file

@ -24,5 +24,9 @@ namespace iOS {
throw new System.NotImplementedException();
}
public override void OpenRateLink() {
throw new System.NotImplementedException();
}
}
}