diff --git a/TouchyTickets/Content/Localization/Localization.de.json b/TouchyTickets/Content/Localization/Localization.de.json index c6e8f33..b7c7763 100644 --- a/TouchyTickets/Content/Localization/Localization.de.json +++ b/TouchyTickets/Content/Localization/Localization.de.json @@ -13,6 +13,8 @@ "RainingTicketLimit": "Max. Fallende Tickets", "SoundVolume": "Lautstärke", "AGameByEllpeck": "Ein Spiel von Ellpeck", + "WhileYouWereAway": "Während du weg warst, hast du mit halber Geschwindigkeit verkauft. Du warst für {0} Minuten weg und hast währenddessen {1} verkauft. Yay!", + "WhileYouWereAwayMessage": "Offline-Zusammenfassung", "----- Tutorial -----": "", "Tutorial1": "Hi! Willkommen zu Touchy Tickets. Um das Spiel zu starten, tippe einfach den Ticket-Laden an, um ein zu verkaufen. Verkaufe erstmal 50!", "Tutorial2": "Super! Jetzt kannst du deine erste Attraktion kaufen. Wechsel durch Wischen zum rechten Menü und kaufe ein Karussell.", diff --git a/TouchyTickets/Content/Localization/Localization.json b/TouchyTickets/Content/Localization/Localization.json index 8e7e44d..e5aed2f 100644 --- a/TouchyTickets/Content/Localization/Localization.json +++ b/TouchyTickets/Content/Localization/Localization.json @@ -12,7 +12,9 @@ "Options": "Options", "RainingTicketLimit": "Max Raining Tickets", "SoundVolume": "Sound Volume", - "AGameByEllpeck":"A game by Ellpeck", + "AGameByEllpeck": "A game by Ellpeck", + "WhileYouWereAway": "While you were away, you sold at half the regular speed. You were away for {0} minutes and sold {1} during that time. Nice!", + "WhileYouWereAwayMessage": "Display Offline Summary", "----- Tutorial -----": "", "Tutorial1": "Hi! Welcome to Touchy Tickets. To start the game, simply tap the ticket booth to sell a . Start by racking up 50!", "Tutorial2": "Great! Now, you can buy your first attraction. Access the menu on the right by swiping and purchase a carousel.", diff --git a/TouchyTickets/Content/Textures/Ui.aseprite b/TouchyTickets/Content/Textures/Ui.aseprite index 3d3d7ee..5c0d65a 100644 Binary files a/TouchyTickets/Content/Textures/Ui.aseprite and b/TouchyTickets/Content/Textures/Ui.aseprite differ diff --git a/TouchyTickets/Content/Textures/Ui.png b/TouchyTickets/Content/Textures/Ui.png index a42ada8..d862bc9 100644 Binary files a/TouchyTickets/Content/Textures/Ui.png and b/TouchyTickets/Content/Textures/Ui.png differ diff --git a/TouchyTickets/GameImpl.cs b/TouchyTickets/GameImpl.cs index 55d4848..db43d7c 100644 --- a/TouchyTickets/GameImpl.cs +++ b/TouchyTickets/GameImpl.cs @@ -77,9 +77,15 @@ namespace TouchyTickets { if (this.LastUpdate != default) { var passed = now - this.LastUpdate; // if more than 1 second passed, the app is minimized or a save was loaded, so we penalize - if (passed.TotalSeconds >= 1) - passed = new TimeSpan(passed.Ticks / 2); - this.Map.Update(gameTime, passed); + var toSimulate = passed.TotalSeconds >= 1 ? new TimeSpan(passed.Ticks / 2) : 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; diff --git a/TouchyTickets/Options.cs b/TouchyTickets/Options.cs index d65e3cb..e19be28 100644 --- a/TouchyTickets/Options.cs +++ b/TouchyTickets/Options.cs @@ -20,6 +20,8 @@ namespace TouchyTickets { } } private float soundVolume = 1; + [DataMember] + public bool WhileYouWereAwayMessage = true; public static void Save() { var file = GetOptionsFile(true); diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index 541b84c..5820bec 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -31,6 +31,8 @@ namespace TouchyTickets { public Ui(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 var rainingTickets = new List(); @@ -382,6 +384,13 @@ namespace TouchyTickets { 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.swipeRelations = new Element[] {optionsUi, upgradeUi, main, buyUi, modifierUi}; @@ -444,14 +453,13 @@ namespace TouchyTickets { uiSystem.AutoScaleWithScreen = true; uiSystem.AutoScaleReferenceSize = new Point(720, 1280); 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.CheckboxCheckmark = Assets.UiTexture[4, 1]; uiSystem.Style.TextScale = 0.1F; uiSystem.Style.ActionSound = new SoundEffectInfo(Assets.ClickSound, 0.5F); uiSystem.TextFormatter.AddImage("ticket", Assets.UiTexture[2, 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 DisplaySplash(Action loadGame) { @@ -499,6 +507,18 @@ namespace TouchyTickets { 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) { IEnumerator Impl() { // disable input handling during fade