Move clock construction to Editor

This commit is contained in:
smoogipoo
2018-03-15 17:19:47 +09:00
parent 5e742eb466
commit c8f6a6980b
6 changed files with 38 additions and 19 deletions

View File

@ -32,12 +32,15 @@ namespace osu.Game.Rulesets.Edit
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
private IAdjustableClock sourceClock;
private DecoupleableInterpolatingFramedClock adjustableClock;
private readonly IAdjustableClock adjustableClock;
private readonly IFrameBasedClock framedClock;
protected HitObjectComposer(Ruleset ruleset)
protected HitObjectComposer(Ruleset ruleset, IAdjustableClock adjustableClock, IFrameBasedClock framedClock)
{
this.ruleset = ruleset;
this.adjustableClock = adjustableClock;
this.framedClock = framedClock;
RelativeSizeAxes = Axes.Both;
}
@ -49,14 +52,7 @@ namespace osu.Game.Rulesets.Edit
try
{
rulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value);
// TODO: should probably be done at a RulesetContainer level to share logic with Player.
sourceClock = (IAdjustableClock)beatmap.Value.Track ?? new StopwatchClock();
adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
adjustableClock.ChangeSource(sourceClock);
rulesetContainer.Clock = adjustableClock;
rulesetContainer.Clock = framedClock;
}
catch (Exception e)
{