added "while you were away" message

This commit is contained in:
Ellpeck 2020-06-29 13:00:49 +02:00
parent d8981f6d51
commit 610fb79424
7 changed files with 39 additions and 7 deletions

View file

@ -13,6 +13,8 @@
"RainingTicketLimit": "Max. Fallende Tickets", "RainingTicketLimit": "Max. Fallende Tickets",
"SoundVolume": "Lautstärke", "SoundVolume": "Lautstärke",
"AGameByEllpeck": "Ein Spiel von Ellpeck", "AGameByEllpeck": "Ein Spiel von Ellpeck",
"WhileYouWereAway": "Während du weg warst, hast du <i ticket> mit halber Geschwindigkeit verkauft. Du warst für <c Yellow>{0} Minuten</c> weg und hast währenddessen <c Yellow>{1} <i ticket></c> verkauft. Yay!",
"WhileYouWereAwayMessage": "Offline-Zusammenfassung",
"----- Tutorial -----": "", "----- Tutorial -----": "",
"Tutorial1": "Hi! Willkommen zu Touchy Tickets. Um das Spiel zu starten, tippe einfach den Ticket-Laden an, um ein <i ticket> zu verkaufen. Verkaufe erstmal 50<i ticket>!", "Tutorial1": "Hi! Willkommen zu Touchy Tickets. Um das Spiel zu starten, tippe einfach den Ticket-Laden an, um ein <i ticket> zu verkaufen. Verkaufe erstmal 50<i ticket>!",
"Tutorial2": "Super! Jetzt kannst du deine erste Attraktion kaufen. Wechsel durch Wischen zum rechten Menü und kaufe ein Karussell.", "Tutorial2": "Super! Jetzt kannst du deine erste Attraktion kaufen. Wechsel durch Wischen zum rechten Menü und kaufe ein Karussell.",

View file

@ -12,7 +12,9 @@
"Options": "Options", "Options": "Options",
"RainingTicketLimit": "Max Raining Tickets", "RainingTicketLimit": "Max Raining Tickets",
"SoundVolume": "Sound Volume", "SoundVolume": "Sound Volume",
"AGameByEllpeck":"A game by Ellpeck", "AGameByEllpeck": "A game by Ellpeck",
"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",
"----- Tutorial -----": "", "----- 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>!", "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.", "Tutorial2": "Great! Now, you can buy your first attraction. Access the menu on the right by swiping and purchase a carousel.",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -77,9 +77,15 @@ namespace TouchyTickets {
if (this.LastUpdate != default) { if (this.LastUpdate != default) {
var passed = now - this.LastUpdate; var passed = now - this.LastUpdate;
// if more than 1 second passed, the app is minimized or a save was loaded, so we penalize // if more than 1 second passed, the app is minimized or a save was loaded, so we penalize
if (passed.TotalSeconds >= 1) var toSimulate = passed.TotalSeconds >= 1 ? new TimeSpan(passed.Ticks / 2) : passed;
passed = new TimeSpan(passed.Ticks / 2);
this.Map.Update(gameTime, passed); var lastTickets = this.Tickets;
this.Map.Update(gameTime, toSimulate);
var generated = this.Tickets - lastTickets;
// if 10 or more seconds passed, we display a message
if (Options.Instance.WhileYouWereAwayMessage && passed.TotalSeconds >= 10 && generated > 0)
Ui.DisplayWhileYouWereAway(passed, generated);
} }
this.LastUpdate = now; this.LastUpdate = now;

View file

@ -20,6 +20,8 @@ namespace TouchyTickets {
} }
} }
private float soundVolume = 1; private float soundVolume = 1;
[DataMember]
public bool WhileYouWereAwayMessage = true;
public static void Save() { public static void Save() {
var file = GetOptionsFile(true); var file = GetOptionsFile(true);

View file

@ -31,6 +31,8 @@ namespace TouchyTickets {
public Ui(UiSystem uiSystem) { public Ui(UiSystem uiSystem) {
this.uiSystem = uiSystem; this.uiSystem = uiSystem;
foreach (var modifier in AttractionModifier.Modifiers.Values)
this.uiSystem.TextFormatter.AddImage(modifier.Name, Assets.UiTexture[modifier.Texture]);
// main ticket store ui // main ticket store ui
var rainingTickets = new List<RainingTicket>(); var rainingTickets = new List<RainingTicket>();
@ -382,6 +384,13 @@ namespace TouchyTickets {
Options.Save(); Options.Save();
} }
}); });
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 20), Localization.Get("WhileYouWereAwayMessage"), Options.Instance.WhileYouWereAwayMessage) {
PositionOffset = new Vector2(0, 1),
OnCheckStateChange = (b, value) => {
Options.Instance.WhileYouWereAwayMessage = value;
Options.Save();
}
});
this.uiSystem.Add("Options", optionsUi); this.uiSystem.Add("Options", optionsUi);
this.swipeRelations = new Element[] {optionsUi, upgradeUi, main, buyUi, modifierUi}; this.swipeRelations = new Element[] {optionsUi, upgradeUi, main, buyUi, modifierUi};
@ -444,14 +453,13 @@ namespace TouchyTickets {
uiSystem.AutoScaleWithScreen = true; uiSystem.AutoScaleWithScreen = true;
uiSystem.AutoScaleReferenceSize = new Point(720, 1280); uiSystem.AutoScaleReferenceSize = new Point(720, 1280);
uiSystem.Style.Font = new GenericSpriteFont(Assets.Font); uiSystem.Style.Font = new GenericSpriteFont(Assets.Font);
uiSystem.Style.PanelTexture = uiSystem.Style.ScrollBarBackground = new NinePatch(Assets.UiTexture[2, 1], 4); uiSystem.Style.PanelTexture = uiSystem.Style.ScrollBarBackground = uiSystem.Style.CheckboxTexture = new NinePatch(Assets.UiTexture[2, 1], 4);
uiSystem.Style.ButtonTexture = uiSystem.Style.ScrollBarScrollerTexture = new NinePatch(Assets.UiTexture[3, 1], 4); uiSystem.Style.ButtonTexture = uiSystem.Style.ScrollBarScrollerTexture = new NinePatch(Assets.UiTexture[3, 1], 4);
uiSystem.Style.CheckboxCheckmark = Assets.UiTexture[4, 1];
uiSystem.Style.TextScale = 0.1F; uiSystem.Style.TextScale = 0.1F;
uiSystem.Style.ActionSound = new SoundEffectInfo(Assets.ClickSound, 0.5F); uiSystem.Style.ActionSound = new SoundEffectInfo(Assets.ClickSound, 0.5F);
uiSystem.TextFormatter.AddImage("ticket", Assets.UiTexture[2, 0]); uiSystem.TextFormatter.AddImage("ticket", Assets.UiTexture[2, 0]);
uiSystem.TextFormatter.AddImage("star", Assets.UiTexture[3, 0]); uiSystem.TextFormatter.AddImage("star", Assets.UiTexture[3, 0]);
foreach (var modifier in AttractionModifier.Modifiers.Values)
uiSystem.TextFormatter.AddImage(modifier.Name, Assets.UiTexture[modifier.Texture]);
} }
public static IEnumerator<Wait> DisplaySplash(Action loadGame) { public static IEnumerator<Wait> DisplaySplash(Action loadGame) {
@ -499,6 +507,18 @@ namespace TouchyTickets {
splash.System.Remove(splash.Root.Name); splash.System.Remove(splash.Root.Name);
} }
public static void DisplayWhileYouWereAway(TimeSpan passed, BigInteger ticketsGenerated) {
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("WhileYouWereAway"), passed.TotalMinutes.ToString("0.#"), PrettyPrintNumber(ticketsGenerated))));
panel.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 30), Localization.Get("Okay")) {
OnPressed = e2 => e2.System.Remove(e2.Root.Name)
});
GameImpl.Instance.UiSystem.Add("WhileYouWereAway", infoBox);
}
private void FadeUi(bool fadeOut, Action after = null) { private void FadeUi(bool fadeOut, Action after = null) {
IEnumerator<Wait> Impl() { IEnumerator<Wait> Impl() {
// disable input handling during fade // disable input handling during fade