예제 #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[]));
 }