mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 18:42:56 +08:00
Reverse display, add animation and reduce width
This commit is contained in:
parent
a73d672c2f
commit
54696eef39
@ -27,6 +27,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
};
|
};
|
||||||
|
|
||||||
private HitErrorMeter meter;
|
private HitErrorMeter meter;
|
||||||
|
private HitErrorMeter meter2;
|
||||||
|
|
||||||
public TestSceneBarHitErrorMeter()
|
public TestSceneBarHitErrorMeter()
|
||||||
{
|
{
|
||||||
@ -109,8 +110,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
Add(new FillFlowContainer
|
Add(new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.Centre,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
@ -121,20 +122,29 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(meter = new BarHitErrorMeter(hitWindows)
|
Add(meter = new BarHitErrorMeter(hitWindows, true)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.CentreRight,
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(meter2 = new BarHitErrorMeter(hitWindows, false)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void newJudgement(double offset = 0)
|
private void newJudgement(double offset = 0)
|
||||||
{
|
{
|
||||||
meter?.OnNewJudgement(new JudgementResult(new Judgement())
|
var judgement = new JudgementResult(new Judgement())
|
||||||
{
|
{
|
||||||
TimeOffset = offset == 0 ? RNG.Next(-150, 150) : offset,
|
TimeOffset = offset == 0 ? RNG.Next(-150, 150) : offset,
|
||||||
Type = HitResult.Perfect,
|
Type = HitResult.Perfect,
|
||||||
});
|
};
|
||||||
|
|
||||||
|
meter.OnNewJudgement(judgement);
|
||||||
|
meter2.OnNewJudgement(judgement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,19 +25,19 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
|
|
||||||
private const int arrow_move_duration = 400;
|
private const int arrow_move_duration = 400;
|
||||||
|
|
||||||
private const int judgement_line_width = 8;
|
private const int judgement_line_width = 6;
|
||||||
|
|
||||||
private const int bar_height = 200;
|
private const int bar_height = 200;
|
||||||
|
|
||||||
private const int bar_width = 3;
|
private const int bar_width = 2;
|
||||||
|
|
||||||
private const int spacing = 3;
|
private const int spacing = 2;
|
||||||
|
|
||||||
private readonly SpriteIcon arrow;
|
private SpriteIcon arrow;
|
||||||
|
|
||||||
private readonly FillFlowContainer<Box> bar;
|
private FillFlowContainer<Box> colourBarFlow;
|
||||||
|
|
||||||
private readonly Container judgementsContainer;
|
private Container judgementsContainer;
|
||||||
|
|
||||||
private readonly double maxHitWindow;
|
private readonly double maxHitWindow;
|
||||||
|
|
||||||
@ -48,34 +48,39 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
maxHitWindow = Math.Max(Math.Max(HitWindows.Meh, HitWindows.Ok), HitWindows.Good);
|
maxHitWindow = Math.Max(Math.Max(HitWindows.Meh, HitWindows.Ok), HitWindows.Good);
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
AddInternal(new FillFlowContainer
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Height = bar_height,
|
Height = bar_height,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(spacing, 0),
|
Spacing = new Vector2(spacing, 0),
|
||||||
|
Margin = new MarginPadding(2),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
judgementsContainer = new Container
|
judgementsContainer = new Container
|
||||||
{
|
{
|
||||||
Anchor = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
|
Anchor = rightAligned ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||||
Origin = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
|
Origin = rightAligned ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||||
Width = judgement_line_width,
|
Width = judgement_line_width,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
},
|
},
|
||||||
bar = new FillFlowContainer<Box>
|
colourBarFlow = new FillFlowContainer<Box>
|
||||||
{
|
{
|
||||||
Anchor = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
|
Anchor = rightAligned ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||||
Origin = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
|
Origin = rightAligned ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||||
Width = bar_width,
|
Width = bar_width,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Anchor = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
|
Anchor = rightAligned ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||||
Origin = rightAligned ? Anchor.CentreRight : Anchor.CentreLeft,
|
Origin = rightAligned ? Anchor.CentreLeft : Anchor.CentreRight,
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Child = arrow = new SpriteIcon
|
Child = arrow = new SpriteIcon
|
||||||
@ -84,20 +89,16 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativePositionAxes = Axes.Y,
|
RelativePositionAxes = Axes.Y,
|
||||||
Y = 0.5f,
|
Y = 0.5f,
|
||||||
Icon = rightAligned ? FontAwesome.Solid.ChevronRight : FontAwesome.Solid.ChevronLeft,
|
Icon = rightAligned ? FontAwesome.Solid.ChevronLeft : FontAwesome.Solid.ChevronRight,
|
||||||
Size = new Vector2(8),
|
Size = new Vector2(8),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
if (HitWindows.Meh != 0)
|
if (HitWindows.Meh != 0)
|
||||||
{
|
{
|
||||||
bar.AddRange(new[]
|
colourBarFlow.AddRange(new[]
|
||||||
{
|
{
|
||||||
createColoredPiece(ColourInfo.GradientVertical(colours.Yellow.Opacity(0), colours.Yellow), (maxHitWindow - HitWindows.Good) / (maxHitWindow * 2)),
|
createColoredPiece(ColourInfo.GradientVertical(colours.Yellow.Opacity(0), colours.Yellow), (maxHitWindow - HitWindows.Good) / (maxHitWindow * 2)),
|
||||||
createColoredPiece(colours.Green, (HitWindows.Good - HitWindows.Great) / (maxHitWindow * 2)),
|
createColoredPiece(colours.Green, (HitWindows.Good - HitWindows.Great) / (maxHitWindow * 2)),
|
||||||
@ -108,7 +109,7 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bar.AddRange(new[]
|
colourBarFlow.AddRange(new[]
|
||||||
{
|
{
|
||||||
createColoredPiece(ColourInfo.GradientVertical(colours.Green.Opacity(0), colours.Green), (HitWindows.Good - HitWindows.Great) / (maxHitWindow * 2)),
|
createColoredPiece(ColourInfo.GradientVertical(colours.Green.Opacity(0), colours.Green), (HitWindows.Good - HitWindows.Great) / (maxHitWindow * 2)),
|
||||||
createColoredPiece(colours.BlueLight, HitWindows.Great / maxHitWindow),
|
createColoredPiece(colours.BlueLight, HitWindows.Great / maxHitWindow),
|
||||||
@ -117,6 +118,16 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
colourBarFlow.Height = 0;
|
||||||
|
colourBarFlow.ResizeHeightTo(1, 400, Easing.OutQuint);
|
||||||
|
|
||||||
|
arrow.FadeInFromZero(400);
|
||||||
|
}
|
||||||
|
|
||||||
private Box createColoredPiece(ColourInfo colour, double height) => new Box
|
private Box createColoredPiece(ColourInfo colour, double height) => new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -134,8 +145,8 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
judgementsContainer.Add(new JudgementLine
|
judgementsContainer.Add(new JudgementLine
|
||||||
{
|
{
|
||||||
Y = getRelativeJudgementPosition(judgement.TimeOffset),
|
Y = getRelativeJudgementPosition(judgement.TimeOffset),
|
||||||
Anchor = rightAligned ? Anchor.TopLeft : Anchor.TopRight,
|
Anchor = rightAligned ? Anchor.TopRight : Anchor.TopLeft,
|
||||||
Origin = rightAligned ? Anchor.TopLeft : Anchor.TopRight,
|
Origin = rightAligned ? Anchor.TopRight : Anchor.TopLeft,
|
||||||
});
|
});
|
||||||
|
|
||||||
arrow.MoveToY(getRelativeJudgementPosition(floatingAverage = floatingAverage * 0.9 + judgement.TimeOffset * 0.1)
|
arrow.MoveToY(getRelativeJudgementPosition(floatingAverage = floatingAverage * 0.9 + judgement.TimeOffset * 0.1)
|
||||||
|
Loading…
Reference in New Issue
Block a user