some ui fixes

This commit is contained in:
Ellpeck 2020-06-04 00:58:17 +02:00
parent 6de040b92d
commit c1ebdac51b

View file

@ -88,7 +88,7 @@ namespace TouchyTickets {
CanBeMoused = true
});
main.AddChild(new Group(Anchor.AutoLeft, new Vector2(1, 0.35F), false) {
Padding = new Padding(4, 4, 12, 4),
Padding = new Padding(6, 6, 12, 6),
OnDrawn = (e, time, batch, alpha) => {
var map = GameImpl.Instance.Map;
var mapSize = new Vector2(map.Width, map.Height) * Attraction.TileSize;
@ -153,16 +153,14 @@ namespace TouchyTickets {
price = (attraction.Value.InitialPrice * (float) Math.Pow(1 + 0.1F, amount)).Ceil();
}
});
button.OnUpdated += (e, time) => {
button.IsDisabled = GameImpl.Instance.Tickets < price;
};
var center = button.AddChild(new Group(Anchor.Center, new Vector2(0.8F, 1), false) {CanBeMoused = false});
center.AddChild(new Paragraph(Anchor.AutoCenter, 1, Localization.Get(attraction.Key), true) {TextScale = 0.085F});
center.AddChild(new Paragraph(Anchor.AutoCenter, 1, p => attraction.Value.GetGenerationRate() + "<i ticket>/s", true) {TextScale = 0.08F});
button.AddChild(new Image(Anchor.CenterLeft, new Vector2(40), attraction.Value.TextureRegion) {
button.OnUpdated += (e, time) => button.IsDisabled = GameImpl.Instance.Tickets < price;
button.AddChild(new Image(Anchor.CenterLeft, new Vector2(0.2F, 40), attraction.Value.TextureRegion) {
Padding = new Vector2(4)
});
button.AddChild(new Paragraph(Anchor.CenterRight, 1, p => PrettyPrintNumber(price) + "<i ticket>", true));
var right = button.AddChild(new Group(Anchor.TopRight, new Vector2(0.8F, 1), false) {CanBeMoused = false});
right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(attraction.Key), true));
right.AddChild(new Paragraph(Anchor.BottomLeft, 1, p => attraction.Value.GetGenerationRate() + "<i ticket>/s", true) {TextScale = 0.08F});
right.AddChild(new Paragraph(Anchor.BottomRight, 1, p => PrettyPrintNumber(price) + "<i ticket>", true));
}
this.uiSystem.Add("Buy", buyUi);
@ -262,16 +260,16 @@ namespace TouchyTickets {
center.AddChild(new Paragraph(Anchor.AutoCenter, 10000, "A game by Ellpeck", true));
this.uiSystem.Add("Splash", splash).Priority = 100000;
while (center.DrawAlpha < 1) {
center.DrawAlpha += 0.01F;
center.DrawAlpha += 0.015F;
yield return new WaitEvent(CoroutineEvents.Update);
}
yield return new WaitSeconds(1);
while (center.DrawAlpha > 0) {
center.DrawAlpha -= 0.01F;
center.DrawAlpha -= 0.015F;
yield return new WaitEvent(CoroutineEvents.Update);
}
while (splash.DrawAlpha > 0) {
splash.DrawAlpha -= 0.01F;
splash.DrawAlpha -= 0.015F;
yield return new WaitEvent(CoroutineEvents.Update);
}
this.uiSystem.Remove(splash.Root.Name);
@ -342,11 +340,11 @@ namespace TouchyTickets {
button.OnUpdated += (e, time) => HideAndDisable();
HideAndDisable();
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) {
Padding = new Vector2(4)
});
var right = button.AddChild(new Group(Anchor.TopRight, new Vector2(0.8F, 1)) {CanBeMoused = false});
right.AddChild(new Paragraph(Anchor.TopLeft, 1, Localization.Get(upgrade.Name), true));
right.AddChild(new Paragraph(Anchor.TopRight, 1, p => upgrade.Price + "<i star>", true));
right.AddChild(new Paragraph(Anchor.AutoLeft, 1, Localization.Get(upgrade.Name + "Description"), true) {TextScale = 0.08F});
}