1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 04:13:00 +08:00

Implement basic layout for AccuracyBar

This commit is contained in:
Andrei Zavatski 2019-08-11 14:57:21 +03:00
parent 126fd4d24b
commit fd334e0319
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Judgements;
namespace osu.Game.Screens.Play.HUD
{
public class AccuracyBar : Container
{
public AccuracyBar(bool mirrored)
{
}
public void OnNewJudgement(JudgementResult judgement)
{
}
}
}

View File

@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play
public readonly ModDisplay ModDisplay;
public readonly HoldForMenuButton HoldToQuit;
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
public readonly AccuracyBar LeftAccuracyBar;
public readonly AccuracyBar RightAccuracyBar;
public Bindable<bool> ShowHealthbar = new Bindable<bool>(true);
@ -84,6 +86,8 @@ namespace osu.Game.Screens.Play
HealthDisplay = CreateHealthDisplay(),
Progress = CreateProgress(),
ModDisplay = CreateModsContainer(),
LeftAccuracyBar = CreateAccuracyBar(false),
RightAccuracyBar = CreateAccuracyBar(),
}
},
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
@ -256,6 +260,15 @@ namespace osu.Game.Screens.Play
Margin = new MarginPadding { Top = 20, Right = 10 },
};
protected virtual AccuracyBar CreateAccuracyBar(bool mirrored = true) => new AccuracyBar(mirrored)
{
Anchor = mirrored ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = mirrored ? Anchor.CentreRight : Anchor.CentreLeft,
AutoSizeAxes = Axes.X,
Height = 300,
Margin = new MarginPadding { Horizontal = 20 }
};
protected virtual PlayerSettingsOverlay CreatePlayerSettingsOverlay() => new PlayerSettingsOverlay();
protected virtual void BindProcessor(ScoreProcessor processor)
@ -265,6 +278,12 @@ namespace osu.Game.Screens.Play
ComboCounter?.Current.BindTo(processor.Combo);
HealthDisplay?.Current.BindTo(processor.Health);
if (LeftAccuracyBar != null)
processor.NewJudgement += LeftAccuracyBar.OnNewJudgement;
if (RightAccuracyBar != null)
processor.NewJudgement += RightAccuracyBar.OnNewJudgement;
if (HealthDisplay is StandardHealthDisplay shd)
processor.NewJudgement += shd.Flash;
}