internal void Enable(BaseGraph graph) { owner = graph; ports = new Dictionary <string, BasePort>(); InitPort(); //位置绑定 this[POSITION_NAME] = new BindableProperty <Vector2>(() => position, v => position = v); OnEnabled(); }
/// <summary> 根据type创建一个节点,并设置位置 </summary> public static BaseNode CreateNew(BaseGraph graph, Type type, Vector2 position) { if (!type.IsSubclassOf(typeof(BaseNode))) { return(null); } var node = Activator.CreateInstance(type) as BaseNode; node.position = position; IDAllocation(node, graph); return(node); }
public RemoveNodeCommand(BaseGraph graph, BaseNode node) { this.graph = graph; this.node = node; }
public DisconnectCommand(BaseGraph graph, BaseConnection connection) { this.graph = graph; this.connection = connection; }
public override void SaveGraph(BaseGraph graph) { serializedGraph = LCJson.JsonMapper.ToJson(graph); }
/// <summary> 给节点分配一个GUID,这将会覆盖已有GUID </summary> public static void IDAllocation(BaseNode node, BaseGraph graph) { node.guid = graph.GenerateNodeGUID(); }
/// <summary> 根据T创建一个节点,并设置位置 </summary> public static T CreateNew <T>(BaseGraph graph, Vector2 position) where T : BaseNode { return(CreateNew(graph, typeof(T), position) as T); }