43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.Collections;
|
||
using UnityEngine;
|
||
|
||
namespace AibisDream.SaveSystem
|
||
{
|
||
/// <summary>
|
||
/// sections["fix"]:Fix 场景宏观状态(FixStateMachine)。
|
||
/// RestoreOrder=65,在 timeline(60) 之后、screen(70) 之前。
|
||
/// </summary>
|
||
public class FixSnapshotProvider : ISnapshotProvider
|
||
{
|
||
public string SaveId => SnapshotProviderIds.Fix;
|
||
public int RestoreOrder => 65;
|
||
|
||
public object Capture()
|
||
{
|
||
if (FixSystem.FixSystemCenter.Instance == null)
|
||
{
|
||
Debug.LogWarning("[FixSnapshotProvider] FixSystemCenter 未初始化,跳过捕获。");
|
||
return null;
|
||
}
|
||
|
||
return FixSystem.FixSystemCenter.Instance.CaptureSnapshot();
|
||
}
|
||
|
||
public IEnumerator Restore(object dto)
|
||
{
|
||
if (dto is not FixSnapshotDto fix)
|
||
{
|
||
yield break;
|
||
}
|
||
|
||
if (FixSystem.FixSystemCenter.Instance == null)
|
||
{
|
||
Debug.LogWarning("[FixSnapshotProvider] FixSystemCenter 未初始化,跳过还原。");
|
||
yield break;
|
||
}
|
||
|
||
yield return FixSystem.FixSystemCenter.Instance.RestoreSnapshot(fix);
|
||
}
|
||
}
|
||
}
|