using System.Collections; using System.Collections.Generic; using AK.Wwise; using Sirenix.OdinInspector; using UnityEngine; namespace Ichni.Menu { [CreateAssetMenu(fileName = "TutorialCollection", menuName = "Ichni/TutorialCollection")] public class TutorialCollection : SerializedScriptableObject { /// /// 教程 Key 到教程曲目配置的映射。 /// Key 必须使用小写英文、数字和下划线,例如 chapter0_intro; /// 不要使用章节展示名、曲名或点号作为 Key。 /// public Dictionary songs = new Dictionary(); /// /// 按 TutorialBlock 配置的稳定 Key 查找教程曲目。 /// 教程运行流程只通过此函数读取集合,避免各处直接访问字典而产生空引用或不一致的错误信息。 /// public bool TryGetTutorialSong(string tutorialKey, out SongItemData song) { song = null; if (string.IsNullOrWhiteSpace(tutorialKey)) { Debug.LogWarning("[TutorialCollection] Tutorial Key 为空,无法查找教程曲目。"); return false; } if (songs == null || !songs.TryGetValue(tutorialKey, out song) || song == null) { Debug.LogWarning($"[TutorialCollection] 未找到 Tutorial Key '{tutorialKey}' 对应的教程曲目。"); song = null; return false; } return true; } } }