using System; using System.Collections.Generic; using Sirenix.OdinInspector; using UnityEngine; using XNode; namespace Stary.Evo.StoryEditor { /// /// 空节点 /// (可选择应用哪种节点) /// [Serializable, CreateNodeMenu("创建空节点", order = 0)] public class SelectionNode : FlowNode { /// /// 创建新的空节点 /// /// 所在的块 /// 节点名称 /// 节点位置 /// 节点前部连接 /// 节点后部连接 public static SelectionNode Create(NodeGraph graph, string name = null, Vector2 position = default, List prePorts = null, List nextPorts = null) { var node = Create(graph, name, position, prePorts, nextPorts); return node; } /// /// 创建剧本段落 /// [BoxGroup("Option", order:20, showLabel:false)] [Button("剧本段落")] public void ChooseScriptParagraph() { // 记录动作缓存 #if UNITY_EDITOR UnityEditor.Undo.RecordObject(graph, "Delete Node"); #endif // 在本节点位置创建剧本段落节点 var node = ScriptParagraphNode.Create(graph, position: position); GiveEnterPortToOtherPort(node.GetInputPort("enter"), true); GiveExitPortToOtherPort(node.GetOutputPort("exit"), true); // 移除本节点 DestroySelf(); } } }