Seek to first hitobject when entering editor

This commit is contained in:
smoogipoo 2019-11-08 17:42:19 +09:00
parent 6805c029e7
commit e904928314
1 changed files with 8 additions and 0 deletions

View File

@ -69,6 +69,14 @@ private void load(OsuColour colours, GameHost host)
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
clock.ChangeSource(sourceClock);
if (Beatmap.Value.Beatmap.HitObjects.Count > 0)
{
double targetTime = Beatmap.Value.Beatmap.HitObjects[0].StartTime;
double beatLength = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(targetTime).BeatLength;
clock.Seek(Math.Max(0, targetTime - beatLength));
}
dependencies.CacheAs<IFrameBasedClock>(clock);
dependencies.CacheAs<IAdjustableClock>(clock);
dependencies.Cache(beatDivisor);