本文整理汇总了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);
}
示例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);
}
}
}
示例3: CloneProperties
protected override void CloneProperties(Node newnode)
{
base.CloneProperties(newnode);
DecoratorLog dec = (DecoratorLog)newnode;
dec._logMessage = _logMessage;
}
示例4: CloneProperties
protected override void CloneProperties(Node newnode)
{
base.CloneProperties(newnode);
DecoratorLoopUntil node = (DecoratorLoopUntil)newnode;
node._until = this._until;
}
示例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);
}
}
}
示例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;
}
示例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();
}
示例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;
}
示例9: CloneProperties
protected override void CloneProperties(Node newnode)
{
base.CloneProperties(newnode);
State state = (State)newnode;
state._method = this._method;
}
示例10: CloneProperties
protected override void CloneProperties(Node newnode)
{
base.CloneProperties(newnode);
Wait dec = (Wait)newnode;
if (_time != null)
dec._time = (RightValueDef)_time.Clone();
}
示例11: CloneProperties
protected override void CloneProperties(Node newnode)
{
base.CloneProperties(newnode);
ExampleNode dec = (ExampleNode)newnode;
if (_time != null)
dec._time = (VariableDef)_time.Clone();
}
示例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;
}
示例13: CloneProperties
protected override void CloneProperties(Node newnode)
{
base.CloneProperties(newnode);
DecoratorCount dec = (DecoratorCount)newnode;
if (_count != null)
dec._count = (VariableDef)_count.Clone();
}
示例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;
}
示例15: CloneProperties
protected override void CloneProperties(Node newnode)
{
base.CloneProperties(newnode);
WaitFrames dec = (WaitFrames)newnode;
if (_frames != null)
dec._frames = (RightValueDef)_frames.Clone();
}