Files
aibis-dream/Assets/Scripts/SaveSystem/Providers/Day2SleepPresentationSnapshotProvider.cs
T

36 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections;
namespace AibisDream.SaveSystem
{
/// <summary>sections["day2SleepPresentation"]D2 Sleep 动态表现语义终态。</summary>
public sealed class Day2SleepPresentationSnapshotProvider : IAsyncSnapshotProvider
{
public string SaveId => SnapshotProviderIds.Day2SleepPresentation;
public int RestoreOrder => 70;
public object Capture()
{
var controller = Day2SleepPresentationController.Instance;
return controller != null && controller.HasPersistableState
? controller.CaptureSnapshot()
: null;
}
public IEnumerator RestoreAsync(object dto, SnapshotRestoreContext context)
{
if (dto is not Day2SleepPresentationSnapshotDto snapshot)
{
context.Warn("[Day2SleepPresentationSnapshotProvider] DTO 类型不匹配,跳过还原。");
yield break;
}
var controller = Day2SleepPresentationController.Instance;
if (controller == null)
{
context.Warn("[Day2SleepPresentationSnapshotProvider] 控制器未初始化,跳过还原。");
yield break;
}
yield return controller.RestoreSnapshotAsync(snapshot, context.Warn);
}
}
}