mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Implement basic layout for AccuracyBar
This commit is contained in:
19
osu.Game/Screens/Play/HUD/AccuracyBar.cs
Normal file
19
osu.Game/Screens/Play/HUD/AccuracyBar.cs
Normal 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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play
|
|||||||
public readonly ModDisplay ModDisplay;
|
public readonly ModDisplay ModDisplay;
|
||||||
public readonly HoldForMenuButton HoldToQuit;
|
public readonly HoldForMenuButton HoldToQuit;
|
||||||
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
||||||
|
public readonly AccuracyBar LeftAccuracyBar;
|
||||||
|
public readonly AccuracyBar RightAccuracyBar;
|
||||||
|
|
||||||
public Bindable<bool> ShowHealthbar = new Bindable<bool>(true);
|
public Bindable<bool> ShowHealthbar = new Bindable<bool>(true);
|
||||||
|
|
||||||
@ -84,6 +86,8 @@ namespace osu.Game.Screens.Play
|
|||||||
HealthDisplay = CreateHealthDisplay(),
|
HealthDisplay = CreateHealthDisplay(),
|
||||||
Progress = CreateProgress(),
|
Progress = CreateProgress(),
|
||||||
ModDisplay = CreateModsContainer(),
|
ModDisplay = CreateModsContainer(),
|
||||||
|
LeftAccuracyBar = CreateAccuracyBar(false),
|
||||||
|
RightAccuracyBar = CreateAccuracyBar(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
|
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
|
||||||
@ -256,6 +260,15 @@ namespace osu.Game.Screens.Play
|
|||||||
Margin = new MarginPadding { Top = 20, Right = 10 },
|
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 PlayerSettingsOverlay CreatePlayerSettingsOverlay() => new PlayerSettingsOverlay();
|
||||||
|
|
||||||
protected virtual void BindProcessor(ScoreProcessor processor)
|
protected virtual void BindProcessor(ScoreProcessor processor)
|
||||||
@ -265,6 +278,12 @@ namespace osu.Game.Screens.Play
|
|||||||
ComboCounter?.Current.BindTo(processor.Combo);
|
ComboCounter?.Current.BindTo(processor.Combo);
|
||||||
HealthDisplay?.Current.BindTo(processor.Health);
|
HealthDisplay?.Current.BindTo(processor.Health);
|
||||||
|
|
||||||
|
if (LeftAccuracyBar != null)
|
||||||
|
processor.NewJudgement += LeftAccuracyBar.OnNewJudgement;
|
||||||
|
|
||||||
|
if (RightAccuracyBar != null)
|
||||||
|
processor.NewJudgement += RightAccuracyBar.OnNewJudgement;
|
||||||
|
|
||||||
if (HealthDisplay is StandardHealthDisplay shd)
|
if (HealthDisplay is StandardHealthDisplay shd)
|
||||||
processor.NewJudgement += shd.Flash;
|
processor.NewJudgement += shd.Flash;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user