fixed being able to select attractions through ui elements
This commit is contained in:
parent
f0ca59b6c7
commit
5d81b5374d
2 changed files with 5 additions and 5 deletions
|
@ -111,13 +111,13 @@ namespace TouchyTickets {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we're not placing an attraction, so we're in remove and move mode
|
// 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 pos = (camera.ToWorldPos(tap.Position) / Attraction.TileSize).ToPoint();
|
||||||
var attraction = this.GetAttractionAt(pos);
|
var attraction = this.GetAttractionAt(pos);
|
||||||
if (attraction != null && (this.PlacingModifier == null || this.PlacingModifier.IsAffected(attraction))) {
|
if (attraction != null && (this.PlacingModifier == null || this.PlacingModifier.IsAffected(attraction))) {
|
||||||
// actually select the top left for easy usage later
|
// actually select the top left for easy usage later
|
||||||
this.SelectedPosition = this.attractions.First(kv => kv.Item2 == attraction).Item1;
|
this.SelectedPosition = this.attractions.First(kv => kv.Item2 == attraction).Item1;
|
||||||
} else if (GameImpl.Instance.UiSystem.Controls.GetElementUnderPos(tap.Position) == null) {
|
} else {
|
||||||
this.SelectedPosition = null;
|
this.SelectedPosition = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace TouchyTickets {
|
||||||
if (this.swipeProgress != 0)
|
if (this.swipeProgress != 0)
|
||||||
return;
|
return;
|
||||||
var map = GameImpl.Instance.Map;
|
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);
|
AddSelectedAttractionInfo(infoUi);
|
||||||
infoUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) {
|
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))
|
OnPressed = e2 => this.FadeUi(false, () => this.uiSystem.Remove(e2.Root.Name))
|
||||||
|
@ -224,7 +224,7 @@ namespace TouchyTickets {
|
||||||
return;
|
return;
|
||||||
var map = GameImpl.Instance.Map;
|
var map = GameImpl.Instance.Map;
|
||||||
map.PlacingModifier = modifier;
|
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);
|
AddSelectedAttractionInfo(infoUi);
|
||||||
infoUi.AddChild(new Button(Anchor.AutoLeft, new Vector2(0.5F, 30), Localization.Get("Back")) {
|
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))
|
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";
|
return attraction.GetGenerationRate(map, pos).ToString("0.##") + "<i ticket>/s";
|
||||||
}, true));
|
}, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PopulateUpgradeList(Element upgradeList) {
|
private static void PopulateUpgradeList(Element upgradeList) {
|
||||||
upgradeList.RemoveChildren(c => !(c is ScrollBar));
|
upgradeList.RemoveChildren(c => !(c is ScrollBar));
|
||||||
var reachedActive = false;
|
var reachedActive = false;
|
||||||
|
|
Loading…
Reference in a new issue