1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 14:52:57 +08:00

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

View File

@ -69,6 +69,14 @@ namespace osu.Game.Screens.Edit
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);