fixed being able to select attractions through ui elements

This commit is contained in:
Ellpeck 2020-06-09 16:53:26 +02:00
parent f0ca59b6c7
commit 5d81b5374d
2 changed files with 5 additions and 5 deletions

View file

@ -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;
}
}

View file

@ -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.##") + "<i ticket>/s";
}, true));
}
private static void PopulateUpgradeList(Element upgradeList) {
upgradeList.RemoveChildren(c => !(c is ScrollBar));
var reachedActive = false;