示例#1
0
 public static string GetTooltip(FieldInfo field)
 {
     if (field == null)
     {
         return(null);
     }
     return(Actions.GetTooltip(CustomAttributeHelpers.GetCustomAttributes(field)));
 }
示例#2
0
 public static string GetActionCategory(Type objType)
 {
     if (objType == null)
     {
         return(null);
     }
     return(Actions.GetActionCategory(CustomAttributeHelpers.GetCustomAttributes(objType)));
 }
示例#3
0
 public static bool IsObsolete(Type type)
 {
     if (type == null)
     {
         return(true);
     }
     object[] customAttributes = CustomAttributeHelpers.GetCustomAttributes(type);
     return(Enumerable.Any <ObsoleteAttribute>(Enumerable.OfType <ObsoleteAttribute>(customAttributes)));
 }
示例#4
0
        public static IEnumerable <Attribute> GetAttributes(Type type, Type attributeType)
        {
            object[]         customAttributes = CustomAttributeHelpers.GetCustomAttributes(type);
            List <Attribute> list             = new List <Attribute>();

            object[] array = customAttributes;
            for (int i = 0; i < array.Length; i++)
            {
                object obj = array[i];
                if (obj.GetType() == attributeType)
                {
                    list.Add(obj as Attribute);
                }
            }
            return(list);
        }
示例#5
0
 public static string GetObsoleteMessage(Type type)
 {
     if (type == null)
     {
         return("");
     }
     object[] customAttributes = CustomAttributeHelpers.GetCustomAttributes(type);
     object[] array            = customAttributes;
     for (int i = 0; i < array.Length; i++)
     {
         object            obj = array[i];
         ObsoleteAttribute obsoleteAttribute = obj as ObsoleteAttribute;
         if (obsoleteAttribute != null)
         {
             return(obsoleteAttribute.get_Message());
         }
     }
     return("");
 }
        private static void CheckActionParameter(SkillState state, SkillStateAction action, FieldInfo field)
        {
            if (state == null || action == null || field == null || state.get_Fsm() == null)
            {
                return;
            }
            Object ownerObject = state.get_Fsm().get_OwnerObject();

            FsmErrorChecker.ownerIsAsset      = SkillPrefabs.IsPersistent(ownerObject);
            FsmErrorChecker.gameObject        = state.get_Fsm().get_GameObject();
            FsmErrorChecker.checkingFsm       = state.get_Fsm();
            FsmErrorChecker.checkingState     = state;
            FsmErrorChecker.checkingAction    = action;
            FsmErrorChecker.checkingParameter = field.get_Name();
            Type   fieldType = field.get_FieldType();
            object value     = field.GetValue(action);

            FsmErrorChecker.attributes = CustomAttributeHelpers.GetCustomAttributes(field);
            FsmErrorChecker.CheckParameterType(fieldType, value);
        }
示例#7
0
 public static T GetAttribute <T>(Type type) where T : Attribute
 {
     return(CustomAttributeHelpers.GetAttribute <T>(CustomAttributeHelpers.GetCustomAttributes(type) as Attribute[]));
 }