/// <summary> /// Gets all style properties /// </summary> /// <param name="type"></param> /// <param name="restrictToInspectableTypes"></param> public static List<StyleAttribute> GetStyleAttributes(Type type) { if (StyleAttributeCache.ContainsKey(type)) return StyleAttributeCache[type]; var styleAttributes = CoreReflector.GetClassAttributes<StyleAttribute>(type); List<StyleAttribute> attributes = new List<StyleAttribute>(); foreach (StyleAttribute attribute in styleAttributes) { /* with "skinClass" style, the Type isn't required. Set it here */ /*if (attribute.Name == "skinClass" && null == attribute.Type) attribute.Type = typeof(object);*/ if (/*!restrictToInspectableTypes || */(attribute.Name == "skinClass" || null != attribute.Type/* && StyleProperty.AlowedTypes.ContainsKey(attribute.Type)*/)) { /** * Important: Avoid duplication * Subclass attributes are being added before the superclass attributes, so we're fine * */ var name = attribute.Name; if (!attributes.Exists(delegate(StyleAttribute a) { return a.Name == name; })) { attributes.Add(attribute); } else { //Debug.Log(type + " has duplicated attribute: " + name + ": " + attribute.GetDefault()); } } } StyleAttributeCache[type] = attributes; return attributes; }