本文整理汇总了C#中Agent.FindMember方法的典型用法代码示例。如果您正苦于以下问题:C# Agent.FindMember方法的具体用法?C# Agent.FindMember怎么用?C# Agent.FindMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent.FindMember方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LogVarValue
public void LogVarValue(Agent pAgent, string name, object value)
{
#if !BEHAVIAC_RELEASE
if (Config.IsLoggingOrSocketing)
{
string valueStr = StringUtils.ToString(value);
string typeName = "";
if (!Object.ReferenceEquals(value, null))
{
typeName = Utils.GetNativeTypeName(value.GetType());
}
else
{
typeName = "Agent";
}
string full_name = name;
if (!Object.ReferenceEquals(pAgent, null))
{
CMemberBase pMember = pAgent.FindMember(name);
if (pMember != null)
{
string classFullName = pMember.GetClassNameString().Replace(".", "::");
full_name = string.Format("{0}::{1}", classFullName, name);
}
}
LogManager.Instance.Log(pAgent, typeName, full_name, valueStr);
}
#endif
}
示例2: Log
public void Log(Agent pAgent)
{
//BEHAVIAC_ASSERT(this.m_changed);
string valueStr = StringUtils.ToString(this.m_value);
string typeName = "";
if (!Object.ReferenceEquals (this.m_value, null)) {
typeName = Utils.GetNativeTypeName (this.m_value.GetType ());
} else {
typeName = "Agent";
}
string full_name = this.m_name;
if (!Object.ReferenceEquals(pAgent, null))
{
CMemberBase pMember = pAgent.FindMember(this.m_name);
if (pMember != null)
{
string classFullName = pMember.GetClassNameString().Replace(".", "::");
full_name = string.Format("{0}::{1}", classFullName, this.m_name);
}
}
LogManager.Log(pAgent, typeName, full_name, valueStr);
#if !BEHAVIAC_RELEASE
this.m_changed = false;
#endif
}
示例3: Set
public void Set(Agent pAgent, CMemberBase pMember, string variableName, object value, uint varId)
{
Debug.Check(!string.IsNullOrEmpty(variableName));
if (varId == 0)
{
varId = Utils.MakeVariableId(variableName);
}
IVariable pVar = null;
if (!this.m_variables.ContainsKey(varId))
{
if (pMember == null)
{
if (pAgent != null)
{
pMember = pAgent.FindMember(variableName);
}
else
{
pMember = Agent.FindMemberBase(variableName);
}
}
pVar = new IVariable(pMember, variableName, varId);
behaviac.Debug.Check(pVar != null);
m_variables[varId] = pVar;
}
else
{
pVar = this.m_variables[varId];
}
pVar.SetValue(value, pAgent);
}
示例4: Get
public object Get(Agent pAgent, uint varId)
{
if (!this.m_variables.ContainsKey(varId))
{
//possible static property
CMemberBase pMember = pAgent.FindMember(varId);
if (pMember != null)
{
object pAddr = pMember.Get(pAgent);
return pAddr;
}
//Debug.Check(false, "a compatible property is not found");
}
else
{
//par
IVariable pVar = this.m_variables[varId];
{
Property refPropety = pVar.GetProperty();
if (refPropety != null)
{
string refName = refPropety.GetRefName();
if (!string.IsNullOrEmpty(refName))
{
return this.Get(pAgent, refPropety.GetRefNameId());
}
}
return pVar.GetValue(pAgent);
}
}
return null;
}
示例5: SetFromString
public void SetFromString(Agent pAgent, string variableName, string valueStr)
{
Debug.Check(!string.IsNullOrEmpty(variableName));
//to skip class name
string variableNameOnly = Utils.GetNameWithoutClassName(variableName);
CMemberBase pMember = pAgent.FindMember(variableNameOnly);
uint varId = Utils.MakeVariableId(variableNameOnly);
if (this.m_variables.ContainsKey(varId))
{
IVariable pVar = this.m_variables[varId];
pVar.SetFromString(pAgent, pMember, valueStr);
}
}