Пример #1
0
        public static List <Type> GetAllStyleableClasses()
        {
            if (null == _availableStyleableClasses)
            {
                //Dictionary<string, Type> types = new Dictionary<string, Type>();

                var types = StyleReflector.GetAllStyleableClasses();
#if DEBUG
                if (DebugMode)
                {
                    StringBuilder sb = new StringBuilder();
                    if (types.Count == 0)
                    {
                        sb.AppendLine("No styleable classes available.");
                    }
                    else
                    {
                        foreach (Type type in types)
                        {
                            sb.AppendLine(string.Format("    -> {0}", type));
                        }
                    }

                    Debug.Log(string.Format(@"====== Styleable classes ======
{0}", sb));
                }
#endif
                _availableStyleableClasses = types;
                //Debug.Log("_availableStyleableClasses: " + _availableStyleableClasses.Count);
            }

            return(_availableStyleableClasses);
        }
Пример #2
0
        public static List <StyleAttribute> GetStyleAttributes(Type type)
        {
            //Debug.Log("GetStyleAttributes: " + className);
            if (StyleAttributeCache.ContainsKey(type))
            {
                return(StyleAttributeCache[type]);
            }

            //var type = GetTypeByFullName(theType.FullName);
            //Debug.Log("type: " + type);

            var attributes = StyleReflector.GetStyleAttributes(type);

#if DEBUG
            if (DebugMode)
            {
                StringBuilder sb = new StringBuilder();
                if (attributes.Count == 0)
                {
                    sb.AppendLine("No available style properties.");
                }
                else
                {
                    foreach (StyleAttribute styleAttribute in attributes)
                    {
                        sb.AppendLine(string.Format("    {0} -> {1}", styleAttribute.Name, styleAttribute.Type));
                    }
                }

                Debug.Log(string.Format(@"====== Styleable properties ======
{0}", sb));
            }
#endif
            StyleAttributeCache[type] = attributes;

            return(attributes);
        }