53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
using UnityEngine;
|
|
|
|
namespace AibisDream.SaveSystem
|
|
{
|
|
/// <summary>
|
|
/// sections["punchTape"]:打孔带收藏列表。RestoreOrder=63,在 fix 之前。
|
|
/// </summary>
|
|
public class PunchTapeSnapshotProvider : ISyncSnapshotProvider
|
|
{
|
|
public string SaveId => SnapshotProviderIds.PunchTape;
|
|
public int RestoreOrder => 63;
|
|
|
|
public object Capture()
|
|
{
|
|
if (!FixSceneSnapshotHelper.IsFixSceneActive())
|
|
{
|
|
return null;
|
|
}
|
|
|
|
if (FixSystem.PunchTapeManager.Instance == null)
|
|
{
|
|
Debug.LogWarning("[PunchTapeSnapshotProvider] PunchTapeManager 未初始化,跳过捕获。");
|
|
return null;
|
|
}
|
|
|
|
return FixSystem.PunchTapeManager.Instance.CapturePunchTapeSnapshot();
|
|
}
|
|
|
|
public void Restore(object dto, SnapshotRestoreContext context)
|
|
{
|
|
if (dto is not PunchTapeSnapshotDto punchTape)
|
|
{
|
|
context.Warn("[PunchTapeSnapshotProvider] DTO 类型不匹配,跳过还原。");
|
|
return;
|
|
}
|
|
|
|
if (!FixSceneSnapshotHelper.IsFixSceneActive())
|
|
{
|
|
context.Log("[PunchTapeSnapshotProvider] 当前非维修场景,跳过还原。");
|
|
return;
|
|
}
|
|
|
|
if (FixSystem.PunchTapeManager.Instance == null)
|
|
{
|
|
context.Warn("[PunchTapeSnapshotProvider] PunchTapeManager 未初始化,跳过还原。");
|
|
return;
|
|
}
|
|
|
|
FixSystem.PunchTapeManager.Instance.ApplyPunchTapeSnapshot(punchTape);
|
|
}
|
|
}
|
|
}
|