Use null-permitting BDL to reduce number of fields

This commit is contained in:
Bartłomiej Dach 2021-04-25 17:40:23 +02:00
parent 211bff6a8f
commit f9e228d6bf

View File

@ -26,14 +26,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
[Resolved(canBeNull: true)]
private ManiaRulesetConfigManager config { get; set; }
private readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>(); private readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
[Resolved(canBeNull: true)]
private SnapFinder snapFinder { get; set; }
protected virtual ManiaSkinComponents Component => ManiaSkinComponents.Note; protected virtual ManiaSkinComponents Component => ManiaSkinComponents.Note;
private readonly Drawable headPiece; private readonly Drawable headPiece;
@ -53,13 +47,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
}); });
} }
protected override void LoadComplete() [BackgroundDependencyLoader(true)]
private void load(ManiaRulesetConfigManager rulesetConfig, SnapFinder snapFinder)
{ {
base.LoadComplete();
if (snapFinder != null) if (snapFinder != null)
{ {
config?.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes); rulesetConfig?.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
HitObject.StartTimeBindable.BindValueChanged(_ => snap.Value = snapFinder.FindSnap(HitObject), true); HitObject.StartTimeBindable.BindValueChanged(_ => snap.Value = snapFinder.FindSnap(HitObject), true);