本文整理汇总了C#中Action.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Action.GetType方法的具体用法?C# Action.GetType怎么用?C# Action.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Action
的用法示例。
在下文中一共展示了Action.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: remove
public Action remove(Action action)
{
Action toRemove = action;
//actions.Remove(action);
actions.RemoveAll(x => x.GetType() == action.GetType());
return toRemove;
}
示例2: FromAction
internal static CfAction FromAction(Action source)
{
if (source == null)
{
return null;
}
CfAction item = null;
if (source.GetType() == typeof(Text))
{
item = TextMapper.FromText((Text)source);
}
else if (source.GetType() == typeof(Call))
{
item = CallMapper.FromCall((Call)source);
}
return item;
}
示例3: CopyProperties
protected override void CopyProperties(Action sourceAction)
{
if (sourceAction.GetType() == base.GetType())
{
base.CopyProperties(sourceAction);
ClassId = ((ComHandlerAction)sourceAction).ClassId;
Data = ((ComHandlerAction)sourceAction).Data;
}
}
示例4: has
public bool has(Action action)
{
//Console.WriteLine(action.GetType());
//Console.WriteLine("Num actions in has:" + actions.Count);
if (actions.Count > 0)
{
for (int i = 0; i < actions.Count; i++)
{
Action curAction = actions.ElementAt(i);
//Console.WriteLine(curAction.GetType());
if (curAction.GetType().Equals(action.GetType()))
{
//Console.WriteLine("this worked");
return true;
}
}
return false;
}
else
{
return false;
}
}
示例5: addAction
public void addAction(Action a)
{
if (actions.Count > 0)
{
Action current = actions[0];
int pr = current.getPriority();
if (a.GetType() == typeof(Attack)) //remove all attack actions ( new is better)
{
actions.RemoveAll((x) => x.getPriority() == pr); // has same priority as currently playing
}
}
actions.Add(a);
sortActions();
}
示例6: Copy
public void Copy(Action obj)
{
if (obj == null)
return;
// copy all of the properties
foreach (PropertyInfo pi in obj.GetType().GetProperties())
{
// get the value of the property
var val = pi.GetValue(obj, null);
pi.SetValue(this, val, null);
}
}
示例7: CopyProperties
/// <summary>
/// Copies the properties from another <see cref="Action" /> the current instance.
/// </summary>
/// <param name="sourceAction">
/// The source <see cref="Action" /> .
/// </param>
protected override void CopyProperties(Action sourceAction) {
if (sourceAction.GetType() == GetType()) {
base.CopyProperties(sourceAction);
Title = ((ShowMessageAction)sourceAction).Title;
MessageBody = ((ShowMessageAction)sourceAction).MessageBody;
}
}
示例8: CheckType
private static bool CheckType(Action<string> a)
{
return a.GetType() == typeof(Action<object>);
}
示例9: GetActionTypeIndex
/**
* <summary>Gets the index number of an Action within EnabledActions.</summary>
* <param name = "_action">The Action to search for</param>
* <returns>The index number of the Action within EnabledActions</returns>
*/
public int GetActionTypeIndex(Action _action)
{
string className = _action.GetType ().ToString ();
className = className.Replace ("AC.", "");
foreach (ActionType actionType in EnabledActions)
{
if (actionType.fileName == className)
{
return EnabledActions.IndexOf (actionType);
}
}
return defaultClass;
}
示例10: IsTypeOf
/// <summary>
/// Determines whether this instance is type of the specified action.
/// A test to see if this action is the same as another action. Remember
/// that they don't have to have the same type to be of the same type.
/// Consider the "Manage" action which covers ALL actions.
/// </summary>
/// <returns><c>true</c> if this instance is same as the specified action; otherwise, <c>false</c>.</returns>
/// <param name="action">The action</param>
public virtual bool IsTypeOf(Action action)
{
return this.GetType() == action.GetType();
}
示例11: GetActionSubCategory
/**
* <summary>Gets the index of an Action within a list of all Actions that share it's category.</summary>
* <param name = "_action">The Action to get the index of</param>
* <returns>The index of the Action within a list of all Actions that share it's category</returns>
*/
public int GetActionSubCategory(Action _action)
{
string fileName = _action.GetType ().ToString ().Replace ("AC.", "");
ActionCategory _category = _action.category;
// Learn category
foreach (ActionType type in EnabledActions)
{
if (type.fileName == fileName)
{
_category = type.category;
}
}
// Learn subcategory
int i=0;
foreach (ActionType type in EnabledActions)
{
if (type.category == _category)
{
if (type.fileName == fileName)
{
return i;
}
i++;
}
}
ACDebug.LogWarning ("Error building Action " + _action);
return 0;
}
示例12: SetAction
public void SetAction( Action action, string mode)
{
string actionType = action.GetType().Name;
string name;
switch(mode)
{
case "enter":
name = GetUniqueKey( actionType, _enter );
_enter.Add( name, action );
break;
case "step":
name = GetUniqueKey( actionType, _step );
_step.Add( name, action );
break;
case "exit":
name = GetUniqueKey( actionType, _exit );
_exit.Add( name, action );
break;
case "finish":
name = GetUniqueKey( actionType, _finish );
_finish.Add( name, action);
break;
}
}
示例13: InitializeRoles
/// <summary>
/// Initializes the roles from the action attribute declaration. See <see cref="ActionRolesAttribute"/>
/// for more information.
/// </summary>
/// <returns></returns>
/// <exception cref="System.NotImplementedException"></exception>
protected virtual List<string> InitializeRoles(Action action)
{
// retrieve default roles for action using declarative attributes;
Type actionType = action.GetType();
{
List<object> roleAttributes = new List<object>(actionType.GetCustomAttributes(typeof (ActionRolesAttribute), true));
if (roleAttributes.Count > 0)
{
foreach (object roleAttribute in roleAttributes)
this.roles = ((ActionRolesAttribute)roleAttribute).Roles;
}
}
return this.roles;
}
示例14: Copy
public void Copy(Action action)
{
// copy all of the properties
foreach (PropertyInfo pi in action.GetType().GetProperties())
{
// get the value of the property
var val = pi.GetValue(action, null);
pi.SetValue(this, val, null);
}
}
示例15: checkConsumed
private void checkConsumed(int pos, int len, Action a)
{
int consumed = reader.Offset - pos;
if (consumed != len)
{
throw new SwfFormatException(a.GetType().FullName + ": " + consumed + " was read. " + len + " was required.");
}
}