From c1ebdac51b475679dd2b2932a1c8509afd3692b2 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 4 Jun 2020 00:58:17 +0200 Subject: [PATCH] some ui fixes --- TouchyTickets/Ui.cs | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index 7600761..0d2bcc3 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -88,7 +88,7 @@ namespace TouchyTickets { CanBeMoused = true }); main.AddChild(new Group(Anchor.AutoLeft, new Vector2(1, 0.35F), false) { - Padding = new Padding(4, 4, 12, 4), + Padding = new Padding(6, 6, 12, 6), OnDrawn = (e, time, batch, alpha) => { var map = GameImpl.Instance.Map; var mapSize = new Vector2(map.Width, map.Height) * Attraction.TileSize; @@ -153,16 +153,14 @@ namespace TouchyTickets { price = (attraction.Value.InitialPrice * (float) Math.Pow(1 + 0.1F, amount)).Ceil(); } }); - button.OnUpdated += (e, time) => { - button.IsDisabled = GameImpl.Instance.Tickets < price; - }; - var center = button.AddChild(new Group(Anchor.Center, new Vector2(0.8F, 1), false) {CanBeMoused = false}); - center.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get(attraction.Key), true) {TextScale = 0.085F}); - center.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => attraction.Value.GetGenerationRate() + "/s", true) {TextScale = 0.08F}); - button.AddChild(new Image(Anchor.CenterLeft, new Vector2(40), attraction.Value.TextureRegion) { + button.OnUpdated += (e, time) => button.IsDisabled = GameImpl.Instance.Tickets < price; + button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), attraction.Value.TextureRegion) { Padding = new Vector2(4) }); - button.AddChild(new Paragraph(Anchor.CenterRight, 1, p => PrettyPrintNumber(price) + "", true)); + var right = button.AddChild(new Group(Anchor.TopRight, new Vector2(0.8F, 1), false) {CanBeMoused = false}); + right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(attraction.Key), true)); + right.AddChild(new Paragraph(Anchor.BottomLeft, 1, p => attraction.Value.GetGenerationRate() + "/s", true) {TextScale = 0.08F}); + right.AddChild(new Paragraph(Anchor.BottomRight, 1, p => PrettyPrintNumber(price) + "", true)); } this.uiSystem.Add("Buy", buyUi); @@ -262,16 +260,16 @@ namespace TouchyTickets { center.AddChild(new Paragraph(Anchor.AutoCenter, 10000, "A game by Ellpeck", true)); this.uiSystem.Add("Splash", splash).Priority = 100000; while (center.DrawAlpha < 1) { - center.DrawAlpha += 0.01F; + center.DrawAlpha += 0.015F; yield return new WaitEvent(CoroutineEvents.Update); } yield return new WaitSeconds(1); while (center.DrawAlpha > 0) { - center.DrawAlpha -= 0.01F; + center.DrawAlpha -= 0.015F; yield return new WaitEvent(CoroutineEvents.Update); } while (splash.DrawAlpha > 0) { - splash.DrawAlpha -= 0.01F; + splash.DrawAlpha -= 0.015F; yield return new WaitEvent(CoroutineEvents.Update); } this.uiSystem.Remove(splash.Root.Name); @@ -342,11 +340,11 @@ namespace TouchyTickets { button.OnUpdated += (e, time) => HideAndDisable(); HideAndDisable(); - button.AddChild(new Paragraph(Anchor.TopCenter, 1, Localization.Get(upgrade.Name), true)); button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), upgrade.Texture) { Padding = new Vector2(4) }); var right = button.AddChild(new Group(Anchor.TopRight, new Vector2(0.8F, 1)) {CanBeMoused = false}); + right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(upgrade.Name), true)); right.AddChild(new Paragraph(Anchor.TopRight, 1, p => upgrade.Price + "", true)); right.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get(upgrade.Name + "Description"), true) {TextScale = 0.08F}); }