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)
{

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Overlays.Settings;
@ -53,7 +54,7 @@ namespace osu.Game.Rulesets
public virtual PerformanceCalculator CreatePerformanceCalculator(Beatmap beatmap, Score score) => null;
public virtual HitObjectComposer CreateHitObjectComposer() => null;
public virtual HitObjectComposer CreateHitObjectComposer(IAdjustableClock adjustableClock, IFrameBasedClock framedClock) => null;
public virtual Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_question_circle };