diff --git a/TouchyTickets/Content/Localization/Localization.json b/TouchyTickets/Content/Localization/Localization.json index 49d40c0..700295f 100644 --- a/TouchyTickets/Content/Localization/Localization.json +++ b/TouchyTickets/Content/Localization/Localization.json @@ -2,21 +2,23 @@ "Back": "Back", "Place": "Place", "EarnStar": "Earn ", + "ReallyEarnStar": "Are you sure that you want to earn a ? This will remove all placed attractions and reset your !", + "Yes": "Yes", "RequiresTickets": "Requires {0}", "Carousel": "Carousel", "FoodCourt": "Food Court", "FerrisWheel": "Ferris Wheel", "WildMouse": "Wild Mouse", "MapSize1": "Big Park", - "MapSize1Description": "Increases your park's buildable area.", + "MapSize1Description": "Increases your park's buildable area. Existing attractions are not removed.", "MapSize2": "Bigger Park", - "MapSize2Description": "Increases your park's buildable area more.", + "MapSize2Description": "Increases your park's buildable area more. Existing attractions are not removed.", "MapSize3": "Biggest Park", - "MapSize3Description": "Increases your park's buildable area even more.", + "MapSize3Description": "Increases your park's buildable area even more. Existing attractions are not removed.", "MapSize4": "Biggester Park", - "MapSize4Description": "Increases your park's buildable area even more.", + "MapSize4Description": "Increases your park's buildable area even more. Existing attractions are not removed.", "MapSize5": "Biggestest Park", - "MapSize5Description": "Increases your park's buildable area to the maximum.", + "MapSize5Description": "Increases your park's buildable area to the maximum. Existing attractions are not removed.", "FoodCourtModifier": "Tasty Treats", "FoodCourtModifierDescription": "Doubles ticket sales for all attractions adjacent to food courts.", "FerrisWheelModifier": "Crowded Pods", diff --git a/TouchyTickets/Content/Textures/Ui.aseprite b/TouchyTickets/Content/Textures/Ui.aseprite index 6d0fd80..009b0ca 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 d14ab4f..e683757 100644 Binary files a/TouchyTickets/Content/Textures/Ui.png and b/TouchyTickets/Content/Textures/Ui.png differ diff --git a/TouchyTickets/ParkMap.cs b/TouchyTickets/ParkMap.cs index 9d5e58d..57b2f1d 100644 --- a/TouchyTickets/ParkMap.cs +++ b/TouchyTickets/ParkMap.cs @@ -74,7 +74,7 @@ namespace TouchyTickets { this.TicketsPerSecond = tickets; // map movement - if (GameImpl.Instance.DrawMap) { + if (GameImpl.Instance.DrawMap && GameImpl.Instance.UiSystem.Controls.HandleTouch) { var camera = GameImpl.Instance.Camera; if (MlemGame.Input.GetGesture(GestureType.Pinch, out var pinch)) { var startDiff = pinch.Position2 - pinch.Position; diff --git a/TouchyTickets/TouchyTickets.csproj b/TouchyTickets/TouchyTickets.csproj index 6a59fe0..bc10315 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 c8a6651..9642418 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -34,6 +34,8 @@ namespace TouchyTickets { this.uiSystem.AutoScaleWithScreen = true; this.uiSystem.AutoScaleReferenceSize = new Point(720, 1280); this.uiSystem.Style.Font = new GenericSpriteFont(MlemGame.LoadContent("Fonts/Regular")); + this.uiSystem.Style.PanelTexture = this.uiSystem.Style.ScrollBarBackground = new NinePatch(Texture[2, 1], 4); + this.uiSystem.Style.ButtonTexture = this.uiSystem.Style.ScrollBarScrollerTexture = new NinePatch(Texture[3, 1], 4); this.uiSystem.Style.TextScale = 0.1F; this.uiSystem.TextFormatter.AddImage("ticket", Texture[2, 0]); this.uiSystem.TextFormatter.AddImage("star", Texture[3, 0]); @@ -50,7 +52,7 @@ namespace TouchyTickets { rainingTickets.Add(new RainingTicket()); }, OnDrawn = (e, time, batch, alpha) => { - batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorExtensions.FromHex(0xff86cfcb) * alpha); + batch.Draw(batch.GetBlankTexture(), e.DisplayArea, ColorExtensions.FromHex(0xff86bccf) * alpha); foreach (var ticket in rainingTickets) ticket.Draw(batch, e.DisplayArea.Size, e.Scale, Color.White * alpha); } @@ -63,11 +65,14 @@ namespace TouchyTickets { PositionOffset = new Vector2(0, -8) }); BigInteger lastTickets = 0; + ActiveCoroutine storeWobble = null; var storeGroup = main.AddChild(new CustomDrawGroup(Anchor.AutoCenter, new Vector2(1, 0.5F), null, null, false) { OnUpdated = (e, time) => { if (lastTickets != GameImpl.Instance.Tickets) { lastTickets = GameImpl.Instance.Tickets; - CoroutineHandler.Start(WobbleElement((CustomDrawGroup) e)); + // only wobble if we're not already wobbling + if (storeWobble == null || storeWobble.IsFinished) + storeWobble = CoroutineHandler.Start(WobbleElement((CustomDrawGroup) e)); } } }); @@ -90,11 +95,12 @@ namespace TouchyTickets { var (scaleX, scaleY) = e.DisplayArea.Size / mapSize; var scale = Math.Min(scaleX, scaleY); var pos = e.DisplayArea.Location + (e.DisplayArea.Size - mapSize * scale) / 2; + batch.Draw(this.uiSystem.Style.PanelTexture, new RectangleF(pos - new Vector2(2) * e.Scale, mapSize * scale + new Vector2(4) * e.Scale), Color.White * alpha, e.Scale); map.Draw(time, batch, pos, scale, alpha, false, new RectangleF(Vector2.Zero, mapSize * scale)); }, OnPressed = e => { var backUi = new Group(Anchor.BottomLeft, new Vector2(1)); - backUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(1, 40), Localization.Get("Back")) { + backUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(1, 20), 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 @@ -115,6 +121,7 @@ namespace TouchyTickets { BigInteger price = 0; var button = buyUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(1, 40)) { ChildPadding = new Vector2(4), + PositionOffset = new Vector2(0, 1), OnPressed = e => { var map = GameImpl.Instance.Map; map.PlacingAttraction = attraction.Value.Create(); @@ -123,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, 40), Localization.Get("Back")) { + yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 20), Localization.Get("Back")) { OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)) }); - yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 40), Localization.Get("Place")) { + yesNoUi.AddChild(new Button(Anchor.AutoInlineIgnoreOverflow, new Vector2(0.5F, 20), Localization.Get("Place")) { OnPressed = e2 => { GameImpl.Instance.Tickets -= price; map.Place(map.PlacingPosition, map.PlacingAttraction); @@ -170,11 +177,25 @@ namespace TouchyTickets { PositionOffset = new Vector2(0, 4), OnUpdated = (e, time) => ((Button) e).IsDisabled = GameImpl.Instance.Tickets < GameImpl.Instance.GetStarPrice(), OnPressed = e => { - var game = GameImpl.Instance; - game.TimesRestarted++; - game.Stars++; - game.Map = new ParkMap(game.Map.Width, game.Map.Height); - game.Tickets = 0; + 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, Localization.Get("ReallyEarnStar"))); + panel.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 20), 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")) { + OnPressed = e2 => { + this.uiSystem.Remove(e2.Root.Name); + var game = GameImpl.Instance; + game.TimesRestarted++; + game.Stars++; + game.Map = new ParkMap(game.Map.Width, game.Map.Height); + game.Tickets = 0; + } + }); + this.uiSystem.Add("ReallyEarnStarBox", infoBox); } }); upgradeHeader.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => string.Format(Localization.Get("RequiresTickets"), PrettyPrintNumber(GameImpl.Instance.GetStarPrice())), true) { @@ -186,6 +207,7 @@ namespace TouchyTickets { foreach (var upgrade in Upgrade.Upgrades.Values) { var button = upgradeList.AddChild(new Button(Anchor.AutoLeft, new Vector2(1)) { SetHeightBasedOnChildren = true, + PositionOffset = new Vector2(0, 1), ChildPadding = new Vector2(4), OnPressed = e => { GameImpl.Instance.Stars--; @@ -213,7 +235,7 @@ namespace TouchyTickets { public void Update(GameTime time) { // swiping between tabs - if (!this.currentUi.IsHidden) { + if (!this.currentUi.IsHidden && this.uiSystem.Controls.HandleTouch) { if (MlemGame.Input.GetGesture(GestureType.HorizontalDrag, out var gesture)) { this.swipeProgress -= gesture.Delta.X / this.currentUi.DisplayArea.Width; } else if (!this.finishingSwipe && this.swipeProgress != 0 && !MlemGame.Input.TouchState.Any()) {