37 lines
1.0 KiB
C#
37 lines
1.0 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream.SaveSystem
|
|
{
|
|
/// <summary>
|
|
/// sections["actor"]:场景中各角色显隐、槽位、动画状态、透明度等(ActorManager)。
|
|
/// RestoreOrder=40,依赖 scene 与 env 已就绪。
|
|
/// </summary>
|
|
public class ActorSnapshotProvider : ISnapshotProvider
|
|
{
|
|
public string SaveId => SnapshotProviderIds.Actor;
|
|
public int RestoreOrder => 40;
|
|
|
|
public object Capture()
|
|
{
|
|
if (ActorManager.Instance == null)
|
|
{
|
|
Debug.LogWarning("[ActorSnapshotProvider] ActorManager 未初始化,跳过捕获。");
|
|
return null;
|
|
}
|
|
|
|
return ActorManager.Instance.CaptureSnapshot();
|
|
}
|
|
|
|
public IEnumerator Restore(object dto)
|
|
{
|
|
if (dto is not ActorSnapshotDto actors)
|
|
{
|
|
yield break;
|
|
}
|
|
|
|
yield return ActorManager.Instance.RestoreSnapshot(actors);
|
|
}
|
|
}
|
|
}
|