mirror of
https://github.com/ppy/osu
synced 2025-02-16 10:07:11 +00:00
Fix positioning of score display in HUD overlay
This commit is contained in:
parent
e1da64398e
commit
950c47287c
@ -5,11 +5,14 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class DefaultScoreCounter : ScoreCounter
|
||||
{
|
||||
private readonly Vector2 offset = new Vector2(20, 5);
|
||||
|
||||
public DefaultScoreCounter()
|
||||
: base(6)
|
||||
{
|
||||
@ -17,10 +20,19 @@ namespace osu.Game.Screens.Play.HUD
|
||||
Origin = Anchor.TopCentre;
|
||||
}
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private HUDOverlay hud { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.BlueLighter;
|
||||
|
||||
// todo: check if default once health display is skinnable
|
||||
hud?.ShowHealthbar.BindValueChanged(healthBar =>
|
||||
{
|
||||
this.MoveToY(healthBar.NewValue ? 30 : 0, HUDOverlay.FADE_DURATION, HUDOverlay.FADE_EASING);
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,9 @@ namespace osu.Game.Screens.Play
|
||||
[Cached]
|
||||
public class HUDOverlay : Container
|
||||
{
|
||||
private const float fade_duration = 400;
|
||||
private const Easing fade_easing = Easing.Out;
|
||||
public const float FADE_DURATION = 400;
|
||||
|
||||
public const Easing FADE_EASING = Easing.Out;
|
||||
|
||||
public readonly KeyCounterDisplay KeyCounter;
|
||||
public readonly SkinnableComboCounter ComboCounter;
|
||||
@ -62,8 +63,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public Action<double> RequestSeek;
|
||||
|
||||
private readonly Container topScoreContainer;
|
||||
|
||||
private readonly FillFlowContainer bottomRightElements;
|
||||
|
||||
private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter };
|
||||
@ -96,17 +95,8 @@ namespace osu.Game.Screens.Play
|
||||
Children = new Drawable[]
|
||||
{
|
||||
HealthDisplay = CreateHealthDisplay(),
|
||||
topScoreContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
AccuracyCounter = CreateAccuracyCounter(),
|
||||
ScoreCounter = CreateScoreCounter(),
|
||||
},
|
||||
},
|
||||
AccuracyCounter = CreateAccuracyCounter(),
|
||||
ScoreCounter = CreateScoreCounter(),
|
||||
ComboCounter = CreateComboCounter(),
|
||||
ModDisplay = CreateModsContainer(),
|
||||
HitErrorDisplay = CreateHitErrorDisplayOverlay(),
|
||||
@ -132,8 +122,8 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.BottomRight,
|
||||
X = -5,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
LayoutDuration = fade_duration / 2,
|
||||
LayoutEasing = fade_easing,
|
||||
LayoutDuration = FADE_DURATION / 2,
|
||||
LayoutEasing = FADE_EASING,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -186,21 +176,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ShowHud.BindValueChanged(visible => hideTargets.ForEach(d => d.FadeTo(visible.NewValue ? 1 : 0, fade_duration, fade_easing)));
|
||||
|
||||
ShowHealthbar.BindValueChanged(healthBar =>
|
||||
{
|
||||
if (healthBar.NewValue)
|
||||
{
|
||||
HealthDisplay.FadeIn(fade_duration, fade_easing);
|
||||
topScoreContainer.MoveToY(30, fade_duration, fade_easing);
|
||||
}
|
||||
else
|
||||
{
|
||||
HealthDisplay.FadeOut(fade_duration, fade_easing);
|
||||
topScoreContainer.MoveToY(0, fade_duration, fade_easing);
|
||||
}
|
||||
}, true);
|
||||
ShowHealthbar.BindValueChanged(healthBar => HealthDisplay.FadeTo(healthBar.NewValue ? 1 : 0, FADE_DURATION, FADE_EASING), true);
|
||||
ShowHud.BindValueChanged(visible => hideTargets.ForEach(d => d.FadeTo(visible.NewValue ? 1 : 0, FADE_DURATION, FADE_EASING)));
|
||||
|
||||
configShowHud.BindValueChanged(visible =>
|
||||
{
|
||||
|
@ -28,8 +28,7 @@ namespace osu.Game.Skinning
|
||||
// base class uses int for display, but externally we bind to ScoreProcesssor as a double for now.
|
||||
Current.BindValueChanged(v => base.Current.Value = (int)v.NewValue);
|
||||
|
||||
Margin = new MarginPadding { Bottom = 10, Left = 10 };
|
||||
Scale = new Vector2(1.2f);
|
||||
Margin = new MarginPadding(10);
|
||||
}
|
||||
|
||||
protected sealed override OsuSpriteText CreateSpriteText() =>
|
||||
|
Loading…
Reference in New Issue
Block a user