本文整理汇总了C#中Behaviac类的典型用法代码示例。如果您正苦于以下问题:C# Behaviac类的具体用法?C# Behaviac怎么用?C# Behaviac使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Behaviac类属于命名空间,在下文中一共展示了Behaviac类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateCode
public static string GenerateCode(Behaviac.Design.PropertyDef property, StreamWriter stream, string indent, string typename, string var, string caller)
{
string agentName = getGenerateAgentName(property, var, caller);
if (property.Owner != Behaviac.Design.VariableDef.kSelf)
{
stream.WriteLine("{0}Agent* {1} = Agent::GetInstance(\"{2}\", pAgent->GetContextId());", indent, agentName, property.Owner);
stream.WriteLine("{0}BEHAVIAC_ASSERT({1});", indent, agentName);
}
//string retStr = string.Format("(({0}*){1})->{2}", property.ClassName, agentName, property.Name);
string propName = property.Name.Replace("::", "_");
string nativeType = DataCppExporter.GetGeneratedNativeType(property.NativeType);
string retStr = string.Format("(({0}*){1})->_Get_Property_<{2}PROPERTY_TYPE_{3}, {4} >()", property.ClassName, agentName, getNamespace(property.ClassName), propName, nativeType);
if (!string.IsNullOrEmpty(var))
{
if (string.IsNullOrEmpty(typename))
{
stream.WriteLine("{0}{1} = {2};", indent, var, retStr);
}
else
{
stream.WriteLine("{0}{1}& {2} = {3};", indent, DataCppExporter.GetGeneratedNativeType(property.NativeType), var, retStr);
}
}
return retStr;
}
示例2: GenerateCode
public static string GenerateCode(Behaviac.Design.PropertyDef property, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null)
{
string agentName = getGenerateAgentName(property, var, caller);
if (property.Owner != Behaviac.Design.VariableDef.kSelf)
{
stream.WriteLine("{0}behaviac.Agent {1} = behaviac.Agent.GetInstance(\"{2}\", pAgent.GetContextId());", indent, agentName, property.Owner.Replace("::", "."));
stream.WriteLine("{0}Debug.Check({1} != null);", indent, agentName);
}
string prop = getProperty(property, agentName);
if (setValue == null)
{
if (!string.IsNullOrEmpty(var))
{
if (string.IsNullOrEmpty(typename))
{
stream.WriteLine("{0}{1} = {2};", indent, var, prop);
}
else
{
stream.WriteLine("{0}{1} {2} = {3};", indent, DataCsExporter.GetGeneratedNativeType(property.NativeType), var, prop);
}
}
}
else
{
stream.WriteLine("{0}AgentExtra_Generated.SetProperty({1}, \"{2}\", {3});", indent, agentName, property.BasicName, setValue);
}
return prop;
}
示例3: CreateNodeViewData
public override NodeViewData CreateNodeViewData(NodeViewData parent, Behaviac.Design.Nodes.BehaviorNode rootBehavior)
{
NodeViewData nvd = base.CreateNodeViewData(parent, rootBehavior);
nvd.ChangeShape(NodeShape.Rectangle);
return nvd;
}
示例4: GenerateClassConstructor
public static void GenerateClassConstructor(Behaviac.Design.VariableDef variable, StreamWriter stream, string indent, string var)
{
if (variable.ValueClass == Behaviac.Design.VariableDef.kConst)
{
Type type = variable.Value.GetType();
if (Plugin.IsRefType(type))
{
string nativeType = DataCppExporter.GetBasicGeneratedNativeType(variable.NativeType);
stream.WriteLine("{0}\t\t\t{1} = NULL;", indent, var);
}
else if (Plugin.IsArrayType(type) || Plugin.IsCustomClassType(type) || Plugin.IsStringType(type))
{
if (Plugin.IsArrayType(type))
{
string nativeType = DataCppExporter.GetGeneratedNativeType(variable.NativeType);
int startIndex = nativeType.IndexOf('<');
int endIndex = nativeType.LastIndexOf('>');
string itemType = nativeType.Substring(startIndex + 1, endIndex - startIndex - 1);
ArrayCppExporter.GenerateCode(variable.Value, stream, indent + "\t\t\t", itemType, var);
}
else if (Plugin.IsCustomClassType(type))
{
StructCppExporter.GenerateCode(variable.Value, stream, indent + "\t\t\t", var, null, "");
}
else if (Plugin.IsStringType(type))
{
string nativeType = DataCppExporter.GetBasicGeneratedNativeType(variable.NativeType);
string retStr = DataCppExporter.GenerateCode(variable.Value, stream, indent + "\t\t\t", nativeType, string.Empty, string.Empty);
stream.WriteLine("{0}\t\t\t{1} = {2};", indent, var, retStr);
}
}
}
}
示例5: PostGenerateCode
public static void PostGenerateCode(Behaviac.Design.PropertyDef property, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null)
{
if (property.IsPar || property.IsCustomized)
{
ParInfoCppExporter.PostGenerateCode(property, stream, indent, typename, var, caller);
return;
}
string agentName = GetGenerateAgentName(property, var, caller);
string prop = setValue;
if (setValue == null)
{
if (property.IsPublic)
{
prop = string.Format("(({0}*){1})->{2}", property.ClassName, agentName, property.BasicName);
}
else
{
string propName = property.Name.Replace("::", "_");
propName = propName.Replace("[]", "");
string nativeType = DataCppExporter.GetGeneratedNativeType(property.NativeType);
prop = string.Format("(({0}*){1})->_Get_Property_<{2}PROPERTY_TYPE_{3}, {4} >()", property.ClassName, agentName, getNamespace(property.ClassName), propName, nativeType);
}
}
string propBasicName = property.BasicName.Replace("[]", "");
uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName);
stream.WriteLine("{0}BEHAVIAC_ASSERT(behaviac::MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id);
stream.WriteLine("{0}{1}->SetVariable(\"{2}\", {3}, {4}u);", indent, agentName, propBasicName, prop, id);
}
示例6: GenerateCode
public static string GenerateCode(Behaviac.Design.VariableDef variable, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller)
{
string retStr = string.Empty;
if (variable.ValueClass == Behaviac.Design.VariableDef.kConst)
{
bool shouldGenerate = true;
Type type = variable.Value.GetType();
if (Plugin.IsArrayType(type) || Plugin.IsCustomClassType(type) || Plugin.IsStringType(type))
{
shouldGenerate = false;
}
if (shouldGenerate)
{
retStr = DataCppExporter.GenerateCode(variable.Value, stream, indent, typename, var, caller);
}
}
else if (variable.Property != null)
{
retStr = PropertyCppExporter.GenerateCode(variable.Property, variable.ArrayIndexElement, isRefParam, stream, indent, typename, var, caller);
}
return retStr;
}
示例7: GenerateClassMember
public static void GenerateClassMember(Behaviac.Design.VariableDef variable, StreamWriter stream, string indent, string var)
{
if (variable.ValueClass == Behaviac.Design.VariableDef.kConst)
{
Type type = variable.Value.GetType();
if (Plugin.IsArrayType(type) || Plugin.IsCustomClassType(type) || Plugin.IsStringType(type))
{
string nativeType = DataCsExporter.GetGeneratedNativeType(variable.NativeType);
bool setNull = Plugin.IsArrayType(type);
if (!setNull && Plugin.IsCustomClassType(type))
{
Attribute[] attributes = (Attribute[])type.GetCustomAttributes(typeof(Behaviac.Design.ClassDescAttribute), false);
if (attributes.Length > 0)
{
Behaviac.Design.ClassDescAttribute classDesc = (Behaviac.Design.ClassDescAttribute)attributes[0];
if (!classDesc.IsStruct)
setNull = true;
}
}
if (setNull)
{
var += " = null";
}
stream.WriteLine("{0}\t\t{1} {2};", indent, nativeType, var);
}
}
}
示例8: GenerateCode
public static string GenerateCode(Behaviac.Design.ParInfo par, StreamWriter stream, string indent, string typename, string var, string caller)
{
bool shouldDefineType = true;
if (string.IsNullOrEmpty(typename))
{
shouldDefineType = false;
typename = par.NativeType;
}
typename = DataCsExporter.GetGeneratedNativeType(typename);
uint id = Behaviac.Design.CRC32.CalcCRC(par.Name);
stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, par.Name, id);
string retStr = string.Format("({0})pAgent.GetVariable({1}u)", typename, id);
if (!string.IsNullOrEmpty(var))
{
if (shouldDefineType)
stream.WriteLine("{0}{1} {2} = {3};", indent, typename, var, retStr);
else
stream.WriteLine("{0}{1} = {2};", indent, var, retStr);
}
return retStr;
}
示例9: PostGenerateCode
public static void PostGenerateCode(Behaviac.Design.PropertyDef property, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null)
{
string agentName = getGenerateAgentName(property, var, caller);
string prop = setValue;
if (property.Owner != Behaviac.Design.VariableDef.kSelf)
{
stream.WriteLine("{0}behaviac.Agent {1} = behaviac.Agent.GetInstance(\"{2}\", pAgent.GetContextId());", indent, agentName, property.Owner.Replace("::", "."));
stream.WriteLine("{0}Debug.Check({1} != null);", indent, agentName);
}
if (setValue != null)
{
stream.WriteLine("{0}AgentExtra_Generated.SetProperty({1}, \"{2}\", {3});", indent, agentName, property.BasicName, prop);
}
else
{
prop = getProperty(property, agentName);
}
uint id = Behaviac.Design.CRC32.CalcCRC(property.BasicName);
stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, property.BasicName, id);
stream.WriteLine("{0}{1}.SetVariable(\"{2}\", {3}, {4}u);", indent, agentName, property.BasicName, prop, id);
}
示例10: GenerateCode
public static string GenerateCode(Behaviac.Design.ParInfo par, StreamWriter stream, string indent, string typename, string var, string caller)
{
bool shouldDefineType = true;
if (string.IsNullOrEmpty(typename))
{
shouldDefineType = false;
typename = DataCppExporter.GetGeneratedNativeType(par.NativeType);
}
uint id = Behaviac.Design.CRC32.CalcCRC(par.Name);
stream.WriteLine("{0}BEHAVIAC_ASSERT(behaviac::MakeVariableId(\"{1}\") == {2}u);", indent, par.Name, id);
typename = DataCppExporter.GetBasicGeneratedNativeType(typename);
string retStr = string.Format("pAgent->GetVariable<{0} >({1}u)", typename, id);
if (!string.IsNullOrEmpty(var))
{
if (shouldDefineType)
stream.WriteLine("{0}{1}& {2} = ({1}&){3};", indent, typename, var, retStr);
else
stream.WriteLine("{0}{1} = {2};", indent, var, retStr);
}
return retStr;
}
示例11: GenerateCode
public static string GenerateCode(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null)
{
if (property.IsPar || property.IsCustomized)
return ParInfoCsExporter.GenerateCode(property, isRefParam, stream, indent, typename, var, caller);
string agentName = GetGenerateAgentName(property, var, caller);
string prop = GetProperty(property, arrayIndexElement, stream, indent, var, caller);
if (!property.IsReadonly)
{
if (setValue == null)
{
if (!string.IsNullOrEmpty(var))
{
if (string.IsNullOrEmpty(typename))
{
stream.WriteLine("{0}{1} = {2};", indent, var, prop);
}
else
{
string nativeType = DataCsExporter.GetPropertyNativeType(property, arrayIndexElement);
stream.WriteLine("{0}{1} {2} = {3};", indent, nativeType, var, prop);
}
}
}
else
{
string propBasicName = property.BasicName.Replace("[]", "");
stream.WriteLine("{0}AgentExtra_Generated.SetProperty({1}, \"{2}\", {3});", indent, agentName, propBasicName, setValue);
}
}
return prop;
}
示例12: CreateNodeViewData
public override NodeViewData CreateNodeViewData(NodeViewData parent, Behaviac.Design.Nodes.BehaviorNode rootBehavior)
{
NodeViewDataStyled nvd = new NodeViewDataStyled(parent, rootBehavior, this, null, __defaultBackgroundBrush, _label, _description);
nvd.ChangeShape(NodeShape.Rectangle);
return nvd;
}
示例13: CloneProperties
protected override void CloneProperties(Behaviac.Design.Attachments.Attachment newattach)
{
base.CloneProperties(newattach);
Effector prec = (Effector)newattach;
prec._phase = _phase;
}
示例14: CloneProperties
protected override void CloneProperties(Behaviac.Design.Attachments.Attachment newattach)
{
base.CloneProperties(newattach);
StartCondition con = (StartCondition)newattach;
con.TargetFSMNodeId = this.TargetFSMNodeId;
}
示例15: CloneProperties
protected override void CloneProperties(Behaviac.Design.Attachments.Attachment newattach)
{
base.CloneProperties(newattach);
Precondition prec = (Precondition)newattach;
prec._binary = _binary;
prec._phase = _phase;
}