40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System.Collections;
|
|
using AibisDream.Framework;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace AibisDream.SaveSystem
|
|
{
|
|
/// <summary>
|
|
/// 深度维修子系统的旧 IData 注册表(基于 <see cref="DataContainer"/>)。
|
|
/// <para>
|
|
/// FixSystem / Eye / Chip 等仍通过此处 RegisterData;尚未纳入新 <see cref="SaveSnapshot.deepRepair"/>。
|
|
/// P5 评估后迁移或废弃;与 <see cref="YarnVariableStorage"/>、快照 I/O 分离。
|
|
/// </para>
|
|
/// </summary>
|
|
public static class DeepRepairDataRegistry
|
|
{
|
|
private static readonly DataContainer Container = new();
|
|
|
|
public static void RegisterData<T>(T data) where T : IData
|
|
{
|
|
Container.Register(data);
|
|
}
|
|
|
|
public static void UnregisterData<T>() where T : class, IData
|
|
{
|
|
Container.Unregister<T>();
|
|
}
|
|
|
|
/// <summary>旧格式存档 systemData 段还原;按 LoadIndex 顺序执行各 IData.Load()。</summary>
|
|
public static IEnumerator LoadByJson(JObject dataJson)
|
|
{
|
|
if (dataJson == null)
|
|
{
|
|
yield break;
|
|
}
|
|
|
|
yield return Container.LoadByJson(dataJson);
|
|
}
|
|
}
|
|
}
|