mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Move logic inside of HUDOverlay
Add vertical offset adjust.
This commit is contained in:
@ -23,7 +23,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public class HUDOverlay : Container
|
public class HUDOverlay : Container
|
||||||
{
|
{
|
||||||
private const int duration = 100;
|
private const int duration = 250;
|
||||||
|
private const Easing easing = Easing.OutQuint;
|
||||||
|
|
||||||
public readonly KeyCounterDisplay KeyCounter;
|
public readonly KeyCounterDisplay KeyCounter;
|
||||||
public readonly RollingCounter<int> ComboCounter;
|
public readonly RollingCounter<int> ComboCounter;
|
||||||
@ -35,6 +36,8 @@ namespace osu.Game.Screens.Play
|
|||||||
public readonly HoldForMenuButton HoldToQuit;
|
public readonly HoldForMenuButton HoldToQuit;
|
||||||
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
||||||
|
|
||||||
|
public Bindable<bool> ShowHealthbar = new Bindable<bool>(true);
|
||||||
|
|
||||||
private readonly ScoreProcessor scoreProcessor;
|
private readonly ScoreProcessor scoreProcessor;
|
||||||
private readonly DrawableRuleset drawableRuleset;
|
private readonly DrawableRuleset drawableRuleset;
|
||||||
private readonly IReadOnlyList<Mod> mods;
|
private readonly IReadOnlyList<Mod> mods;
|
||||||
@ -47,6 +50,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public Action<double> RequestSeek;
|
public Action<double> RequestSeek;
|
||||||
|
|
||||||
|
private readonly Container topScoreContainer;
|
||||||
|
|
||||||
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
this.scoreProcessor = scoreProcessor;
|
this.scoreProcessor = scoreProcessor;
|
||||||
@ -62,11 +67,10 @@ namespace osu.Game.Screens.Play
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
topScoreContainer = new Container
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Y = 30,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
AutoSizeDuration = 200,
|
AutoSizeDuration = 200,
|
||||||
AutoSizeEasing = Easing.Out,
|
AutoSizeEasing = Easing.Out,
|
||||||
@ -113,8 +117,21 @@ namespace osu.Game.Screens.Play
|
|||||||
ModDisplay.Current.Value = mods;
|
ModDisplay.Current.Value = mods;
|
||||||
|
|
||||||
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
|
showHud = config.GetBindable<bool>(OsuSetting.ShowInterface);
|
||||||
showHud.ValueChanged += visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration);
|
showHud.BindValueChanged(visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration, easing), true);
|
||||||
showHud.TriggerChange();
|
|
||||||
|
ShowHealthbar.BindValueChanged(healthBar =>
|
||||||
|
{
|
||||||
|
if (healthBar.NewValue)
|
||||||
|
{
|
||||||
|
HealthDisplay.FadeIn(duration, easing);
|
||||||
|
topScoreContainer.MoveToY(30, duration, easing);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HealthDisplay.FadeOut(duration, easing);
|
||||||
|
topScoreContainer.MoveToY(0, duration, easing);
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
|
||||||
if (!showHud.Value && !hasShownNotificationOnce)
|
if (!showHud.Value && !hasShownNotificationOnce)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user