Move HitErrorDisplayOverlay back to the HUD

This commit is contained in:
Andrei Zavatski 2019-08-20 08:45:51 +03:00
parent d337f9b482
commit 9f64e09625
6 changed files with 16 additions and 17 deletions

View File

@ -115,7 +115,7 @@ private void recreateDisplay(HitWindows hitWindows, float overallDifficulty)
}
});
Add(display = new BarHitErrorDisplay(overallDifficulty, hitWindows)
Add(display = new BarHitErrorDisplay(hitWindows)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -15,6 +15,7 @@
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play.HitErrorDisplay;
using osu.Game.Screens.Play.HUD;
using osuTK;
using osuTK.Input;
@ -33,6 +34,7 @@ public class HUDOverlay : Container
public readonly HealthDisplay HealthDisplay;
public readonly SongProgress Progress;
public readonly ModDisplay ModDisplay;
public readonly HitErrorDisplayOverlay HitErrorDisplayOverlay;
public readonly HoldForMenuButton HoldToQuit;
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
@ -84,6 +86,7 @@ public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset
HealthDisplay = CreateHealthDisplay(),
Progress = CreateProgress(),
ModDisplay = CreateModsContainer(),
HitErrorDisplayOverlay = CreateHitErrorDisplayOverlay(),
}
},
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
@ -256,6 +259,11 @@ protected override bool OnKeyDown(KeyDownEvent e)
Margin = new MarginPadding { Top = 20, Right = 10 },
};
protected virtual HitErrorDisplayOverlay CreateHitErrorDisplayOverlay() => new HitErrorDisplayOverlay(scoreProcessor)
{
RelativeSizeAxes = Axes.Both,
};
protected virtual PlayerSettingsOverlay CreatePlayerSettingsOverlay() => new PlayerSettingsOverlay();
protected virtual void BindProcessor(ScoreProcessor processor)

View File

@ -34,8 +34,8 @@ public class BarHitErrorDisplay : HitErrorDisplay
private readonly Queue<double> judgementOffsets = new Queue<double>();
private readonly double maxHitWindows;
public BarHitErrorDisplay(float overallDifficulty, HitWindows hitWindows, bool reversed = false)
: base(overallDifficulty, hitWindows)
public BarHitErrorDisplay(HitWindows hitWindows, bool reversed = false)
: base(hitWindows)
{
maxHitWindows = HitWindows.Meh == 0 ? HitWindows.Good : HitWindows.Meh;

View File

@ -11,10 +11,9 @@ public abstract class HitErrorDisplay : CompositeDrawable
{
protected readonly HitWindows HitWindows;
protected HitErrorDisplay(float overallDifficulty, HitWindows hitWindows)
protected HitErrorDisplay(HitWindows hitWindows)
{
HitWindows = hitWindows;
HitWindows.SetDifficulty(overallDifficulty);
}
public abstract void OnNewJudgement(JudgementResult newJudgement);

View File

@ -21,22 +21,18 @@ public class HitErrorDisplayOverlay : Container<HitErrorDisplay>
private readonly Bindable<ScoreMeterType> type = new Bindable<ScoreMeterType>();
private readonly HitWindows hitWindows;
private readonly ScoreProcessor processor;
private readonly float overallDifficulty;
public HitErrorDisplayOverlay(ScoreProcessor processor, WorkingBeatmap workingBeatmap)
public HitErrorDisplayOverlay(ScoreProcessor processor)
{
this.processor = processor;
overallDifficulty = workingBeatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty;
hitWindows = processor.CreateHitWindows();
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, Bindable<WorkingBeatmap> workingBeatmap)
{
config.BindWith(OsuSetting.ScoreMeter, type);
hitWindows.SetDifficulty(workingBeatmap.Value.BeatmapInfo.BaseDifficulty.OverallDifficulty);
}
protected override void LoadComplete()
@ -80,7 +76,7 @@ private void clear()
private void createNew(bool reversed = false)
{
var display = new BarHitErrorDisplay(overallDifficulty, hitWindows, reversed)
var display = new BarHitErrorDisplay(hitWindows, reversed)
{
Margin = new MarginPadding(margin),
Anchor = reversed ? Anchor.CentreRight : Anchor.CentreLeft,

View File

@ -24,7 +24,6 @@
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Screens.Play.HitErrorDisplay;
using osu.Game.Screens.Ranking;
using osu.Game.Skinning;
using osu.Game.Users;
@ -74,8 +73,6 @@ public class Player : ScreenWithBeatmapBackground
protected HUDOverlay HUDOverlay { get; private set; }
protected HitErrorDisplayOverlay HitErrorDisplayOverlay { get; private set; }
public bool LoadedBeatmapSuccessfully => DrawableRuleset?.Objects.Any() == true;
protected GameplayClockContainer GameplayClockContainer { get; private set; }
@ -160,7 +157,6 @@ private void load(AudioManager audio, IAPIProvider api, OsuConfigManager config)
Anchor = Anchor.Centre,
Origin = Anchor.Centre
},
HitErrorDisplayOverlay = new HitErrorDisplayOverlay(ScoreProcessor, working),
new SkipOverlay(DrawableRuleset.GameplayStartTime)
{
RequestSeek = GameplayClockContainer.Seek