fixed some ui issues

This commit is contained in:
Ellpeck 2020-06-03 14:19:51 +02:00
parent f968ae7e70
commit 820181044f
2 changed files with 8 additions and 3 deletions

View file

@ -38,7 +38,7 @@ namespace TouchyTickets {
this.Ui = new Ui(this.UiSystem); this.Ui = new Ui(this.UiSystem);
this.Camera = new Camera(this.GraphicsDevice) { this.Camera = new Camera(this.GraphicsDevice) {
Scale = 2, Scale = 4,
AutoScaleWithScreen = true, AutoScaleWithScreen = true,
AutoScaleReferenceSize = new Point(720, 1280), AutoScaleReferenceSize = new Point(720, 1280),
MaxScale = 24, MaxScale = 24,

View file

@ -333,10 +333,15 @@ namespace TouchyTickets {
PopulateUpgradeList(upgradeList); PopulateUpgradeList(upgradeList);
} }
}); });
button.OnUpdated += (e, time) => {
void HideAndDisable() {
button.IsHidden = upgrade.Dependencies.Any(u => !u.IsActive()); button.IsHidden = upgrade.Dependencies.Any(u => !u.IsActive());
button.IsDisabled = upgrade.IsActive() || GameImpl.Instance.Stars < upgrade.Price; button.IsDisabled = upgrade.IsActive() || GameImpl.Instance.Stars < upgrade.Price;
}; }
button.OnUpdated += (e, time) => HideAndDisable();
HideAndDisable();
button.AddChild(new Paragraph(Anchor.TopCenter, 1, Localization.Get(upgrade.Name), true)); button.AddChild(new Paragraph(Anchor.TopCenter, 1, Localization.Get(upgrade.Name), true));
button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), upgrade.Texture) { button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), upgrade.Texture) {
Padding = new Vector2(4) Padding = new Vector2(4)