Esempio n. 1
0
        public StyleProperty(string name, object defaultValue = null, bool transitionable = false, bool inherited = false, bool proxy = false, IStyleConverter converter = null)
        {
            this.type           = typeof(T);
            this.name           = name;
            this.defaultValue   = defaultValue;
            this.transitionable = transitionable;
            this.inherited      = inherited;
            this.proxy          = proxy;

            this.converter = converter ?? ParserMap.GetConverter(type);
        }
Esempio n. 2
0
        public LayoutProperty(string name, bool transitionable = false, T defaultValue = default) : base(name, defaultValue, transitionable, false, false, null)
        {
            var ygType = typeof(YogaNode);

            propInfo = ygType.GetProperty(name, BindingFlags.Public | BindingFlags.GetProperty | BindingFlags.SetProperty | BindingFlags.Instance);

            converter = ParserMap.GetConverter(type);

            if (converter == null)
            {
                UnityEngine.Debug.LogError("There is no converter for the type: " + type.Name);
            }

            defaultValueTyped = defaultValue;
            setter            = (Action <YogaNode, T>)propInfo.GetSetMethod().CreateDelegate(typeof(Action <YogaNode, T>));
            getter            = (Func <YogaNode, T>)propInfo.GetGetMethod().CreateDelegate(typeof(Func <YogaNode, T>));
        }