//刷新 /// <summary> /// 刷新窗口 /// </summary> private static void Refresh() { ClearTempConnect(); RefreshStorys(); string names = "已载入故事 {"; for (int i = 0; i < Storys.Count; i++) { if (i < Storys.Count - 1) { names += Storys[i].name + ", "; } else { names += Storys[i].name; } } names += "}"; if (Storys.Count > 0) { Debug.Log(names); } else { Debug.Log("未找到任何故事,请确保其位于Resources文件夹内。"); CurrentStory = null; } }
/// <summary> /// 创建故事 /// </summary> private static void CreateStory() { ScriptableStory story = AssetCreator <ScriptableStory> .CreateAsset(Config.StoryResourcesFolder, "Story"); if (story != null) { OpenStory(story); AssetDatabase.Refresh(); } }
/// <summary> /// 打开故事 /// </summary> /// <param name="story"></param> private static void OpenStory(ScriptableStory story) { if (story != null) { CurrentStory = story; Selection.activeObject = CurrentStory; Instance.ShowNotification(new GUIContent("已打开故事:" + CurrentStory.name)); } else { Debug.LogError("未打开故事:对象为空"); } }
/// <summary> /// 刷新故事结合 /// </summary> private static void RefreshStorys() { storys = ScriptableStory.ReGetDictionaryValues(); }
//关闭 /// <summary> /// 关闭故事 /// </summary> private static void CloseCurrentStory() { CurrentStory = null; }
private void OnEnable() { Target = (ScriptableStory)target; }