35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using System.Collections;
|
|
|
|
namespace AibisDream.SaveSystem
|
|
{
|
|
/// <summary>sections["showcase"]:梦境通用静态图片;先于场景专属表现恢复。</summary>
|
|
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);
|
|
}
|
|
}
|
|
}
|