1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 00:42:55 +08:00

Make HudOverlay not dependent on Ruleset.

This commit is contained in:
smoogipooo 2017-03-10 16:16:07 +09:00
parent 75a5da62d0
commit 529cabb001
3 changed files with 6 additions and 13 deletions

View File

@ -10,7 +10,6 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Modes.Objects;
using osu.Game.Screens.Play;
using System;
using System.Collections.Generic;
namespace osu.Game.Modes.UI
{
@ -24,7 +23,7 @@ namespace osu.Game.Modes.UI
private Bindable<bool> showKeyCounter;
protected abstract KeyCounterCollection CreateKeyCounter(IEnumerable<KeyCounter> keyCounters);
protected abstract KeyCounterCollection CreateKeyCounter();
protected abstract ComboCounter CreateComboCounter();
protected abstract PercentageCounter CreateAccuracyCounter();
protected abstract ScoreCounter CreateScoreCounter();
@ -43,13 +42,13 @@ namespace osu.Game.Modes.UI
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
}
protected HudOverlay(Ruleset ruleset)
protected HudOverlay()
{
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
KeyCounter = CreateKeyCounter(ruleset.CreateGameplayKeys()),
KeyCounter = CreateKeyCounter(),
ComboCounter = CreateComboCounter(),
ScoreCounter = CreateScoreCounter(),
AccuracyCounter = CreateAccuracyCounter(),

View File

@ -6,17 +6,11 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play;
using System.Collections.Generic;
namespace osu.Game.Modes.UI
{
public class StandardHudOverlay : HudOverlay
{
public StandardHudOverlay(Ruleset ruleset)
: base(ruleset)
{
}
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
{
Anchor = Anchor.TopCentre,
@ -39,14 +33,13 @@ namespace osu.Game.Modes.UI
Margin = new MarginPadding { Top = 20 }
};
protected override KeyCounterCollection CreateKeyCounter(IEnumerable<KeyCounter> keyCounters) => new KeyCounterCollection
protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection
{
IsCounting = true,
FadeTime = 50,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding(10),
Children = keyCounters
};
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6)

View File

@ -112,7 +112,8 @@ namespace osu.Game.Screens.Play
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));
pauseOverlay = new PauseOverlay