Simplify construction of ScrollingInfo

This commit is contained in:
smoogipoo
2018-11-07 16:43:34 +09:00
parent ad45bc7666
commit 54668a0dec
3 changed files with 21 additions and 26 deletions

View File

@ -24,15 +24,20 @@ namespace osu.Game.Rulesets.Mania.Edit
{
}
private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IScrollingInfo>(new ScrollingInfo());
return dependencies;
}
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
protected override RulesetContainer<ManiaHitObject> CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
=> new ManiaEditRulesetContainer(ruleset, beatmap);
{
var rulesetContainer = new ManiaEditRulesetContainer(ruleset, beatmap);
// This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it
dependencies.CacheAs(rulesetContainer.ScrollingInfo);
return rulesetContainer;
}
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => Array.Empty<HitObjectCompositionTool>();
@ -48,10 +53,5 @@ namespace osu.Game.Rulesets.Mania.Edit
return base.CreateBlueprintFor(hitObject);
}
private class ScrollingInfo : IScrollingInfo
{
public IBindable<ScrollingDirection> Direction { get; } = new Bindable<ScrollingDirection>();
}
}
}