Beispiel #1
0
 public bool ExistFieldName(string fieldName)
 {
     for (int i = 0; i < m_Fields.Count; i++)
     {
         NodeField temp = m_Fields[i];
         if (temp.FieldName == fieldName)
         {
             return(true);
         }
     }
     return(false);
 }
        //交换
        private void SwapField(bool up)
        {
            if (listViewFields.SelectedIndices.Count > 1)
            {
                MainForm.Instance.ShowInfo("请选择一条记录进行交换");
                MainForm.Instance.ShowMessage("请选择一条记录进行交换", "警告");
                return;
            }

            int selectIdx = listViewFields.SelectedIndices[0];

            if (up)
            {
                //第一个不能往上交换
                if (selectIdx == 0)
                {
                    return;
                }

                int preIdx = selectIdx - 1;

                NodeField preField      = m_NodeClass.Fields[preIdx];
                NodeField selectedField = m_NodeClass.Fields[selectIdx];

                m_NodeClass.Fields[preIdx]    = selectedField;
                m_NodeClass.Fields[selectIdx] = preField;

                selectIdx = preIdx;
            }
            else
            {
                //最后一个不能往下交换
                if (selectIdx == listViewFields.Items.Count - 1)
                {
                    return;
                }

                int nextIdx = selectIdx + 1;

                NodeField preField      = m_NodeClass.Fields[nextIdx];
                NodeField selectedField = m_NodeClass.Fields[selectIdx];

                m_NodeClass.Fields[nextIdx]   = selectedField;
                m_NodeClass.Fields[selectIdx] = preField;

                selectIdx = nextIdx;
            }

            Exec("Refresh");
            MainForm.Instance.ShowInfo("交换成功 时间:" + DateTime.Now);
            listViewFields.Items[selectIdx].Selected = true;
        }
        private void NewField()
        {
            NodeField            field = new NodeField();
            InputValueDialogForm form  = new InputValueDialogForm("添加字段", field);

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (m_NodeClass.AddField(field))
                {
                    Exec("Refresh");
                }
            }
        }
        /// <summary>
        /// 是否存在空的字段名字
        /// </summary>
        /// <returns></returns>
        public VerifyInfo VerifyEmptyFieldName()
        {
            //检测是否有空字段
            for (int i = 0; i < m_Fields.Count; i++)
            {
                NodeField field = m_Fields[i];
                if (string.IsNullOrEmpty(field.FieldName))
                {
                    return(new VerifyInfo(string.Format("节点类[{0}],存在空字段", m_ClassType)));
                }
            }

            return(VerifyInfo.DefaultVerifyInfo);
        }
Beispiel #5
0
        public string ShowContent()
        {
            if (NodeDefine == null)
            {
                NodeDefine = MainForm.Instance.NodeTemplate.FindNode(ClassType);
            }

            if (NodeDefine == null)
            {
                throw new Exception(ClassType + "的" + nameof(NodeDefine) + "为空");
            }

            string content = string.Empty;

            int showCount = 0;

            for (int i = 0; i < m_Fields.Count; i++)
            {
                FieldDesigner field     = m_Fields[i];
                NodeField     nodeField = NodeDefine.Fields[i];
                if (nodeField.Show && field.Field != null)
                {
                    if (showCount == 0)
                    {
                        content += "[";
                    }
                    else
                    {
                        content += ",";
                    }

                    showCount++;
                    content += field.Field;
                }
            }

            if (showCount > 0)
            {
                content += "]";
            }
            else
            {
                content = Describe;
            }

            return(content);
        }
        public NodeField FindField(string fieldName)
        {
            if (string.IsNullOrEmpty(fieldName))
            {
                return(null);
            }

            for (int i = 0; i < m_Fields.Count; i++)
            {
                NodeField temp = m_Fields[i];
                if (temp.FieldName == fieldName)
                {
                    return(temp);
                }
            }
            return(null);
        }
 /// <summary>
 /// 检验是否存在相同字段名字
 /// </summary>
 /// <returns></returns>
 public VerifyInfo VerifySameFieldName()
 {
     //检测字段是否重复
     for (int i = 0; i < m_Fields.Count; i++)
     {
         NodeField field_i = m_Fields[i];
         for (int ii = i + 1; ii < m_Fields.Count; ii++)
         {
             NodeField field_ii = m_Fields[ii];
             if (field_i.FieldName == field_ii.FieldName)
             {
                 return(new VerifyInfo(string.Format("节点类[{0}]存在重复字段[{1}]", m_ClassType, field_ii.FieldName)));
             }
         }
     }
     return(VerifyInfo.DefaultVerifyInfo);
 }
 /// <summary>
 /// 移除未定义的枚举字段
 /// </summary>
 public void RemoveUnDefineEnumField()
 {
     for (int i = m_Fields.Count - 1; i >= 0; i--)
     {
         NodeField field = m_Fields[i];
         if (field.FieldType == FieldType.EnumField)
         {
             EnumDefaultValue enumDeaultValue = field.DefaultValue as EnumDefaultValue;
             if (enumDeaultValue != null)
             {
                 CustomEnum customEnum = MainForm.Instance.NodeClasses.FindEnum(enumDeaultValue.EnumType);
                 if (customEnum == null)
                 {
                     m_Fields.RemoveAt(i);
                 }
             }
         }
     }
 }
        /// <summary>
        /// 是否存在无效枚举类型
        /// </summary>
        /// <returns></returns>
        public VerifyInfo VerifyEnum()
        {
            //校验枚举类型
            //检测字段是否重复
            for (int i = 0; i < m_Fields.Count; i++)
            {
                NodeField field = m_Fields[i];
                if (field.FieldType == FieldType.EnumField)
                {
                    EnumDefaultValue enumDeaultValue = field.DefaultValue as EnumDefaultValue;
                    if (enumDeaultValue != null)
                    {
                        if (string.IsNullOrEmpty(enumDeaultValue.EnumType))
                        {
                            return(new VerifyInfo(string.Format("节点类型[{0}]的字段[{1}]的枚举类型为空", this.ClassType, field.FieldName)));
                        }

                        CustomEnum customEnum = MainForm.Instance.NodeClasses.FindEnum(enumDeaultValue.EnumType);
                        if (customEnum == null)
                        {
                            return(new VerifyInfo(string.Format("节点类型[{0}]的字段[{1}]的枚举类型[{2}]不存在", this.ClassType, field.FieldName, enumDeaultValue.EnumType)));
                        }
                        else
                        {
                            EnumItem enumItem = customEnum.FindEnum(enumDeaultValue.DefaultValue);
                            if (enumItem == null)
                            {
                                return(new VerifyInfo(string.Format("节点类型[{0}]的字段[{1}]的枚举类型[{2}]不存在选项[{3}]", this.ClassType, field.FieldName, customEnum.EnumType, enumDeaultValue.DefaultValue)));
                            }
                        }
                    }
                }
            }

            return(VerifyInfo.DefaultVerifyInfo);
        }
        public bool AddField(NodeField field)
        {
            if (field == null)
            {
                return(false);
            }

            if (field.FieldType == FieldType.None)
            {
                MainForm.Instance.ShowInfo("字段类型为None,添加失败!!!");
                MainForm.Instance.ShowMessage("字段类型为None,添加失败!!!", "警告");
                return(false);
            }

            if (string.IsNullOrEmpty(field.FieldName))
            {
                MainForm.Instance.ShowInfo("字段名为空,添加失败!!!");
                MainForm.Instance.ShowMessage("字段名为空,添加失败!!!", "警告");
                return(false);
            }

            for (int i = 0; i < m_Fields.Count; i++)
            {
                NodeField temp = m_Fields[i];
                if (temp.FieldName == field.FieldName)
                {
                    MainForm.Instance.ShowInfo(string.Format("字段名字{0}相同,添加失败!!!", temp.FieldName));
                    MainForm.Instance.ShowMessage(string.Format("字段名字{0}相同,添加失败!!!", temp.FieldName), "警告");
                    return(false);
                }
            }

            m_Fields.Add(field);

            return(true);
        }
Beispiel #11
0
        /// <summary>
        /// 通过节点模板创建FieldDesigner
        /// </summary>
        /// <param name="nodeField">节点模板</param>
        /// <returns></returns>
        public static FieldDesigner CreateFieldByNodeField(NodeField nodeField)
        {
            FieldDesigner field = new FieldDesigner();

            field.FieldName = nodeField.FieldName;
            field.Label     = nodeField.Label;
            field.FieldType = nodeField.FieldType;
            field.Describe  = nodeField.Describe;
            switch (nodeField.FieldType)
            {
            case FieldType.IntField:
                IntFieldDesigner intFieldDesigner = field.Field as IntFieldDesigner;
                IntDefaultValue  intDefaultValue  = nodeField.DefaultValue as IntDefaultValue;
                intFieldDesigner.Value = intDefaultValue.DefaultValue;
                break;

            case FieldType.LongField:
                LongFieldDesigner longFieldDesigner = field.Field as LongFieldDesigner;
                LongDefaultValue  longDefaultValue  = nodeField.DefaultValue as LongDefaultValue;
                longFieldDesigner.Value = longDefaultValue.DefaultValue;
                break;

            case FieldType.FloatField:
                FloatFieldDesigner floatFieldDesigner = field.Field as FloatFieldDesigner;
                FloatDefaultValue  floatDefaultValue  = nodeField.DefaultValue as FloatDefaultValue;
                floatFieldDesigner.Value = floatDefaultValue.DefaultValue;
                break;

            case FieldType.DoubleField:
                DoubleFieldDesigner doubleFieldDesigner = field.Field as DoubleFieldDesigner;
                DoubleDefaultValue  doubleDefaultValue  = nodeField.DefaultValue as DoubleDefaultValue;
                doubleFieldDesigner.Value = doubleDefaultValue.DefaultValue;
                break;

            case FieldType.StringField:
                StringFieldDesigner stringFieldDesigner = field.Field as StringFieldDesigner;
                StringDefaultValue  stringDefaultValue  = nodeField.DefaultValue as StringDefaultValue;
                stringFieldDesigner.Value = stringDefaultValue.DefaultValue;
                break;

            case FieldType.ColorField:
                ColorFieldDesigner colorFieldDesigner = field.Field as ColorFieldDesigner;
                ColorDefaultValue  colorDefaultValue  = nodeField.DefaultValue as ColorDefaultValue;
                colorFieldDesigner.R = colorDefaultValue.R;
                colorFieldDesigner.G = colorDefaultValue.G;
                colorFieldDesigner.B = colorDefaultValue.B;
                colorFieldDesigner.A = colorDefaultValue.A;
                break;

            case FieldType.Vector2:
                Vector2FieldDesigner vector2FieldDesigner = field.Field as Vector2FieldDesigner;
                Vector2DefaultValue  vector2DefaultValue  = nodeField.DefaultValue as Vector2DefaultValue;
                vector2FieldDesigner.X = vector2DefaultValue.X;
                vector2FieldDesigner.Y = vector2DefaultValue.Y;
                break;

            case FieldType.Vector3:
                Vector3FieldDesigner vector3FieldDesigner = field.Field as Vector3FieldDesigner;
                Vector3DefaultValue  vector3DefaultValue  = nodeField.DefaultValue as Vector3DefaultValue;
                vector3FieldDesigner.X = vector3DefaultValue.X;
                vector3FieldDesigner.Y = vector3DefaultValue.Y;
                vector3FieldDesigner.Z = vector3DefaultValue.Z;
                break;

            case FieldType.EnumField:
                EnumFieldDesigner enumFieldDesigner = field.Field as EnumFieldDesigner;
                EnumDefaultValue  enumDefaultValue  = nodeField.DefaultValue as EnumDefaultValue;
                enumFieldDesigner.EnumType = enumDefaultValue.EnumType;
                enumFieldDesigner.Value    = enumDefaultValue.DefaultValue;
                break;

            case FieldType.BooleanField:
                BooleanFieldDesigner booleanFieldDesigner = field.Field as BooleanFieldDesigner;
                BooleanDefaultValue  booleanDefaultValue  = nodeField.DefaultValue as BooleanDefaultValue;
                booleanFieldDesigner.Value = booleanDefaultValue.DefaultValue;
                break;

            case FieldType.RepeatIntField:
                break;

            case FieldType.RepeatLongField:
                break;

            case FieldType.RepeatFloatField:
                break;

            case FieldType.RepeatVector2Field:
                break;

            case FieldType.RepeatVector3Field:
                break;

            case FieldType.RepeatStringField:
                break;
            }
            return(field);
        }
        /// <summary>
        /// 添加Agent
        /// </summary>
        private void AddAgent()
        {
            if (WorkSpaceData == null)
            {
                ShowMessage("当前没有工作空间,请新建或者打开工作空间!");
                return;
            }

            if (TreeData == null)
            {
                return;
            }

            string group = string.Empty;

            if (treeView1.SelectedNode != null)
            {
                if (treeView1.SelectedNode.Tag is GroupItem)
                {
                    GroupItem groupItem = treeView1.SelectedNode.Tag as GroupItem;
                    group = groupItem.Group.GroupName;
                }
                else if (treeView1.SelectedNode.Tag is AgentItem)
                {
                    AgentItem agentItem = treeView1.SelectedNode.Tag as AgentItem;
                    if (agentItem.GroupItem != null)
                    {
                        group = agentItem.GroupItem.Group.GroupName;
                    }
                }
            }

            AgentDesigner agent = new AgentDesigner();

            agent.GroupName = group;
            string agentID = "NewAgent_" + DateTime.Now.Ticks;

            do
            {
                agentID = "NewAgent_" + DateTime.Now.Ticks;
            } while (TreeData.ExistAgent(agentID));

            agent.AgentID = agentID;

            //创建开始节点
            NodeDesigner startNode = null;
            NodeClass    nodeClass = NodeClasses.FindNode("Sequence");

            if (nodeClass != null)
            {
                Rect rect = new Rect(EditorUtility.Center.x, EditorUtility.Center.y, EditorUtility.NodeWidth,
                                     EditorUtility.NodeHeight);
                startNode           = new NodeDesigner(nodeClass.Label, nodeClass.ClassType, rect);
                startNode.ID        = agent.GenNodeID();
                startNode.StartNode = true;
                startNode.NodeType  = nodeClass.NodeType;
                startNode.Describe  = nodeClass.Describe;

                //创建字段
                for (int i = 0; i < nodeClass.Fields.Count; i++)
                {
                    NodeField     nodeField = nodeClass.Fields[i];
                    FieldDesigner field     = EditorUtility.CreateFieldByNodeField(nodeField);
                    if (field == null)
                    {
                        continue;
                    }
                    startNode.Fields.Add(field);
                }

                agent.AddNode(startNode);
            }

            //创建空操作节点
            NodeClass noopClass = NodeClasses.FindNode("Noop");

            if (startNode != null && noopClass != null)
            {
                Rect rect = new Rect(EditorUtility.Center.x + 250, EditorUtility.Center.y, EditorUtility.NodeWidth,
                                     EditorUtility.NodeHeight);
                NodeDesigner noopNode = new NodeDesigner(noopClass.Label, noopClass.ClassType, rect);
                noopNode.ID       = agent.GenNodeID();
                noopNode.NodeType = noopClass.NodeType;
                noopNode.Describe = noopClass.Describe;
                agent.AddNode(noopNode);

                startNode.AddChildNode(noopNode);
            }

            TreeViewManager.AddAgent(agent);
        }
Beispiel #13
0
        /// <summary>
        /// 修正数据
        /// </summary>
        public bool AjustData()
        {
            bool ajust = false;

            for (int i = 0; i < m_Nodes.Count; i++)
            {
                NodeDesigner node       = m_Nodes[i];
                NodeDefine   nodeDefine = MainForm.Instance.NodeTemplate.FindNode(node.ClassType);

                //修正节点标签
                if (node.Label != nodeDefine.Label)
                {
                    node.Label = nodeDefine.Label;
                    ajust      = true;
                }

                //移除模板中没有的字段
                for (int ii = node.Fields.Count - 1; ii >= 0; ii--)
                {
                    FieldDesigner field = node.Fields[ii];
                    if (!nodeDefine.ExistFieldName(field.FieldName))
                    {
                        ajust = true;
                        node.Fields.RemoveAt(ii);
                    }
                }

                //修正类型不匹配的(节点字段和模板字段类型不匹配)
                for (int ii = 0; ii < node.Fields.Count; ii++)
                {
                    FieldDesigner field     = node.Fields[ii];
                    NodeField     nodeField = nodeDefine.FindField(field.FieldName);
                    if (field.FieldType != nodeField.FieldType)
                    {
                        //重新给默认值
                        node.Fields[ii] = EditorUtility.CreateFieldByNodeField(nodeField);
                        ajust           = true;
                    }
                }

                //添加不存的字段
                for (int ii = nodeDefine.Fields.Count - 1; ii >= 0; ii--)
                {
                    NodeField     nodeField = nodeDefine.Fields[ii];
                    FieldDesigner field     = node.FindFieldByName(nodeField.FieldName);
                    //不存在的字段要添加
                    if (field == null)
                    {
                        FieldDesigner newField = EditorUtility.CreateFieldByNodeField(nodeField);
                        node.AddField(newField);
                        ajust = true;
                    }
                }

                //排序字段(要和模板中一致)
                for (int ii = 0; ii < nodeDefine.Fields.Count; ii++)
                {
                    NodeField nodeField = nodeDefine.Fields[ii];
                    int       index     = node.GetFieldIndex(nodeField.FieldName);
                    if (index != ii)
                    {
                        //交换
                        FieldDesigner tempField_ii = node.Fields[ii];
                        node.Fields[ii]    = node.Fields[index];
                        node.Fields[index] = tempField_ii;
                        ajust = true;
                    }
                }

                //修正Label
                for (int ii = 0; ii < node.Fields.Count; ii++)
                {
                    FieldDesigner field     = node.Fields[ii];
                    NodeField     nodeField = nodeDefine.Fields[ii];
                    if (field.Label != nodeField.Label)
                    {
                        field.Label = nodeField.Label;
                        ajust       = true;
                    }
                }
            }

            return(ajust);
        }
Beispiel #14
0
        /// <summary>
        /// 添加行为树
        /// </summary>
        private void AddBehaviorTree()
        {
            if (WorkSpaceData == null)
            {
                ShowMessage("当前没有工作空间,请新建或者打开工作空间!");
                return;
            }

            if (BehaviorTreeData == null)
            {
                return;
            }

            string group = string.Empty;

            if (treeView1.SelectedNode != null)
            {
                if (treeView1.SelectedNode.Tag is GroupItem)
                {
                    GroupItem groupItem = treeView1.SelectedNode.Tag as GroupItem;
                    group = groupItem.Group.GroupName;
                }
                else if (treeView1.SelectedNode.Tag is BehaviorTreeItem)
                {
                    BehaviorTreeItem behaviorTreeItem = treeView1.SelectedNode.Tag as BehaviorTreeItem;
                    if (behaviorTreeItem.GroupItem != null)
                    {
                        group = behaviorTreeItem.GroupItem.Group.GroupName;
                    }
                }
            }

            BehaviorTreeDesigner behaviorTree = new BehaviorTreeDesigner();

            behaviorTree.GroupName = group;
            string behaviorTreeID = "New_" + DateTime.Now.Ticks;

            do
            {
                behaviorTreeID = "New_" + DateTime.Now.Ticks;
            } while (BehaviorTreeData.ExistBehaviorTree(behaviorTreeID));

            behaviorTree.ID = behaviorTreeID;

            //创建开始节点
            NodeDesigner startNode  = null;
            NodeDefine   nodeDefine = NodeTemplate.FindNode("Sequence");

            if (nodeDefine != null)
            {
                Rect rect = new Rect(EditorUtility.Center.x, EditorUtility.Center.y, EditorUtility.NodeWidth,
                                     EditorUtility.NodeHeight);
                startNode           = new NodeDesigner(nodeDefine.Label, nodeDefine.ClassType, rect);
                startNode.ID        = behaviorTree.GenNodeID();
                startNode.StartNode = true;
                startNode.NodeType  = nodeDefine.NodeType;

                //创建字段
                for (int i = 0; i < nodeDefine.Fields.Count; i++)
                {
                    NodeField     nodeField = nodeDefine.Fields[i];
                    FieldDesigner field     = EditorUtility.CreateFieldByNodeField(nodeField);
                    if (field == null)
                    {
                        continue;
                    }
                    startNode.Fields.Add(field);
                }

                behaviorTree.AddNode(startNode);
            }

            //创建空操作节点
            NodeDefine noopDefine = NodeTemplate.FindNode("Noop");

            if (startNode != null && noopDefine != null)
            {
                Rect rect = new Rect(EditorUtility.Center.x + 250, EditorUtility.Center.y, EditorUtility.NodeWidth,
                                     EditorUtility.NodeHeight);
                NodeDesigner noopNode = new NodeDesigner(noopDefine.Label, noopDefine.ClassType, rect);
                noopNode.ID       = behaviorTree.GenNodeID();
                noopNode.NodeType = noopDefine.NodeType;
                noopNode.Describe = noopDefine.Describe;
                behaviorTree.AddNode(noopNode);

                startNode.AddChildNode(noopNode);
            }

            TreeViewManager.AddBehaviorTree(behaviorTree);
        }
        public void ResetNodes()
        {
            m_Nodes.Clear();
            #region 组合节点
            //并行节点
            NodeClass parallelNode = new NodeClass();
            parallelNode.ClassType = "Parallel";
            parallelNode.Label     = "并行节点";
            parallelNode.NodeType  = NodeType.Composite;
            parallelNode.Describe  = "Parallel节点在一般意义上是并行的执行其子节点,即“一边做A,一边做B”";
            //成功条件
            NodeField parallelNodeSuccessType = new NodeField()
            {
                FieldName = "SuccessType", FieldType = FieldType.EnumField, Describe = "成功条件"
            };
            EnumDefaultValue parallelNodeSuccessEnumDefaultValue = parallelNodeSuccessType.DefaultValue as EnumDefaultValue;
            parallelNodeSuccessEnumDefaultValue.EnumType     = "SUCCESS_POLICY";
            parallelNodeSuccessEnumDefaultValue.DefaultValue = "SUCCEED_ON_ALL";
            parallelNodeSuccessType.Label = "成功条件";
            parallelNode.AddField(parallelNodeSuccessType);
            //失败条件
            NodeField parallelNodeFailType = new NodeField()
            {
                FieldName = "FailType", FieldType = FieldType.EnumField, Describe = "失败条件"
            };
            EnumDefaultValue parallelNodeFailTypeEnumDefaultValue = parallelNodeFailType.DefaultValue as EnumDefaultValue;
            parallelNodeFailTypeEnumDefaultValue.EnumType     = "FAILURE_POLICY";
            parallelNodeFailTypeEnumDefaultValue.DefaultValue = "FAIL_ON_ONE";
            parallelNodeFailType.Label = "失败条件";
            parallelNode.AddField(parallelNodeFailType);
            AddClass(parallelNode);

            //顺序节点
            NodeClass sequenceNode = new NodeClass();
            sequenceNode.ClassType = "Sequence";
            sequenceNode.Label     = "顺序节点";
            sequenceNode.NodeType  = NodeType.Composite;
            sequenceNode.Describe  = "Sequence节点以给定的顺序依次执行其子节点,直到所有子节点成功返回,该节点也返回成功。只要其中某个子节点失败,那么该节点也失败。";
            AddClass(sequenceNode);

            //选择节点
            NodeClass Selector = new NodeClass();
            Selector.ClassType = "Selector";
            Selector.Label     = "选择节点";
            Selector.Category  = "";
            Selector.NodeType  = NodeType.Composite;
            Selector.Describe  = "选择节点";
            AddClass(Selector);

            //ifelse
            NodeClass IfElse = new NodeClass();
            IfElse.ClassType = "IfElse";
            IfElse.Label     = "IfElse";
            IfElse.NodeType  = NodeType.Composite;
            IfElse.Describe  = "";
            AddClass(IfElse);

            //随机节点
            NodeClass Random = new NodeClass();
            Random.ClassType = "Random";
            Random.Label     = "随机节点";
            Random.Category  = "随机";
            Random.NodeType  = NodeType.Composite;
            Random.Describe  = "随机节点";
            AddClass(Random);

            //随机选择节点
            NodeClass RandomSelector = new NodeClass();
            RandomSelector.ClassType = "RandomSelector";
            RandomSelector.Label     = "随机选择";
            RandomSelector.Category  = "随机";
            RandomSelector.NodeType  = NodeType.Composite;
            RandomSelector.Describe  = "随机选择节点";
            AddClass(RandomSelector);

            //随机序列节点
            NodeClass RandomSequence = new NodeClass();
            RandomSequence.ClassType = "RandomSequence";
            RandomSequence.Label     = "随机序列";
            RandomSequence.Category  = "随机";
            RandomSequence.NodeType  = NodeType.Composite;
            RandomSequence.Describe  = "随机序列节点";
            AddClass(RandomSequence);

            //概率选择节点
            NodeClass RateSelector = new NodeClass();
            RateSelector.ClassType = "RateSelector";
            RateSelector.Label     = "概率选择";
            RateSelector.Category  = "随机";
            RateSelector.NodeType  = NodeType.Composite;
            RateSelector.Describe  = "概率选择节点";
            RateSelector.AddField(new NodeField()
            {
                FieldName = "Priority", Label = "优先级", FieldType = FieldType.RepeatIntField, Describe = ""
            });
            AddClass(RateSelector);

            #endregion

            #region 装饰节点

            //成功节点
            NodeClass Success = new NodeClass();
            Success.ClassType = "Success";
            Success.Label     = "成功节点";
            Success.NodeType  = NodeType.Decorator;
            Success.Describe  = "成功节点";
            AddClass(Success);

            //失败节点
            NodeClass Failure = new NodeClass();
            Failure.ClassType = "Failure";
            Failure.Label     = "失败节点";
            Failure.NodeType  = NodeType.Decorator;
            Failure.Describe  = "失败节点";
            AddClass(Failure);

            //帧数节点用于在指定的帧数内,持续调用其子节点
            NodeClass Frames = new NodeClass();
            Frames.ClassType   = "Frames";
            Frames.Label       = "帧数节点";
            Frames.NodeType    = NodeType.Decorator;
            Frames.ShowContent = true;
            NodeField FramesField = new NodeField()
            {
                FieldName = "Frames", Label = "持续帧数", FieldType = FieldType.IntField, Describe = "持续帧数"
            };
            (FramesField.DefaultValue as IntDefaultValue).DefaultValue = 1;
            Frames.AddField(FramesField);
            Frames.Describe = "帧数节点用于在指定的帧数内,持续调用其子节点";
            AddClass(Frames);

            //输出Log节点
            NodeClass Log = new NodeClass();
            Log.ClassType   = "Log";
            Log.Label       = "输出节点";
            Log.NodeType    = NodeType.Decorator;
            Log.Describe    = "输出log节点";
            Log.ShowContent = true;
            Log.AddField(new NodeField()
            {
                FieldName = "Content", Label = "输出内容", FieldType = FieldType.StringField, Describe = "输出的内容"
            });
            AddClass(Log);

            //循环节点 -1无限循环
            NodeClass Loop = new NodeClass();
            Loop.ClassType   = "Loop";
            Loop.Label       = "循环节点";
            Loop.NodeType    = NodeType.Decorator;
            Loop.Describe    = "循环节点 -1无限循环";
            Loop.ShowContent = true;
            Loop.AddField(new NodeField()
            {
                FieldName = "LoopTimes", Label = "循环次数", FieldType = FieldType.IntField, Describe = "循环次数"
            });
            AddClass(Loop);

            //直到某个值达成前一直循环
            NodeClass LoopUntil = new NodeClass();
            LoopUntil.ClassType = "LoopUntil";
            LoopUntil.Label     = "循环直到";
            LoopUntil.NodeType  = NodeType.Decorator;
            LoopUntil.Describe  = "直到某个值达成前一直循环";
            AddClass(LoopUntil);

            //取反节点
            NodeClass Not = new NodeClass();
            Not.ClassType = "Not";
            Not.Label     = "取反节点";
            Not.NodeType  = NodeType.Decorator;
            Not.Describe  = "取反节点";
            AddClass(Not);

            //指定时间内运行
            NodeClass Time = new NodeClass();
            Time.ClassType = "Time";
            Time.Label     = "时间";
            Time.NodeType  = NodeType.Decorator;
            Time.Describe  = "指定时间内运行";
            NodeField TimeField = new NodeField()
            {
                FieldName = "Duration", Label = "持续时间(毫秒)", FieldType = FieldType.IntField, Describe = "持续时间(毫秒)"
            };
            (TimeField.DefaultValue as IntDefaultValue).DefaultValue = 1000;
            Time.AddField(TimeField);
            Time.ShowContent = true;
            AddClass(Time);

            //阻塞,直到子节点返回true
            NodeClass WaitUntil = new NodeClass();
            WaitUntil.ClassType = "WaitUntil";
            WaitUntil.Label     = "等待返回True";
            WaitUntil.NodeType  = NodeType.Decorator;
            WaitUntil.Describe  = "阻塞,直到子节点返回true";
            AddClass(WaitUntil);

            #endregion

            #region 条件节点

            //比较Int节点
            NodeClass CompareInt = new NodeClass();
            CompareInt.ClassType = "CompareInt";
            CompareInt.Label     = "比较Int节点";
            CompareInt.NodeType  = NodeType.Condition;
            CompareInt.Describe  = "Compare节点对左右参数进行比较";
            //左边参数类型
            NodeField CompareInt_LeftType = new NodeField()
            {
                FieldName = "LeftType", FieldType = FieldType.EnumField, Describe = ""
            };
            (CompareInt_LeftType.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            CompareInt_LeftType.Label = "左参数类型";
            CompareInt.AddField(CompareInt_LeftType);
            //左边参数变量名
            CompareInt.AddField(new NodeField()
            {
                FieldName = "LeftParameter", Label = "左参数名", FieldType = FieldType.StringField, Describe = "左边参数变量名"
            });
            //比较符号
            NodeField CompareInt_Type = new NodeField()
            {
                FieldName = "CompareType", FieldType = FieldType.EnumField, Describe = "比较符号<、>、<=、>=、==、!="
            };
            (CompareInt_Type.DefaultValue as EnumDefaultValue).EnumType = "CompareType";
            CompareInt_Type.Label = "比较操作符";
            CompareInt.AddField(CompareInt_Type);
            //右边边参数类型
            NodeField CompareInt_RightType = new NodeField()
            {
                FieldName = "RightType", FieldType = FieldType.EnumField, Describe = ""
            };
            (CompareInt_RightType.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            CompareInt_RightType.Label = "右参数类型";
            CompareInt.AddField(CompareInt_RightType);
            //右边参数变量名
            CompareInt.AddField(new NodeField()
            {
                FieldName = "RightParameter", Label = "右参数名", FieldType = FieldType.StringField, Describe = "右边参数变量名"
            });
            AddClass(CompareInt);

            //比较Float节点
            NodeClass CompareFloat = new NodeClass();
            CompareFloat.ClassType = "CompareFloat";
            CompareFloat.Label     = "比较Float节点";
            CompareFloat.NodeType  = NodeType.Condition;
            CompareFloat.Describe  = "Compare节点对左右参数进行比较";
            //左边参数类型
            NodeField CompareFloat_LeftType = new NodeField()
            {
                FieldName = "LeftType", FieldType = FieldType.EnumField, Describe = ""
            };
            (CompareFloat_LeftType.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            CompareFloat_LeftType.Label = "左参数类型";
            CompareFloat.AddField(CompareFloat_LeftType);
            //左边参数变量名
            CompareFloat.AddField(new NodeField()
            {
                FieldName = "LeftParameter", Label = "左参数名", FieldType = FieldType.StringField, Describe = "左边参数变量名"
            });
            //比较符号
            NodeField CompareFloat_Type = new NodeField()
            {
                FieldName = "CompareType", FieldType = FieldType.EnumField, Describe = "比较符号<、>、<=、>=、==、!="
            };
            (CompareFloat_Type.DefaultValue as EnumDefaultValue).EnumType = "CompareType";
            CompareFloat_Type.Label = "比较操作符";
            CompareFloat.AddField(CompareFloat_Type);
            //右边边参数类型
            NodeField CompareFloat_RightType = new NodeField()
            {
                FieldName = "RightType", FieldType = FieldType.EnumField, Describe = ""
            };
            (CompareFloat_RightType.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            CompareFloat_RightType.Label = "右参数类型";
            CompareFloat.AddField(CompareFloat_RightType);
            //右边参数变量名
            CompareFloat.AddField(new NodeField()
            {
                FieldName = "RightParameter", Label = "右参数名", FieldType = FieldType.StringField, Describe = "右边参数变量名"
            });
            AddClass(CompareFloat);

            //比较String节点
            NodeClass CompareString = new NodeClass();
            CompareString.ClassType = "CompareString";
            CompareString.Label     = "比较String节点";
            CompareString.NodeType  = NodeType.Condition;
            CompareString.Describe  = "Compare节点对左右参数进行比较";
            //左边参数类型
            NodeField CompareString_LeftType = new NodeField()
            {
                FieldName = "LeftType", FieldType = FieldType.EnumField, Describe = ""
            };
            (CompareString_LeftType.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            CompareString_LeftType.Label = "左参数类型";
            CompareString.AddField(CompareString_LeftType);
            //左边参数变量名
            CompareString.AddField(new NodeField()
            {
                FieldName = "LeftParameter", Label = "左参数名", FieldType = FieldType.StringField, Describe = "左边参数变量名"
            });
            //比较符号
            NodeField CompareString_Type = new NodeField()
            {
                FieldName = "CompareType", FieldType = FieldType.EnumField, Describe = "比较符号<、>、<=、>=、==、!="
            };
            (CompareString_Type.DefaultValue as EnumDefaultValue).EnumType = "CompareType";
            CompareString_Type.Label = "比较操作符";
            CompareString.AddField(CompareString_Type);
            //右边边参数类型
            NodeField CompareString_RightType = new NodeField()
            {
                FieldName = "RightType", FieldType = FieldType.EnumField, Describe = ""
            };
            (CompareString_RightType.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            CompareString_RightType.Label = "右参数类型";
            CompareString.AddField(CompareString_RightType);
            //右边参数变量名
            CompareString.AddField(new NodeField()
            {
                FieldName = "RightParameter", Label = "右参数名", FieldType = FieldType.StringField, Describe = "右边参数变量名"
            });
            AddClass(CompareString);

            #endregion

            #region 动作节点

            //赋值节点Int
            NodeClass AssignmentInt = new NodeClass();
            AssignmentInt.ClassType = "AssignmentInt";
            AssignmentInt.Label     = "赋值节点(Int)";
            AssignmentInt.NodeType  = NodeType.Action;
            AssignmentInt.Describe  = "赋值节点";
            AssignmentInt.AddField(new NodeField()
            {
                FieldName = "ParameterName", Label = "变量名", FieldType = FieldType.StringField, Describe = "参数变量名"
            });
            AssignmentInt.AddField(new NodeField()
            {
                FieldName = "Parameter", Label = "赋值Int", FieldType = FieldType.IntField, Describe = "参数值"
            });
            AssignmentInt.ShowContent = true;
            AddClass(AssignmentInt);

            //赋值节点Float
            NodeClass AssignmentFloat = new NodeClass();
            AssignmentFloat.ClassType = "AssignmentFloat";
            AssignmentFloat.Label     = "赋值节点(Float)";
            AssignmentFloat.NodeType  = NodeType.Action;
            AssignmentFloat.Describe  = "赋值节点(Float)";
            AssignmentFloat.AddField(new NodeField()
            {
                FieldName = "ParameterName", Label = "变量名", FieldType = FieldType.StringField, Describe = "参数变量名"
            });
            AssignmentFloat.AddField(new NodeField()
            {
                FieldName = "Parameter", Label = "赋值Float", FieldType = FieldType.FloatField, Describe = "参数值"
            });
            AssignmentFloat.ShowContent = true;
            AddClass(AssignmentFloat);

            //赋值节点String
            NodeClass AssignmentString = new NodeClass();
            AssignmentString.ClassType = "AssignmentString";
            AssignmentString.Label     = "赋值节点(String)";
            AssignmentString.NodeType  = NodeType.Action;
            AssignmentString.Describe  = "赋值节点(String)";
            AssignmentString.AddField(new NodeField()
            {
                FieldName = "ParameterName", Label = "变量名", FieldType = FieldType.StringField, Describe = "参数变量名"
            });
            AssignmentString.AddField(new NodeField()
            {
                FieldName = "Parameter", Label = "赋值字符串", FieldType = FieldType.StringField, Describe = "参数值"
            });
            AssignmentString.ShowContent = true;
            AddClass(AssignmentString);

            //等待节点
            NodeClass Wait = new NodeClass();
            Wait.ClassType = "Wait";
            Wait.Label     = "等待节点";
            Wait.NodeType  = NodeType.Action;
            Wait.Describe  = "等待节点";
            NodeField WaintField = new NodeField()
            {
                FieldName = "Millisecond", Label = "等待时间(毫秒)", FieldType = FieldType.IntField, Describe = "等待时间(毫秒)"
            };
            IntDefaultValue WaintFieldDefaultField = WaintField.DefaultValue as IntDefaultValue;
            WaintFieldDefaultField.DefaultValue = 1000;
            Wait.AddField(WaintField);
            Wait.ShowContent = true;
            AddClass(Wait);

            //空操作节点
            NodeClass Noop = new NodeClass();
            Noop.ClassType = "Noop";
            Noop.Label     = "空操作节点";
            Noop.NodeType  = NodeType.Action;
            Noop.Describe  = "空操作节点";
            AddClass(Noop);

            #endregion
        }
Beispiel #16
0
        public void ResetNodes()
        {
            m_Nodes.Clear();
            #region 组合节点
            //并行节点
            NodeDefine parallelNode = new NodeDefine();
            parallelNode.ClassType = "Parallel";
            parallelNode.Label     = "并行节点";
            parallelNode.NodeType  = NodeType.Composite;
            parallelNode.Describe  = "Parallel节点在一般意义上是并行的执行其子节点,即“一边做A,一边做B”";
            //成功条件
            NodeField parallelNodeSuccessType = new NodeField()
            {
                FieldName = "SuccessType", FieldType = FieldType.EnumField, Describe = "成功条件"
            };
            EnumDefaultValue parallelNodeSuccessEnumDefaultValue = parallelNodeSuccessType.DefaultValue as EnumDefaultValue;
            parallelNodeSuccessEnumDefaultValue.EnumType     = "SUCCESS_POLICY";
            parallelNodeSuccessEnumDefaultValue.DefaultValue = "SUCCEED_ON_ALL";
            parallelNodeSuccessType.Label = "成功条件";
            parallelNode.AddField(parallelNodeSuccessType);
            //失败条件
            NodeField parallelNodeFailType = new NodeField()
            {
                FieldName = "FailType", FieldType = FieldType.EnumField, Describe = "失败条件"
            };
            EnumDefaultValue parallelNodeFailTypeEnumDefaultValue = parallelNodeFailType.DefaultValue as EnumDefaultValue;
            parallelNodeFailTypeEnumDefaultValue.EnumType     = "FAILURE_POLICY";
            parallelNodeFailTypeEnumDefaultValue.DefaultValue = "FAIL_ON_ONE";
            parallelNodeFailType.Label = "失败条件";
            parallelNode.AddField(parallelNodeFailType);
            AddClass(parallelNode);

            //顺序节点
            NodeDefine sequenceNode = new NodeDefine();
            sequenceNode.ClassType = "Sequence";
            sequenceNode.Label     = "顺序节点";
            sequenceNode.NodeType  = NodeType.Composite;
            sequenceNode.Describe  = "Sequence节点以给定的顺序依次执行其子节点,直到所有子节点成功返回,该节点也返回成功。只要其中某个子节点失败,那么该节点也失败。";
            AddClass(sequenceNode);

            //选择节点
            NodeDefine Selector = new NodeDefine();
            Selector.ClassType = "Selector";
            Selector.Label     = "选择节点";
            Selector.Category  = "";
            Selector.NodeType  = NodeType.Composite;
            Selector.Describe  = "选择节点";
            AddClass(Selector);

            //ifelse
            NodeDefine IfElse = new NodeDefine();
            IfElse.ClassType = "IfElse";
            IfElse.Label     = "IfElse";
            IfElse.NodeType  = NodeType.Composite;
            IfElse.Describe  = "";
            AddClass(IfElse);

            //随机节点
            NodeDefine Random = new NodeDefine();
            Random.ClassType = "Random";
            Random.Label     = "随机节点";
            Random.Category  = "随机";
            Random.NodeType  = NodeType.Composite;
            Random.Describe  = "随机节点";
            AddClass(Random);

            //随机选择节点
            NodeDefine RandomSelector = new NodeDefine();
            RandomSelector.ClassType = "RandomSelector";
            RandomSelector.Label     = "随机选择";
            RandomSelector.Category  = "随机";
            RandomSelector.NodeType  = NodeType.Composite;
            RandomSelector.Describe  = "随机选择节点";
            AddClass(RandomSelector);

            //随机序列节点
            NodeDefine RandomSequence = new NodeDefine();
            RandomSequence.ClassType = "RandomSequence";
            RandomSequence.Label     = "随机序列";
            RandomSequence.Category  = "随机";
            RandomSequence.NodeType  = NodeType.Composite;
            RandomSequence.Describe  = "随机序列节点";
            AddClass(RandomSequence);

            //概率选择节点
            NodeDefine SelectorProbability = new NodeDefine();
            SelectorProbability.ClassType = "SelectorProbability";
            SelectorProbability.Label     = "概率选择节点";
            SelectorProbability.Category  = "";
            SelectorProbability.NodeType  = NodeType.Composite;
            SelectorProbability.Describe  = "概率选择节点";
            SelectorProbability.AddField(new NodeField()
            {
                FieldName = "Priority", Label = "优先级", FieldType = FieldType.RepeatIntField, Describe = "", Show = true
            });
            AddClass(SelectorProbability);

            #endregion

            #region 装饰节点

            //成功节点
            NodeDefine Success = new NodeDefine();
            Success.ClassType = "Success";
            Success.Label     = "成功节点";
            Success.NodeType  = NodeType.Decorator;
            Success.Describe  = "成功节点";
            AddClass(Success);

            //失败节点
            NodeDefine Failure = new NodeDefine();
            Failure.ClassType = "Failure";
            Failure.Label     = "失败节点";
            Failure.NodeType  = NodeType.Decorator;
            Failure.Describe  = "失败节点";
            AddClass(Failure);

            //帧数节点用于在指定的帧数内,持续调用其子节点
            NodeDefine Frames = new NodeDefine();
            Frames.ClassType  = "Frames";
            Frames.Label      = "帧数节点";
            Frames.NodeType   = NodeType.Decorator;
            Frames.CheckField = true;
            NodeField FramesField = new NodeField()
            {
                FieldName = "Frames", Label = "持续帧数", FieldType = FieldType.IntField, Describe = "持续帧数", Show = true
            };
            (FramesField.DefaultValue as IntDefaultValue).DefaultValue = 1;
            Frames.AddField(FramesField);
            Frames.Describe = "帧数节点用于在指定的帧数内,持续调用其子节点";
            AddClass(Frames);

            //循环节点 -1无限循环
            NodeDefine Loop = new NodeDefine();
            Loop.ClassType = "Loop";
            Loop.Label     = "循环节点";
            Loop.NodeType  = NodeType.Decorator;
            Loop.Describe  = "循环节点 -1无限循环";
            Loop.AddField(new NodeField()
            {
                FieldName = "LoopTimes", Label = "循环次数", FieldType = FieldType.IntField, Describe = "循环次数", Show = true
            });
            AddClass(Loop);

            //取反节点
            NodeDefine Not = new NodeDefine();
            Not.ClassType = "Not";
            Not.Label     = "取反节点";
            Not.NodeType  = NodeType.Decorator;
            Not.Describe  = "取反节点";
            AddClass(Not);

            //指定时间内运行
            NodeDefine Time = new NodeDefine();
            Time.ClassType = "Time";
            Time.Label     = "时间";
            Time.NodeType  = NodeType.Decorator;
            Time.Describe  = "指定时间内运行";
            NodeField TimeField = new NodeField()
            {
                FieldName = "Duration", Label = "持续时间(毫秒)", FieldType = FieldType.IntField, Describe = "持续时间(毫秒)", Show = true
            };
            (TimeField.DefaultValue as IntDefaultValue).DefaultValue = 1000;
            Time.AddField(TimeField);
            AddClass(Time);

            //阻塞,直到子节点返回true
            NodeDefine SuccessUntil = new NodeDefine();
            SuccessUntil.ClassType = "SuccessUntil";
            SuccessUntil.Label     = "直到子节点返回True";
            SuccessUntil.NodeType  = NodeType.Decorator;
            SuccessUntil.Describe  = "直到子节点返回true";
            AddClass(SuccessUntil);

            #endregion

            #region 条件节点

            //比较节点
            NodeDefine Compare = new NodeDefine();
            Compare.ClassType = "Compare";
            Compare.Label     = "比较节点";
            Compare.NodeType  = NodeType.Condition;
            Compare.Describe  = "Compare节点对左右参数进行比较";
            //左边参数类型
            NodeField Compare_LeftType = new NodeField()
            {
                FieldName = "LeftType", FieldType = FieldType.EnumField, Describe = ""
            };
            (Compare_LeftType.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            Compare_LeftType.Label = "左参数类型";
            Compare.AddField(Compare_LeftType);
            //左边参数变量名
            Compare.AddField(new NodeField()
            {
                FieldName = "LeftParameter", Label = "左参数名", FieldType = FieldType.StringField, Describe = "左边参数变量名", Show = true
            });
            //左边常数值
            Compare.AddField(new NodeField()
            {
                FieldName = "LeftConstValue", Label = "左边常数值", FieldType = FieldType.IntField, Describe = "左边常数值,左边参数类型为Const生效"
            });

            //比较符号
            NodeField Compare_Type = new NodeField()
            {
                FieldName = "CompareType", FieldType = FieldType.EnumField, Describe = "比较符号<、>、<=、>=、==、!=", Show = true
            };
            (Compare_Type.DefaultValue as EnumDefaultValue).EnumType = "CompareType";
            Compare_Type.Label = "比较操作符";
            Compare.AddField(Compare_Type);

            //右边边参数类型
            NodeField Compare_RightType = new NodeField()
            {
                FieldName = "RightType", FieldType = FieldType.EnumField, Describe = ""
            };
            (Compare_RightType.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            Compare_RightType.Label = "右参数类型";
            Compare.AddField(Compare_RightType);
            //右边参数变量名
            Compare.AddField(new NodeField()
            {
                FieldName = "RightParameter", Label = "右参数名", FieldType = FieldType.StringField, Describe = "右边参数变量名", Show = true
            });
            AddClass(Compare);
            //左边常数值
            Compare.AddField(new NodeField()
            {
                FieldName = "RightConstValue", Label = "右边常数值", FieldType = FieldType.IntField, Describe = "右边常数值,右边参数类型为Const生效"
            });

            #endregion

            #region 动作节点

            //设置变量节点
            NodeDefine SetVariable = new NodeDefine();
            SetVariable.CheckField = false;
            SetVariable.ClassType  = "SetVariable";
            SetVariable.Label      = "设置变量节点";
            SetVariable.NodeType   = NodeType.Action;
            SetVariable.Describe   = "设置变量节点";
            NodeField setVariableNodeField = new NodeField()
            {
                FieldName = "ParameterType", FieldType = FieldType.EnumField, Describe = ""
            };
            (setVariableNodeField.DefaultValue as EnumDefaultValue).EnumType = "ParameterType";
            SetVariable.AddField(setVariableNodeField);
            SetVariable.AddField(new NodeField()
            {
                FieldName = "ParameterName", Label = "变量名", FieldType = FieldType.StringField, Describe = "参数变量名", Show = true
            });
            SetVariable.AddField(new NodeField()
            {
                FieldName = "ParameterValue", Label = "变量值", FieldType = FieldType.IntField, Describe = "参数值", Show = true
            });
            AddClass(SetVariable);

            //等待节点
            NodeDefine Wait = new NodeDefine();
            Wait.ClassType = "Wait";
            Wait.Label     = "等待节点";
            Wait.NodeType  = NodeType.Action;
            Wait.Describe  = "等待节点";
            NodeField WaintField = new NodeField()
            {
                FieldName = "Millisecond", Label = "等待时间(毫秒)", FieldType = FieldType.IntField, Describe = "等待时间(毫秒)", Show = true
            };
            IntDefaultValue WaintFieldDefaultField = WaintField.DefaultValue as IntDefaultValue;
            WaintFieldDefaultField.DefaultValue = 1000;
            Wait.AddField(WaintField);
            AddClass(Wait);

            //空操作节点
            NodeDefine Noop = new NodeDefine();
            Noop.ClassType = "Noop";
            Noop.Label     = "空操作节点";
            Noop.NodeType  = NodeType.Action;
            Noop.Describe  = "空操作节点";
            AddClass(Noop);

            //输出Log节点
            NodeDefine Log = new NodeDefine();
            Log.ClassType = "Log";
            Log.Label     = "输出节点";
            Log.NodeType  = NodeType.Action;
            Log.Describe  = "输出log节点";
            Log.AddField(new NodeField()
            {
                FieldName = "Content", Label = "输出内容", FieldType = FieldType.StringField, Describe = "输出的内容", Show = true
            });
            AddClass(Log);

            #endregion
        }