Move BindValueChanged hooks to LoadComplete()

This commit is contained in:
Justus Franklin Tumacder 2021-04-26 19:00:40 +08:00
parent 8bb1fcd39b
commit 58ebec4803
1 changed files with 12 additions and 6 deletions

View File

@ -26,6 +26,9 @@ public class DrawableNote : DrawableManiaHitObject<Note>, IKeyBindingHandler<Man
[Resolved]
private OsuColour colours { get; set; }
[Resolved]
private BeatDivisorFinder beatDivisorFinder { get; set; }
private readonly Bindable<bool> configColourCodedNotes = new Bindable<bool>();
protected virtual ManiaSkinComponents Component => ManiaSkinComponents.Note;
@ -48,17 +51,20 @@ public DrawableNote(Note hitObject)
}
[BackgroundDependencyLoader(true)]
private void load(ManiaRulesetConfigManager rulesetConfig, BeatDivisorFinder beatDivisorFinder)
private void load(ManiaRulesetConfigManager rulesetConfig)
{
rulesetConfig?.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
}
protected override void LoadComplete()
{
if (beatDivisorFinder != null)
{
rulesetConfig?.BindWith(ManiaRulesetSetting.ColourCodedNotes, configColourCodedNotes);
HitObject.StartTimeBindable.BindValueChanged(_ => snap.Value = beatDivisorFinder.FindDivisor(HitObject), true);
snap.BindValueChanged(_ => updateSnapColour(), true);
configColourCodedNotes.BindValueChanged(_ => updateSnapColour());
}
snap.BindValueChanged(_ => updateSnapColour());
configColourCodedNotes.BindValueChanged(_ => updateSnapColour(), true);
}
protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)