From 5d81b5374d7743d1148e6e474923c0e0daacf4a5 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 9 Jun 2020 16:53:26 +0200 Subject: [PATCH] fixed being able to select attractions through ui elements --- TouchyTickets/ParkMap.cs | 4 ++-- TouchyTickets/Ui.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TouchyTickets/ParkMap.cs b/TouchyTickets/ParkMap.cs index 338cc9e..8ca1055 100644 --- a/TouchyTickets/ParkMap.cs +++ b/TouchyTickets/ParkMap.cs @@ -111,13 +111,13 @@ namespace TouchyTickets { } } else { // we're not placing an attraction, so we're in remove and move mode - if (MlemGame.Input.GetGesture(GestureType.Tap, out var tap)) { + if (MlemGame.Input.GetGesture(GestureType.Tap, out var tap) && GameImpl.Instance.UiSystem.Controls.GetElementUnderPos(tap.Position) == null) { var pos = (camera.ToWorldPos(tap.Position) / Attraction.TileSize).ToPoint(); var attraction = this.GetAttractionAt(pos); if (attraction != null && (this.PlacingModifier == null || this.PlacingModifier.IsAffected(attraction))) { // actually select the top left for easy usage later this.SelectedPosition = this.attractions.First(kv => kv.Item2 == attraction).Item1; - } else if (GameImpl.Instance.UiSystem.Controls.GetElementUnderPos(tap.Position) == null) { + } else { this.SelectedPosition = null; } } diff --git a/TouchyTickets/Ui.cs b/TouchyTickets/Ui.cs index 80bab48..1e351de 100644 --- a/TouchyTickets/Ui.cs +++ b/TouchyTickets/Ui.cs @@ -122,7 +122,7 @@ namespace TouchyTickets { if (this.swipeProgress != 0) return; var map = GameImpl.Instance.Map; - var infoUi = new Group(Anchor.BottomLeft, new Vector2(1)); + var infoUi = new Group(Anchor.BottomLeft, new Vector2(1)) {CanBeMoused = false}; AddSelectedAttractionInfo(infoUi); infoUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) { OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)) @@ -224,7 +224,7 @@ namespace TouchyTickets { return; var map = GameImpl.Instance.Map; map.PlacingModifier = modifier; - var infoUi = new Group(Anchor.BottomLeft, new Vector2(1)); + var infoUi = new Group(Anchor.BottomLeft, new Vector2(1)) {CanBeMoused = false}; AddSelectedAttractionInfo(infoUi); infoUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) { OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name)) @@ -439,7 +439,7 @@ namespace TouchyTickets { return attraction.GetGenerationRate(map, pos).ToString("0.##") + "/s"; }, true)); } - + private static void PopulateUpgradeList(Element upgradeList) { upgradeList.RemoveChildren(c => !(c is ScrollBar)); var reachedActive = false;