Beispiel #1
0
        private void resetTrack(bool seekToStart = false)
        {
            Beatmap.Value.Track?.Stop();

            if (seekToStart)
            {
                double targetTime = 0;

                if (Beatmap.Value.Beatmap.HitObjects.Count > 0)
                {
                    // seek to one beat length before the first hitobject
                    targetTime  = Beatmap.Value.Beatmap.HitObjects[0].StartTime;
                    targetTime -= Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(targetTime).BeatLength;
                }

                clock.Seek(Math.Max(0, targetTime));
            }
        }
Beispiel #2
0
 /// <summary>
 /// Restore the editor to a provided state.
 /// </summary>
 /// <param name="state">The state to restore.</param>
 public void RestoreState([NotNull] EditorState state) => Schedule(() =>
 {
     clock.Seek(state.Time);
     Clipboard.Content.Value = state.ClipboardContent;
 });