Merge pull request #6270 from iiSaLMaN/improve-hold-button-text

Replace menu button text with "press for menu" on 0ms activation delay
This commit is contained in:
Dan Balasescu 2019-09-27 17:47:15 +09:00 committed by GitHub
commit 5405102393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -13,6 +13,7 @@
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.MathUtils;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@ -45,7 +46,6 @@ public HoldForMenuButton()
{
text = new OsuSpriteText
{
Text = "hold for menu",
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft
@ -60,9 +60,23 @@ public HoldForMenuButton()
AutoSizeAxes = Axes.Both;
}
[Resolved]
private OsuConfigManager config { get; set; }
private Bindable<int> activationDelay;
protected override void LoadComplete()
{
activationDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay);
activationDelay.BindValueChanged(v =>
{
text.Text = v.NewValue > 0
? "hold for menu"
: "press for menu";
}, true);
text.FadeInFromZero(500, Easing.OutQuint).Delay(1500).FadeOut(500, Easing.OutQuint);
base.LoadComplete();
}