コード例 #1
0
        internal void Enable(BaseGraph graph)
        {
            owner = graph;
            ports = new Dictionary <string, BasePort>();
            InitPort();
            //位置绑定
            this[POSITION_NAME] = new BindableProperty <Vector2>(() => position, v => position = v);

            OnEnabled();
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
ファイル: Commands.cs プロジェクト: ALunGame/LCFramework
 public RemoveNodeCommand(BaseGraph graph, BaseNode node)
 {
     this.graph = graph;
     this.node  = node;
 }
コード例 #4
0
ファイル: Commands.cs プロジェクト: ALunGame/LCFramework
 public DisconnectCommand(BaseGraph graph, BaseConnection connection)
 {
     this.graph      = graph;
     this.connection = connection;
 }
コード例 #5
0
 public override void SaveGraph(BaseGraph graph)
 {
     serializedGraph = LCJson.JsonMapper.ToJson(graph);
 }
コード例 #6
0
 /// <summary> 给节点分配一个GUID,这将会覆盖已有GUID </summary>
 public static void IDAllocation(BaseNode node, BaseGraph graph)
 {
     node.guid = graph.GenerateNodeGUID();
 }
コード例 #7
0
 /// <summary> 根据T创建一个节点,并设置位置 </summary>
 public static T CreateNew <T>(BaseGraph graph, Vector2 position) where T : BaseNode
 {
     return(CreateNew(graph, typeof(T), position) as T);
 }