using System.Collections; using UnityEngine; namespace AibisDream.SaveSystem { /// /// sections["timeline"]:各 PlayableDirector 的终/初态(TimelineCenter)。 /// 按 D1.1 只存 AtStart/AtEnd/Stopped,不存时间轴中间帧。 /// public class TimelineSnapshotProvider : IAsyncSnapshotProvider { public string SaveId => SnapshotProviderIds.Timeline; public int RestoreOrder => 60; public object Capture() { if (TimelineCenter.Instance == null) { Debug.LogWarning("[TimelineSnapshotProvider] TimelineCenter 未初始化,跳过捕获。"); return null; } return TimelineCenter.Instance.CaptureSnapshot(); } public IEnumerator RestoreAsync(object dto, SnapshotRestoreContext context) { if (dto is not TimelineSnapshotDto timeline) { context.Warn("[TimelineSnapshotProvider] DTO 类型不匹配,跳过还原。"); yield break; } if (TimelineCenter.Instance == null) { context.Warn("[TimelineSnapshotProvider] TimelineCenter 未初始化,跳过还原。"); yield break; } yield return TimelineCenter.Instance.RestoreSnapshotAsync(timeline); } } }