using AibisDream;
using UnityEngine;
namespace AibisDream.SaveSystem
{
///
/// sections["eye"]:Eye 维修叙事阶段。RestoreOrder=67,在 bodyModule 之后。
///
public class EyeSnapshotProvider : ISyncSnapshotProvider
{
public string SaveId => SnapshotProviderIds.Eye;
public int RestoreOrder => 68;
public object Capture()
{
if (!FixSceneSnapshotHelper.IsFixSceneActive())
{
return null;
}
var eyeSystem = FixSystem.FixSystemCenter.SystemDic.Get();
if (eyeSystem == null)
{
Debug.LogWarning("[EyeSnapshotProvider] EyeSystem 未初始化,跳过捕获。");
return null;
}
return eyeSystem.CaptureEyeSnapshot();
}
public void Restore(object dto, SnapshotRestoreContext context)
{
if (dto is not EyeSnapshotDto eyeDto)
{
context.Warn("[EyeSnapshotProvider] DTO 类型不匹配,跳过还原。");
return;
}
if (!FixSceneSnapshotHelper.IsFixSceneActive())
{
context.Log("[EyeSnapshotProvider] 当前非维修场景,跳过还原。");
return;
}
var eyeSystem = FixSystem.FixSystemCenter.SystemDic.Get();
if (eyeSystem == null)
{
context.Warn("[EyeSnapshotProvider] EyeSystem 未初始化,跳过还原。");
return;
}
eyeSystem.ApplyEyeSnapshot(eyeDto);
}
}
}