using System.Collections; namespace AibisDream.SaveSystem { /// sections["showcase"]:梦境通用静态图片;先于场景专属表现恢复。 public sealed class ShowcaseSnapshotProvider : IAsyncSnapshotProvider { public string SaveId => SnapshotProviderIds.Showcase; public int RestoreOrder => 69; public object Capture() { return SpriteShowcase.Instance != null ? SpriteShowcase.Instance.CaptureSnapshot() : null; } public IEnumerator RestoreAsync(object dto, SnapshotRestoreContext context) { if (dto is not ShowcaseSnapshotDto snapshot) { context.Warn("[ShowcaseSnapshotProvider] DTO 类型不匹配,跳过还原。"); yield break; } var showcase = SpriteShowcase.Instance; if (showcase == null) { context.Warn("[ShowcaseSnapshotProvider] SpriteShowcase 未初始化,跳过还原。"); yield break; } yield return showcase.RestoreSnapshotAsync(snapshot, context.Warn); } } }