mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 17:52:56 +08:00
Make HudOverlay not dependent on Ruleset.
This commit is contained in:
parent
75a5da62d0
commit
529cabb001
@ -10,7 +10,6 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Modes.Objects;
|
using osu.Game.Modes.Objects;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
@ -24,7 +23,7 @@ namespace osu.Game.Modes.UI
|
|||||||
|
|
||||||
private Bindable<bool> showKeyCounter;
|
private Bindable<bool> showKeyCounter;
|
||||||
|
|
||||||
protected abstract KeyCounterCollection CreateKeyCounter(IEnumerable<KeyCounter> keyCounters);
|
protected abstract KeyCounterCollection CreateKeyCounter();
|
||||||
protected abstract ComboCounter CreateComboCounter();
|
protected abstract ComboCounter CreateComboCounter();
|
||||||
protected abstract PercentageCounter CreateAccuracyCounter();
|
protected abstract PercentageCounter CreateAccuracyCounter();
|
||||||
protected abstract ScoreCounter CreateScoreCounter();
|
protected abstract ScoreCounter CreateScoreCounter();
|
||||||
@ -43,13 +42,13 @@ namespace osu.Game.Modes.UI
|
|||||||
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HudOverlay(Ruleset ruleset)
|
protected HudOverlay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
KeyCounter = CreateKeyCounter(ruleset.CreateGameplayKeys()),
|
KeyCounter = CreateKeyCounter(),
|
||||||
ComboCounter = CreateComboCounter(),
|
ComboCounter = CreateComboCounter(),
|
||||||
ScoreCounter = CreateScoreCounter(),
|
ScoreCounter = CreateScoreCounter(),
|
||||||
AccuracyCounter = CreateAccuracyCounter(),
|
AccuracyCounter = CreateAccuracyCounter(),
|
||||||
|
@ -6,17 +6,11 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace osu.Game.Modes.UI
|
namespace osu.Game.Modes.UI
|
||||||
{
|
{
|
||||||
public class StandardHudOverlay : HudOverlay
|
public class StandardHudOverlay : HudOverlay
|
||||||
{
|
{
|
||||||
public StandardHudOverlay(Ruleset ruleset)
|
|
||||||
: base(ruleset)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
|
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -39,14 +33,13 @@ namespace osu.Game.Modes.UI
|
|||||||
Margin = new MarginPadding { Top = 20 }
|
Margin = new MarginPadding { Top = 20 }
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override KeyCounterCollection CreateKeyCounter(IEnumerable<KeyCounter> keyCounters) => new KeyCounterCollection
|
protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
|
||||||
{
|
{
|
||||||
IsCounting = true,
|
IsCounting = true,
|
||||||
FadeTime = 50,
|
FadeTime = 50,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
Margin = new MarginPadding(10),
|
Margin = new MarginPadding(10),
|
||||||
Children = keyCounters
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
|
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
|
||||||
|
@ -112,7 +112,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
|
ruleset = Ruleset.GetRuleset(Beatmap.PlayMode);
|
||||||
|
|
||||||
hudOverlay = new StandardHudOverlay(ruleset);
|
hudOverlay = new StandardHudOverlay();
|
||||||
|
hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys());
|
||||||
hudOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
|
hudOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
|
||||||
|
|
||||||
pauseOverlay = new PauseOverlay
|
pauseOverlay = new PauseOverlay
|
||||||
|
Loading…
Reference in New Issue
Block a user