本文整理汇总了C#中IEvent.HasProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IEvent.HasProperty方法的具体用法?C# IEvent.HasProperty怎么用?C# IEvent.HasProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEvent
的用法示例。
在下文中一共展示了IEvent.HasProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryParse
/// <summary>
/// Tries to parse the given data to the target <see cref="IEvent"/>.
/// </summary>
/// <param name="eventParams">List of string-parameters to parse.</param>
/// <param name="target">Target instance to parse the data to.</param>
/// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
public bool TryParse(List<string> eventParams, IEvent target)
{
if (eventParams.Count < 4)
{
return false;
}
if (string.IsNullOrEmpty(eventParams[0]))
{
return false;
}
float posX, posY, posZ;
if( !float.TryParse(eventParams[1], out posX) ||
!float.TryParse(eventParams[2], out posY) ||
!float.TryParse(eventParams[3], out posZ) )
{
return false;
}
if (!target.HasProperty("EntityName") || !target.HasProperty("Target"))
{
return false;
}
UnityEngine.Vector3 targetPosition = new UnityEngine.Vector3();
targetPosition.x = posX;
targetPosition.y = posY;
targetPosition.z = posZ;
target.SetProperty("EntityName", eventParams[0]);
target.SetProperty("Target", targetPosition);
return true;
}
示例2: TryParse
/// <summary>
/// Tries to parse the given data to the target <see cref="IEvent"/>.
/// </summary>
/// <param name="eventParams">List of string-parameters to parse.</param>
/// <param name="target">Target instance to parse the data to.</param>
/// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
public bool TryParse(List<string> eventParams, IEvent target)
{
if (eventParams.Count < 2)
{
return false;
}
if (string.IsNullOrEmpty(eventParams[0]))
{
return false;
}
float duration;
if (!float.TryParse(eventParams[1], out duration))
{
return false;
}
if(!target.HasProperty("Name") || !target.HasProperty("Duration"))
{
return false;
}
target.SetProperty("Name", eventParams[0]);
target.SetProperty("Duration", duration);
return true;
}
示例3: TryParse
/// <summary>
/// Tries to parse the given data to the target <see cref="IEvent"/>.
/// </summary>
/// <param name="eventParams">List of string-parameters to parse.</param>
/// <param name="target">Target instance to parse the data to.</param>
/// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
public bool TryParse(List<string> eventParams, IEvent target)
{
if (eventParams.Count < 2)
{
return false;
}
if (string.IsNullOrEmpty(eventParams[0]) || string.IsNullOrEmpty(eventParams[1]))
{
return false;
}
if (!target.HasProperty("EntityName") || !target.HasProperty("ComponentName"))
{
return false;
}
target.SetProperty("EntityName", eventParams[0]);
target.SetProperty("ComponentName", eventParams[1]);
return true;
}
示例4: TryParse
/// <summary>
/// Tries to parse the given data to the target <see cref="IEvent"/>.
/// </summary>
/// <param name="eventParams">List of string-parameters to parse.</param>
/// <param name="target">Target instance to parse the data to.</param>
/// <returns><c>true</c> if the parsing was succesful, otherwise <c>false</c> is returned.</returns>
public bool TryParse(List<string> eventParams, IEvent target)
{
if (eventParams.Count < 1)
{
return false;
}
if (string.IsNullOrEmpty(eventParams[0]))
{
return false;
}
if (!target.HasProperty("SceneName"))
{
return false;
}
target.SetProperty("SceneName", eventParams[0]);
return true;
}