added swipe indicator

This commit is contained in:
Ellpeck 2020-06-30 16:30:19 +02:00
parent e93f9ac900
commit 14158b700e
2 changed files with 32 additions and 0 deletions

View file

@ -95,3 +95,6 @@
#begin Localization/Localization.nl.json
/copy:Localization/Localization.nl.json
#begin Localization/News.nl.json
/copy:Localization/News.nl.json

View file

@ -401,6 +401,35 @@ namespace TouchyTickets {
this.uiSystem.Add("Options", optionsUi);
this.swipeRelations = new Element[] {optionsUi, upgradeUi, main, buyUi, modifierUi};
var swipeTimer = 0D;
var swipeInfo = new Group(Anchor.BottomCenter, Vector2.One) {
PositionOffset = new Vector2(0, 10),
SetWidthBasedOnChildren = true,
CanBeMoused = false,
OnUpdated = (e, time) => {
if (this.swipeProgress == 0) {
if (swipeTimer > 0) {
swipeTimer -= 0.04F;
} else if (e.DrawAlpha > 0) {
e.DrawAlpha -= 0.05F;
}
} else {
swipeTimer = 1;
if (e.DrawAlpha < 1)
e.DrawAlpha += 0.05F;
}
}
};
foreach (var ui in this.swipeRelations) {
var tex = new TextureRegion(GameImpl.Instance.SpriteBatch.GetBlankTexture());
swipeInfo.AddChild(new Image(Anchor.AutoInlineIgnoreOverflow, new Vector2(12, 6), tex) {
MaintainImageAspect = false,
Padding = new Vector2(1),
OnUpdated = (e, time) => ((Image) e).DrawAlpha = this.currentUi == ui ? 1 : 0.35F
});
}
this.uiSystem.Add("SwipeInfo", swipeInfo).Priority = 200;
}
public void Update(GameTime time) {