Files
ichni_Official/Assets/Scripts/NewStorySystem/Save/StorySave.cs
2026-07-05 16:08:23 -04:00

38 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
namespace Ichni.Story
{
/// <summary>
/// 单章节的存档容器。
/// <para>故事树的布局与连接完全由 <see cref="StoryData"/> 静态定义,故存档不再保存
/// block 位置与连接线;进入章节时按"已完成集合 + 解锁条件"实时推导每个 block 的
/// <see cref="StoryBlockState"/>Completed / Current / Locked。</para>
/// <para>以单个 ES3 key 存储,按章节分文件,一次读写即可加载/保存整章进度。</para>
/// </summary>
[Serializable]
public class ChapterStorySave
{
public string chapterIndex;
// 已完成 block 的 id 列表(顺序无关,去重由 StoryTreeController 保证)
public List<string> completedBlockIds = new();
// 章节内的对话选项记录choiceKey -> 选中项索引)。选项不跨章节引用。
public Dictionary<string, int> selectedChoices = new();
}
/// <summary>
/// 全局剧情变量存档。float / string / bool 三类型与 Yarn Spinner 的
/// <c>VariableStorageBehaviour.GetAllVariables/SetAllVariables</c> 契约一致,
/// 供阶段 2 的 StoryVariableStorage 直接读写。
/// </summary>
[Serializable]
public class StoryVariablesSave
{
public Dictionary<string, float> floatVariables = new();
public Dictionary<string, string> stringVariables = new();
public Dictionary<string, bool> boolVariables = new();
}
}