Storyline+Dialog初步
This commit is contained in:
56
Assets/Scripts/NewStorySystem/Tree/StoryManager.cs
Normal file
56
Assets/Scripts/NewStorySystem/Tree/StoryManager.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Story.UI;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Story
|
||||
{
|
||||
/// <summary>
|
||||
/// 剧情系统协调器(单例)。持有故事树控制器、剧情页面与章节数据引用,
|
||||
/// 是外部系统(章节选择、存档等)与剧情系统交互的入口。
|
||||
/// </summary>
|
||||
public class StoryManager : SerializedMonoBehaviour
|
||||
{
|
||||
public static StoryManager instance;
|
||||
|
||||
[Header("References")]
|
||||
public StoryTreeController treeController;
|
||||
public StoryUIPage storyUIPage;
|
||||
public CharacterRegistry characterRegistry;
|
||||
|
||||
[Header("Chapter Data")]
|
||||
[Tooltip("章节索引 (chapterIndex) -> 该章节的 StoryData 资产")]
|
||||
public Dictionary<string, StoryData> storyDatas = new Dictionary<string, StoryData>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 打开指定章节,构建其故事树。
|
||||
/// </summary>
|
||||
public void OpenChapter(string chapterIndex)
|
||||
{
|
||||
treeController.BuildChapter(chapterIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据章节索引获取对应的 StoryData,未找到返回 null。
|
||||
/// </summary>
|
||||
public StoryData GetStoryData(string chapterIndex)
|
||||
{
|
||||
return storyDatas.TryGetValue(chapterIndex, out StoryData data) ? data : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清除全部剧情存档(所有章节故事树 + 全局变量 + 剧情解锁 key)。
|
||||
/// </summary>
|
||||
[Button]
|
||||
public void ClearAllStorySave()
|
||||
{
|
||||
GameSaveManager.instance.StorySaveModule.ClearAllStoryline();
|
||||
GameSaveManager.instance.SongSaveModule.ClearStoryKeys();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user