mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Simplify bar building
This commit is contained in:
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
private const int spacing = 3;
|
private const int spacing = 3;
|
||||||
|
|
||||||
private readonly SpriteIcon arrow;
|
private readonly SpriteIcon arrow;
|
||||||
private readonly FillFlowContainer bar;
|
private readonly FillFlowContainer<Box> bar;
|
||||||
private readonly Container judgementsContainer;
|
private readonly Container judgementsContainer;
|
||||||
private readonly Queue<double> judgementOffsets = new Queue<double>();
|
private readonly Queue<double> judgementOffsets = new Queue<double>();
|
||||||
private readonly double maxHitWindows;
|
private readonly double maxHitWindows;
|
||||||
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
Width = judgement_line_width,
|
Width = judgement_line_width,
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
},
|
},
|
||||||
bar = new FillFlowContainer
|
bar = new FillFlowContainer<Box>
|
||||||
{
|
{
|
||||||
Anchor = reversed ? Anchor.CentreRight : Anchor.CentreLeft,
|
Anchor = reversed ? Anchor.CentreRight : Anchor.CentreLeft,
|
||||||
Origin = reversed ? Anchor.CentreRight : Anchor.CentreLeft,
|
Origin = reversed ? Anchor.CentreRight : Anchor.CentreLeft,
|
||||||
@ -85,54 +85,39 @@ namespace osu.Game.Screens.Play.HitErrorDisplay
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Box topGreenBox;
|
|
||||||
Box bottomGreenBox;
|
|
||||||
|
|
||||||
if (HitWindows.Meh != 0)
|
if (HitWindows.Meh != 0)
|
||||||
bar.Add(new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = ColourInfo.GradientVertical(colours.Yellow.Opacity(0), colours.Yellow),
|
|
||||||
Height = (float)((maxHitWindows - HitWindows.Good) / (maxHitWindows * 2))
|
|
||||||
});
|
|
||||||
|
|
||||||
bar.AddRange(new Drawable[]
|
|
||||||
{
|
{
|
||||||
topGreenBox = new Box
|
bar.AddRange(new[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
createColoredPiece(ColourInfo.GradientVertical(colours.Yellow.Opacity(0), colours.Yellow),
|
||||||
Colour = colours.Green,
|
(maxHitWindows - HitWindows.Good) / (maxHitWindows * 2)),
|
||||||
Height = (float)((HitWindows.Good - HitWindows.Great) / (maxHitWindows * 2))
|
createColoredPiece(colours.Green, (HitWindows.Good - HitWindows.Great) / (maxHitWindows * 2)),
|
||||||
},
|
createColoredPiece(colours.BlueLight, HitWindows.Great / maxHitWindows),
|
||||||
new Box
|
createColoredPiece(colours.Green, (HitWindows.Good - HitWindows.Great) / (maxHitWindows * 2)),
|
||||||
{
|
createColoredPiece(ColourInfo.GradientVertical(colours.Yellow, colours.Yellow.Opacity(0)),
|
||||||
RelativeSizeAxes = Axes.Both,
|
(maxHitWindows - HitWindows.Good) / (maxHitWindows * 2))
|
||||||
Colour = colours.BlueLight,
|
|
||||||
Height = (float)(HitWindows.Great / maxHitWindows)
|
|
||||||
},
|
|
||||||
bottomGreenBox = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = colours.Green,
|
|
||||||
Height = (float)((HitWindows.Good - HitWindows.Great) / (maxHitWindows * 2))
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (HitWindows.Meh != 0)
|
|
||||||
bar.Add(new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = ColourInfo.GradientVertical(colours.Yellow, colours.Yellow.Opacity(0)),
|
|
||||||
Height = (float)((maxHitWindows - HitWindows.Good) / (maxHitWindows * 2))
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
if (HitWindows.Meh == 0)
|
else
|
||||||
{
|
{
|
||||||
topGreenBox.Colour = ColourInfo.GradientVertical(colours.Green.Opacity(0), colours.Green);
|
bar.AddRange(new[]
|
||||||
bottomGreenBox.Colour = ColourInfo.GradientVertical(colours.Green, colours.Green.Opacity(0));
|
{
|
||||||
|
createColoredPiece(ColourInfo.GradientVertical(colours.Green.Opacity(0), colours.Green),
|
||||||
|
(HitWindows.Good - HitWindows.Great) / (maxHitWindows * 2)),
|
||||||
|
createColoredPiece(colours.BlueLight, HitWindows.Great / maxHitWindows),
|
||||||
|
createColoredPiece(ColourInfo.GradientVertical(colours.Green, colours.Green.Opacity(0)),
|
||||||
|
(HitWindows.Good - HitWindows.Great) / (maxHitWindows * 2)),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Box createColoredPiece(ColourInfo colour, double height) => new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colour,
|
||||||
|
Height = (float)height
|
||||||
|
};
|
||||||
|
|
||||||
public override void OnNewJudgement(JudgementResult newJudgement)
|
public override void OnNewJudgement(JudgementResult newJudgement)
|
||||||
{
|
{
|
||||||
if (!newJudgement.IsHit)
|
if (!newJudgement.IsHit)
|
||||||
|
Reference in New Issue
Block a user