diff --git a/TouchyTickets/Content/Localization/Localization.de.json b/TouchyTickets/Content/Localization/Localization.de.json index 59bf50b..30f947a 100644 --- a/TouchyTickets/Content/Localization/Localization.de.json +++ b/TouchyTickets/Content/Localization/Localization.de.json @@ -15,7 +15,9 @@ "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!", + "WhileYouWereAway": "Während du für {0} Minuten weg warst, hast du mit halber Geschwindigkeit verkauft.", + "WhileYouWereAwayTickets": "Du hast in dieser Zeit {0} verkauft.", + "WhileYouWereAwayTps": "Durch automatische Käufe hat sich deine Verkaufs-Rate um {0} /s erhöht.", "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!", diff --git a/TouchyTickets/Content/Localization/Localization.json b/TouchyTickets/Content/Localization/Localization.json index a718898..d647d73 100644 --- a/TouchyTickets/Content/Localization/Localization.json +++ b/TouchyTickets/Content/Localization/Localization.json @@ -15,7 +15,9 @@ "RainingTicketLimit": "Max Raining Tickets", "SoundVolume": "Sound Volume", "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!", + "WhileYouWereAway": "While you were away for {0} minutes, you sold at half the regular speed.", + "WhileYouWereAwayTickets": "During that time, you sold {0} .", + "WhileYouWereAwayTps": "Due to auto-buying, your sale rate increased by {0} /s.", "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 rate the game, it really helps out! Thanks <3", diff --git a/TouchyTickets/GameImpl.cs b/TouchyTickets/GameImpl.cs index e0030e9..6b4d1d6 100644 --- a/TouchyTickets/GameImpl.cs +++ b/TouchyTickets/GameImpl.cs @@ -121,13 +121,14 @@ namespace TouchyTickets { var now = DateTime.Now; if (this.LastUpdate != default) { var lastTickets = this.Tickets; + var lastTps = this.Map.TicketsPerSecond; + var passed = now - this.LastUpdate; this.Map.Update(passed, passed.TotalSeconds >= 1); - 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); + if (Options.Instance.WhileYouWereAwayMessage && passed.TotalSeconds >= 10) + Ui.DisplayWhileYouWereAway(passed, this.Tickets - lastTickets, this.Map.TicketsPerSecond - lastTps); } this.LastUpdate = now; } diff --git a/TouchyTickets/ParkMap.cs b/TouchyTickets/ParkMap.cs index 657e06d..040fa59 100644 --- a/TouchyTickets/ParkMap.cs +++ b/TouchyTickets/ParkMap.cs @@ -26,8 +26,8 @@ namespace TouchyTickets { private readonly Dictionary fencePositions = new Dictionary(); private readonly Attraction[,] attractionGrid; + [DataMember] public double TicketsPerSecond { get; private set; } - public readonly Dictionary TicketsPerRide = new Dictionary(); public Attraction PlacingAttraction; public AttractionModifier PlacingModifier; public Point PlacingPosition; @@ -80,13 +80,9 @@ namespace TouchyTickets { } // update tickets - this.TicketsPerRide.Clear(); this.TicketsPerSecond = 0; foreach (var (pos, attraction) in this.attractions) { var genPerSecond = attraction.Update(toSimulate, this, pos); - // store ride statistics - this.TicketsPerRide.TryGetValue(attraction.Type, out var curr); - this.TicketsPerRide[attraction.Type] = curr + genPerSecond; this.TicketsPerSecond += genPerSecond; // after each attraction has sold their tickets, try auto-buying again if we were away @@ -241,6 +237,7 @@ namespace TouchyTickets { if (newMap.CanPlace(pos, attraction)) newMap.Place(pos, attraction); } + newMap.TicketsPerSecond = this.TicketsPerSecond; return newMap; } diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index 177737b..386ae61 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -585,12 +585,17 @@ namespace TouchyTickets { splash.System.Remove(splash.Root.Name); } - public static void DisplayWhileYouWereAway(TimeSpan passed, BigInteger ticketsGenerated) { + public static void DisplayWhileYouWereAway(TimeSpan passed, BigInteger ticketGen, double ticketPerSecondGen) { 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)))); + var text = string.Format(Localization.Get("WhileYouWereAway"), passed.TotalMinutes.ToString("0.#")); + if (ticketGen > 0) + text += " " + string.Format(Localization.Get("WhileYouWereAwayTickets"), PrettyPrintNumber(ticketGen)); + if (ticketPerSecondGen > 0) + text += " " + string.Format(Localization.Get("WhileYouWereAwayTps"), ticketPerSecondGen.ToString("#,0.##")); + panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, text)); panel.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 30), Localization.Get("Okay")) { OnPressed = e2 => e2.System.Remove(e2.Root.Name) });