diff --git a/TouchyTickets/Content/Textures/Ui.aseprite b/TouchyTickets/Content/Textures/Ui.aseprite index 009b0ca..9b49536 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 e683757..7410760 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 b16cc3a..b197e83 100644 --- a/TouchyTickets/GameImpl.cs +++ b/TouchyTickets/GameImpl.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Numerics; +using Coroutine; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MLEM.Cameras; @@ -42,6 +43,8 @@ namespace TouchyTickets { MaxScale = 24, MinScale = 2 }; + + CoroutineHandler.Start(this.Ui.DisplaySplash()); } protected override void DoUpdate(GameTime gameTime) { diff --git a/TouchyTickets/TouchyTickets.csproj b/TouchyTickets/TouchyTickets.csproj index bc10315..5197d20 100644 --- a/TouchyTickets/TouchyTickets.csproj +++ b/TouchyTickets/TouchyTickets.csproj @@ -6,7 +6,7 @@ - + all diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index 9642418..737368f 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -100,7 +100,7 @@ namespace TouchyTickets { }, OnPressed = e => { var backUi = new Group(Anchor.BottomLeft, new Vector2(1)); - backUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(1, 20), Localization.Get("Back")) { + backUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(1, 30), Localization.Get("Back")) { OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)) }); // we want this to render below the main ui while it fades away @@ -130,10 +130,10 @@ namespace TouchyTickets { map.PlacingPosition = new Point(MathHelper.Clamp(posX, 0, map.Width - attraction.Value.Width), MathHelper.Clamp(posY, 0, map.Height - attraction.Value.Height)); var yesNoUi = new Group(Anchor.BottomLeft, new Vector2(1)); - yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 20), Localization.Get("Back")) { + yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Back")) { OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)) }); - yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 20), Localization.Get("Place")) { + yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Place")) { OnPressed = e2 => { GameImpl.Instance.Tickets -= price; map.Place(map.PlacingPosition, map.PlacingAttraction); @@ -171,9 +171,9 @@ namespace TouchyTickets { IsHidden = true, OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorExtensions.FromHex(0xff86bccf) * alpha) }; - var upgradeHeader = upgradeUi.AddChild(new Group(Anchor.AutoLeft, new Vector2(1, 0.25F), false)); + var upgradeHeader = upgradeUi.AddChild(new Group(Anchor.AutoLeft, new Vector2(1, 0.27F), false)); upgradeHeader.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => GameImpl.Instance.Stars + "", true) {TextScale = 0.3F}); - upgradeHeader.AddChild(new Button(Anchor.AutoCenter, new Vector2(0.8F, 20), Localization.Get("EarnStar")) { + upgradeHeader.AddChild(new Button(Anchor.AutoCenter, new Vector2(0.8F, 30), Localization.Get("EarnStar")) { PositionOffset = new Vector2(0, 4), OnUpdated = (e, time) => ((Button) e).IsDisabled = GameImpl.Instance.Tickets < GameImpl.Instance.GetStarPrice(), OnPressed = e => { @@ -182,10 +182,10 @@ namespace TouchyTickets { }; var panel = infoBox.AddChild(new Panel(Anchor.Center, new Vector2(0.8F), Vector2.Zero, true)); panel.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get("ReallyEarnStar"))); - panel.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 20), Localization.Get("Back")) { + panel.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) { OnPressed = e2 => this.uiSystem.Remove(e2.Root.Name) }); - panel.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 20), Localization.Get("Yes")) { + panel.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 30), Localization.Get("Yes")) { OnPressed = e2 => { this.uiSystem.Remove(e2.Root.Name); var game = GameImpl.Instance; @@ -201,7 +201,7 @@ namespace TouchyTickets { upgradeHeader.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => string.Format(Localization.Get("RequiresTickets"), PrettyPrintNumber(GameImpl.Instance.GetStarPrice())), true) { PositionOffset = new Vector2(0, 2) }); - var upgradeList = upgradeUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1, 0.75F), Vector2.Zero, false, true, new Point(10, 30), false) { + var upgradeList = upgradeUi.AddChild(new Panel(Anchor.AutoLeft, new Vector2(1, 0.73F), Vector2.Zero, false, true, new Point(10, 30), false) { ChildPadding = new Padding(5, 15, 5, 5) }); foreach (var upgrade in Upgrade.Upgrades.Values) { @@ -276,6 +276,30 @@ namespace TouchyTickets { } } + public IEnumerator DisplaySplash() { + var splash = new Group(Anchor.TopLeft, Vector2.One, false) { + OnDrawn = (e, time, batch, alpha) => batch.Draw(batch.GetBlankTexture(), e.DisplayArea, Color.Black * alpha) + }; + var center = splash.AddChild(new Group(Anchor.Center, new Vector2(0.5F, 0.5F), false) {DrawAlpha = 0}); + center.AddChild(new Image(Anchor.AutoCenter, new Vector2(1, -1), Texture[4, 0])); + center.AddChild(new Paragraph(Anchor.AutoCenter, 10000, "A game by Ellpeck", true)); + this.uiSystem.Add("Splash", splash); + while (center.DrawAlpha < 1) { + center.DrawAlpha += 0.01F; + yield return new WaitEvent(CoroutineEvents.Update); + } + yield return new WaitSeconds(1.5); + while (center.DrawAlpha > 0) { + center.DrawAlpha -= 0.01F; + yield return new WaitEvent(CoroutineEvents.Update); + } + while (splash.DrawAlpha > 0) { + splash.DrawAlpha -= 0.01F; + yield return new WaitEvent(CoroutineEvents.Update); + } + this.uiSystem.Remove(splash.Root.Name); + } + private void ResetSwipe() { this.finishingSwipe = false; this.swipeProgress = 0;