当前位置: 首页>>代码示例>>C#>>正文


C# Nodes.Node类代码示例

本文整理汇总了C#中Behaviac.Design.Nodes.Node的典型用法代码示例。如果您正苦于以下问题:C# Node类的具体用法?C# Node怎么用?C# Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Node类属于Behaviac.Design.Nodes命名空间,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateMethod

        protected override void GenerateMethod(Node node, StreamWriter stream, string indent)
        {
            base.GenerateMethod(node, stream, indent);

            ReferencedBehavior referencedBehavior = node as ReferencedBehavior;
            if (referencedBehavior == null)
                return;

            stream.WriteLine("{0}\t\tvirtual const char* GetReferencedTree(const Agent* pAgent) const", indent);
            stream.WriteLine("{0}\t\t{{", indent);
            stream.WriteLine("{0}\t\t\tBEHAVIAC_UNUSED_VAR(pAgent);", indent);

            string retStr = RightValueCppExporter.GenerateCode(referencedBehavior.ReferenceBehavior, stream, indent + "\t\t\t", "const char*", string.Empty, "_referencedBehavior");

            bool bConst = false;
            if (referencedBehavior.ReferenceBehavior.Var != null && referencedBehavior.ReferenceBehavior.Var.IsConst)
            {
                bConst = true;
            }

            if (!bConst)
            {
                stream.WriteLine("{0}\t\t\tif (pAgent) {{", indent);
            }

            stream.WriteLine("{0}\t\t\treturn {1};", indent, retStr);

            if (!bConst)
            {
                stream.WriteLine("{0}\t\t\t}}", indent);
                stream.WriteLine("{0}\t\t\treturn 0;", indent);
            }

            stream.WriteLine("{0}\t\t}}", indent);
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:35,代码来源:ReferencedBehaviorCppExporter.cs

示例2: GenerateConstructor

        protected override void GenerateConstructor(Node node, StreamWriter stream, string indent, string className)
        {
            base.GenerateConstructor(node, stream, indent, className);

            DecoratorIterator iterator = node as DecoratorIterator;
            if (iterator == null)
                return;

            if (iterator.Opl != null || iterator.Opr != null)
            {
                if (iterator.Opl != null)
                {
                    stream.WriteLine("{0}\t\t\tthis.m_opl = Condition.LoadLeft(\"{1}\");", indent, iterator.Opl.GetExportValue());
                    stream.WriteLine("{0}\t\t\tDebug.Check(this.m_opl != null);", indent);
                }

                stream.WriteLine("{0}\t\t\tstring typeName = null;", indent);

                if (iterator.Opr != null)
                {
                    stream.WriteLine("{0}\t\t\tthis.m_opr = Condition.LoadRight(\"{1}\", ref typeName);", indent, iterator.Opr.GetExportValue());
                    stream.WriteLine("{0}\t\t\tDebug.Check(this.m_opr != null);", indent);
                }
            }
        }
开发者ID:675492062,项目名称:behaviac,代码行数:25,代码来源:DecoratorIteratorCsExporter.cs

示例3: CloneProperties

        protected override void CloneProperties(Node newnode)
        {
            base.CloneProperties(newnode);

            DecoratorLog dec = (DecoratorLog)newnode;
            dec._logMessage = _logMessage;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:7,代码来源:DecoratorLog.cs

示例4: CloneProperties

        protected override void CloneProperties(Node newnode)
        {
            base.CloneProperties(newnode);

            DecoratorLoopUntil node = (DecoratorLoopUntil)newnode;
            node._until = this._until;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:7,代码来源:DecoratorLoopUntil.cs

示例5: ExportAttachment

        private void ExportAttachment(StreamWriter file, string btClassName, string agentType, string parentName, Node node, string indent)
        {
            if (node.Attachments.Count > 0)
            {
                file.WriteLine("{0}// attachments", indent);
                foreach (Behaviac.Design.Attachments.Attachment attach in node.Attachments)
                {
                    file.WriteLine("{0}{{", indent);

                    string nodeName = string.Format("attach{0}", attach.Id);

                    // export its instance and the properties
                    AttachmentCsExporter attachmentExporter = AttachmentCsExporter.CreateInstance(attach);
                    attachmentExporter.GenerateInstance(attach, file, indent, nodeName, agentType, btClassName);

                    ExportPars(file, nodeName, attach, indent);

                    file.WriteLine("{0}\t{1}.Attach({2});", indent, parentName, nodeName);
                    if (attach is Behaviac.Design.Attachments.Event)
                    {
                        file.WriteLine("{0}\t{1}.SetHasEvents({1}.HasEvents() | ({2} is Event));", indent, parentName, nodeName);
                    }
                    file.WriteLine("{0}}}", indent);
                }
            }
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:26,代码来源:ExporterCs.cs

示例6: SubItemProperty

 /// <summary>
 /// Creates a new subitem which can show a property on the node.
 /// </summary>
 /// <param name="owner">The node whose property we want to show. MUST be the same as the one the subitem belongs to.</param>
 /// <param name="property">The property we want to show.</param>
 /// <param name="att">The attribute associated with the property.</param>
 public SubItemProperty(Node owner, PropertyInfo property, DesignerProperty att)
     : base(null, null, __font, Brushes.White, Alignment.Center, false)
 {
     _owner = owner;
     _property = property;
     _attribute = att;
 }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:13,代码来源:NodeViewData.SubItemProperty.cs

示例7: CreateInstance

        public static NodeCppExporter CreateInstance(Node node)
        {
            if (node != null)
            {
                string nodeExporter = "PluginBehaviac.NodeExporters." + node.ExportClass + "CppExporter";
                Type exporterType = Type.GetType(nodeExporter);
                if (exporterType == null)
                {
                    foreach (Assembly assembly in Plugin.GetLoadedPlugins())
                    {
                        string filename = Path.GetFileNameWithoutExtension(assembly.Location);
                        nodeExporter = filename + ".NodeExporters." + node.ExportClass + "CppExporter";
                        exporterType = assembly.GetType(nodeExporter);
                        if (exporterType != null)
                        {
                            break;
                        }
                    }
                }

                if (exporterType != null)
                {
                    return (NodeCppExporter)Activator.CreateInstance(exporterType);
                }
            }

            return new NodeCppExporter();
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:28,代码来源:NodeCppExporter.cs

示例8: SetPar

        public void SetPar(ParInfo par, Nodes.Node rootNode, bool isNewPar)
        {
            Debug.Check(par != null && rootNode != null);

            _isNewPar = isNewPar;
            _initialized = false;

            this.Text = isNewPar ? Resources.NewPar : Resources.EditPar;

            _par = par;
            _parTemp = par.Clone();
            _rootNode = rootNode;

            setParTypes();

            if (par != null) {
                _isArray = Plugin.IsArrayType(par.Type);
                Type type = _isArray ? par.Type.GetGenericArguments()[0] : par.Type;

                nameTextBox.Text = par.Name;
                arrayCheckBox.Checked = _isArray;
                typeComboBox.Text = Plugin.GetMemberValueTypeName(type);
                descTextBox.Text = par.BasicDescription;

                setValue(type);
            }

            enableOkButton();

            _initialized = true;
        }
开发者ID:wuzhen,项目名称:behaviac,代码行数:31,代码来源:ParSettingsDialog.cs

示例9: CloneProperties

        protected override void CloneProperties(Node newnode)
        {
            base.CloneProperties(newnode);

            State state = (State)newnode;

            state._method = this._method;
        }
开发者ID:XyzalZhang,项目名称:behaviac,代码行数:8,代码来源:State.cs

示例10: CloneProperties

        protected override void CloneProperties(Node newnode)
        {
            base.CloneProperties(newnode);

            Wait dec = (Wait)newnode;
            if (_time != null)
                dec._time = (RightValueDef)_time.Clone();
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:8,代码来源:Wait.cs

示例11: CloneProperties

        protected override void CloneProperties(Node newnode)
        {
            base.CloneProperties(newnode);

            ExampleNode dec = (ExampleNode)newnode;
            if (_time != null)
                dec._time = (VariableDef)_time.Clone();
        }
开发者ID:675492062,项目名称:behaviac,代码行数:8,代码来源:ExampleNode.cs

示例12: MayProcessCheckOnly

        /// <summary>
        /// Checks if a node may be processed without running into circular references. The node is not added to the list.
        /// </summary>
        /// <param name="node">The node we want to process.</param>
        /// <returns>Returns true when the node may be processed, if not the calling function has to stop.</returns>
        public bool MayProcessCheckOnly(Node node) {
            ReferencedBehavior refnode = node as ReferencedBehavior;

            if (refnode != null)
            { return !_processedBehaviors.Contains(refnode); }

            return true;
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:13,代码来源:ProcessedBehaviors.cs

示例13: CloneProperties

		protected override void CloneProperties(Node newnode)
		{
			base.CloneProperties(newnode);

            DecoratorCount dec = (DecoratorCount)newnode;
            if (_count != null)
                dec._count = (VariableDef)_count.Clone();
		}
开发者ID:675492062,项目名称:behaviac,代码行数:8,代码来源:DecoratorCount.cs

示例14: Branch

        /// <summary>
        /// Branches the list for a node.
        /// </summary>
        /// <param name="node">The node we are branching for.</param>
        /// <returns>A new list which contains the previously processed behaviours for referenced behaviours. For other nodes it returns the same list.</returns>
        public ProcessedBehaviors Branch(Node node)
        {
            ReferencedBehaviorNode refnode= node as ReferencedBehaviorNode;
            if(refnode !=null)
                return new ProcessedBehaviors(this);

            return this;
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:13,代码来源:ProcessedBehaviors.cs

示例15: CloneProperties

        protected override void CloneProperties(Node newnode)
        {
            base.CloneProperties(newnode);

            WaitFrames dec = (WaitFrames)newnode;
            if (_frames != null)
                dec._frames = (RightValueDef)_frames.Clone();
        }
开发者ID:XyzalZhang,项目名称:behaviac,代码行数:8,代码来源:WaitFrames.cs


注:本文中的Behaviac.Design.Nodes.Node类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。