1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 00:43:25 +08:00

Revert most unnecessary changes

Turns out `AlwaysPresent` at top level is actually enough.

This reverts commit 86163d2225.
This commit is contained in:
Dean Herbert 2022-06-13 23:54:43 +09:00
parent 86163d2225
commit bd9ea9bd6f
3 changed files with 41 additions and 33 deletions

View File

@ -400,9 +400,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
{ {
const int arrow_move_duration = 800; const int arrow_move_duration = 800;
const int judgement_fade_in_duration = 100;
const int judgement_fade_out_duration = 5000;
if (!judgement.IsHit || judgement.HitObject.HitWindows?.WindowFor(HitResult.Miss) == 0) if (!judgement.IsHit || judgement.HitObject.HitWindows?.WindowFor(HitResult.Miss) == 0)
return; return;
@ -423,26 +420,12 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
} }
} }
var judgementLine = new JudgementLine judgementsContainer.Add(new JudgementLine
{ {
JudgementLineThickness = { BindTarget = JudgementLineThickness }, JudgementLineThickness = { BindTarget = JudgementLineThickness },
Y = getRelativeJudgementPosition(judgement.TimeOffset), Y = getRelativeJudgementPosition(judgement.TimeOffset),
Colour = GetColourForHitResult(judgement.Type), Colour = GetColourForHitResult(judgement.Type),
Alpha = 0, });
Width = 0,
};
judgementsContainer.Add(judgementLine);
// Importantly, transforms should be applied in this method rather than constructed drawables
// to ensure that they are applied even when the `HitErrorMeter` is hidden (see `AlwaysPresent` usage).
judgementLine
.FadeTo(0.6f, judgement_fade_in_duration, Easing.OutQuint)
.ResizeWidthTo(1, judgement_fade_in_duration, Easing.OutQuint)
.Then()
.FadeOut(judgement_fade_out_duration)
.ResizeWidthTo(0, judgement_fade_out_duration, Easing.InQuint)
.Expire();
arrow.MoveToY( arrow.MoveToY(
getRelativeJudgementPosition(floatingAverage = floatingAverage * 0.9 + judgement.TimeOffset * 0.1) getRelativeJudgementPosition(floatingAverage = floatingAverage * 0.9 + judgement.TimeOffset * 0.1)
@ -473,9 +456,23 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
protected override void LoadComplete() protected override void LoadComplete()
{ {
const int judgement_fade_in_duration = 100;
const int judgement_fade_out_duration = 5000;
base.LoadComplete(); base.LoadComplete();
Alpha = 0;
Width = 0;
JudgementLineThickness.BindValueChanged(thickness => Height = thickness.NewValue, true); JudgementLineThickness.BindValueChanged(thickness => Height = thickness.NewValue, true);
this
.FadeTo(0.6f, judgement_fade_in_duration, Easing.OutQuint)
.ResizeWidthTo(1, judgement_fade_in_duration, Easing.OutQuint)
.Then()
.FadeOut(judgement_fade_out_duration)
.ResizeWidthTo(0, judgement_fade_out_duration, Easing.InQuint)
.Expire();
} }
} }

View File

@ -51,37 +51,47 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
Direction = FillDirection.Vertical; Direction = FillDirection.Vertical;
LayoutDuration = animation_duration; LayoutDuration = animation_duration;
LayoutEasing = Easing.OutQuint; LayoutEasing = Easing.OutQuint;
AlwaysPresent = true;
} }
public void Push(Color4 colour) public void Push(Color4 colour)
{ {
var hitErrorCircle = new HitErrorCircle(colour); Add(new HitErrorCircle(colour, drawable_judgement_size));
Add(hitErrorCircle);
hitErrorCircle.FadeInFromZero(animation_duration, Easing.OutQuint);
hitErrorCircle.MoveToY(-drawable_judgement_size);
hitErrorCircle.MoveToY(0, animation_duration, Easing.OutQuint);
if (Children.Count > MAX_DISPLAYED_JUDGEMENTS) if (Children.Count > MAX_DISPLAYED_JUDGEMENTS)
Children.FirstOrDefault(c => !c.IsRemoved)?.Remove(); Children.FirstOrDefault(c => !c.IsRemoved)?.Remove();
} }
} }
internal class HitErrorCircle : Circle internal class HitErrorCircle : Container
{ {
public bool IsRemoved { get; private set; } public bool IsRemoved { get; private set; }
public HitErrorCircle(Color4 colour) private readonly Circle circle;
public HitErrorCircle(Color4 colour, int size)
{ {
Colour = colour; Size = new Vector2(size);
Size = new Vector2(drawable_judgement_size); Child = circle = new Circle
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
Colour = colour
};
}
protected override void LoadComplete()
{
base.LoadComplete();
circle.FadeInFromZero(animation_duration, Easing.OutQuint);
circle.MoveToY(-DrawSize.Y);
circle.MoveToY(0, animation_duration, Easing.OutQuint);
} }
public void Remove() public void Remove()
{ {
IsRemoved = true; IsRemoved = true;
this.FadeOut(animation_duration, Easing.OutQuint).Expire(); this.FadeOut(animation_duration, Easing.OutQuint).Expire();
} }
} }

View File

@ -31,14 +31,15 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
private void load(DrawableRuleset drawableRuleset) private void load(DrawableRuleset drawableRuleset)
{ {
HitWindows = drawableRuleset?.FirstAvailableHitWindows ?? HitWindows.Empty; HitWindows = drawableRuleset?.FirstAvailableHitWindows ?? HitWindows.Empty;
// This is to allow the visual state to be correct after HUD comes visible after being hidden.
AlwaysPresent = true;
} }
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
AlwaysPresent = true;
if (gameplayClockContainer != null) if (gameplayClockContainer != null)
gameplayClockContainer.OnSeek += Clear; gameplayClockContainer.OnSeek += Clear;