mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 18:52:55 +08:00
Merge pull request #26542 from peppy/non-touch-fade-button
Fade hold-for-menu button out completely on non-touch devices
This commit is contained in:
commit
2be989b9f5
@ -16,6 +16,7 @@ using osu.Framework.Input.Bindings;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -44,6 +45,8 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
Direction = FillDirection.Horizontal;
|
Direction = FillDirection.Horizontal;
|
||||||
Spacing = new Vector2(20, 0);
|
Spacing = new Vector2(20, 0);
|
||||||
Margin = new MarginPadding(10);
|
Margin = new MarginPadding(10);
|
||||||
|
|
||||||
|
AlwaysPresent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
@ -66,9 +69,15 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
Action = () => Action(),
|
Action = () => Action(),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private SessionStatics sessionStatics { get; set; }
|
||||||
|
|
||||||
|
private Bindable<bool> touchActive;
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
button.HoldActivationDelay.BindValueChanged(v =>
|
button.HoldActivationDelay.BindValueChanged(v =>
|
||||||
@ -78,7 +87,20 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
: "press for menu";
|
: "press for menu";
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
text.FadeInFromZero(500, Easing.OutQuint).Delay(1500).FadeOut(500, Easing.OutQuint);
|
touchActive = sessionStatics.GetBindable<bool>(Static.TouchInputActive);
|
||||||
|
|
||||||
|
if (touchActive.Value)
|
||||||
|
{
|
||||||
|
Alpha = 1f;
|
||||||
|
text.FadeInFromZero(500, Easing.OutQuint)
|
||||||
|
.Delay(1500)
|
||||||
|
.FadeOut(500, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alpha = 0;
|
||||||
|
text.Alpha = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
@ -99,9 +121,11 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
Alpha = 1;
|
Alpha = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
float minAlpha = touchActive.Value ? .08f : 0;
|
||||||
|
|
||||||
Alpha = Interpolation.ValueAt(
|
Alpha = Interpolation.ValueAt(
|
||||||
Math.Clamp(Clock.ElapsedFrameTime, 0, 200),
|
Math.Clamp(Clock.ElapsedFrameTime, 0, 200),
|
||||||
Alpha, Math.Clamp(1 - positionalAdjust, 0.04f, 1), 0, 200, Easing.OutQuint);
|
Alpha, Math.Clamp(1 - positionalAdjust, minAlpha, 1), 0, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user