mirror of
https://github.com/ppy/osu
synced 2025-03-05 02:49:30 +00:00
Do not assign hudOverlay's and breakOverlay's members in Player class
This commit is contained in:
parent
b9f4dee801
commit
3795411fd1
@ -41,6 +41,11 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
private readonly InfoContainer info;
|
||||
private readonly ArrowsOverlay arrowsOverlay;
|
||||
|
||||
public BreakOverlay(bool letterboxing, ScoreProcessor scoreProcessor) : this(letterboxing)
|
||||
{
|
||||
bindProcessor(scoreProcessor);
|
||||
}
|
||||
|
||||
public BreakOverlay(bool letterboxing)
|
||||
{
|
||||
this.letterboxing = letterboxing;
|
||||
@ -148,7 +153,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
|
||||
arrowsOverlay.Hide();
|
||||
}
|
||||
|
||||
public void BindProcessor(ScoreProcessor processor)
|
||||
private void bindProcessor(ScoreProcessor processor)
|
||||
{
|
||||
info.AccuracyDisplay.Current.BindTo(processor.Accuracy);
|
||||
info.GradeDisplay.Current.BindTo(processor.Rank);
|
||||
|
@ -6,6 +6,8 @@ using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -39,7 +41,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private static bool hasShownNotificationOnce;
|
||||
|
||||
public HUDOverlay()
|
||||
public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, DecoupleableInterpolatingFramedClock decoupledClock, WorkingBeatmap working, IAdjustableClock adjustableSourceClock)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
@ -59,6 +61,18 @@ namespace osu.Game.Screens.Play
|
||||
ReplaySettingsOverlay = CreateReplaySettingsOverlay(),
|
||||
}
|
||||
});
|
||||
|
||||
BindProcessor(scoreProcessor);
|
||||
BindRulesetContainer(rulesetContainer);
|
||||
|
||||
Progress.Objects = rulesetContainer.Objects;
|
||||
Progress.AudioClock = decoupledClock;
|
||||
Progress.AllowSeeking = rulesetContainer.HasReplayLoaded;
|
||||
Progress.OnSeek = pos => decoupledClock.Seek(pos);
|
||||
|
||||
ModDisplay.Current.BindTo(working.Mods);
|
||||
|
||||
ReplaySettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
@ -91,7 +105,7 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void BindRulesetContainer(RulesetContainer rulesetContainer)
|
||||
protected virtual void BindRulesetContainer(RulesetContainer rulesetContainer)
|
||||
{
|
||||
(rulesetContainer.KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(KeyCounter);
|
||||
|
||||
@ -184,7 +198,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay();
|
||||
|
||||
public virtual void BindProcessor(ScoreProcessor processor)
|
||||
protected virtual void BindProcessor(ScoreProcessor processor)
|
||||
{
|
||||
ScoreCounter?.Current.BindTo(processor.TotalScore);
|
||||
AccuracyCounter?.Current.BindTo(processor.Accuracy);
|
||||
|
@ -152,6 +152,8 @@ namespace osu.Game.Screens.Play
|
||||
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
|
||||
userAudioOffset.TriggerChange();
|
||||
|
||||
scoreProcessor = RulesetContainer.CreateScoreProcessor();
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
storyboardContainer = new Container
|
||||
@ -183,12 +185,12 @@ namespace osu.Game.Screens.Play
|
||||
Clock = offsetClock,
|
||||
Child = RulesetContainer,
|
||||
},
|
||||
hudOverlay = new HUDOverlay
|
||||
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, decoupledClock, working, adjustableSourceClock)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
breakOverlay = new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks)
|
||||
breakOverlay = new BreakOverlay(beatmap.BeatmapInfo.LetterboxInBreaks, scoreProcessor)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -213,25 +215,9 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
};
|
||||
|
||||
scoreProcessor = RulesetContainer.CreateScoreProcessor();
|
||||
|
||||
if (showStoryboard)
|
||||
initializeStoryboard(false);
|
||||
|
||||
hudOverlay.BindProcessor(scoreProcessor);
|
||||
hudOverlay.BindRulesetContainer(RulesetContainer);
|
||||
|
||||
hudOverlay.Progress.Objects = RulesetContainer.Objects;
|
||||
hudOverlay.Progress.AudioClock = decoupledClock;
|
||||
hudOverlay.Progress.AllowSeeking = RulesetContainer.HasReplayLoaded;
|
||||
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
|
||||
|
||||
hudOverlay.ModDisplay.Current.BindTo(working.Mods);
|
||||
|
||||
breakOverlay.BindProcessor(scoreProcessor);
|
||||
|
||||
hudOverlay.ReplaySettingsOverlay.PlaybackSettings.AdjustableClock = adjustableSourceClock;
|
||||
|
||||
// Bind ScoreProcessor to ourselves
|
||||
scoreProcessor.AllJudged += onCompletion;
|
||||
scoreProcessor.Failed += onFail;
|
||||
|
Loading…
Reference in New Issue
Block a user