Пример #1
0
            public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
            {
                base.Init(ve, bag, cc);

                ((ColorField)ve).SetValueWithoutNotify(m_Value.GetValueFromBag(bag, cc));
                ((ColorField)ve).showEyeDropper = m_ShowEyeDropper.GetValueFromBag(bag, cc);
                ((ColorField)ve).showAlpha      = m_ShowAlpha.GetValueFromBag(bag, cc);
                ((ColorField)ve).hdr            = m_Hdr.GetValueFromBag(bag, cc);
            }
            public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
            {
                base.Init(ve, bag, cc);
                var ate = ve as BuilderAttributesTestElement;

                ate.Clear();

                ate.stringAttr = m_String.GetValueFromBag(bag, cc);
                ate.Add(new TextField("String")
                {
                    value = ate.stringAttr
                });

                ate.floatAttr = m_Float.GetValueFromBag(bag, cc);
                ate.Add(new FloatField("Float")
                {
                    value = ate.floatAttr
                });

                ate.doubleAttr = m_Double.GetValueFromBag(bag, cc);
                ate.Add(new DoubleField("Double")
                {
                    value = ate.doubleAttr
                });

                ate.intAttr = m_Int.GetValueFromBag(bag, cc);
                ate.Add(new IntegerField("Integer")
                {
                    value = ate.intAttr
                });

                ate.longAttr = m_Long.GetValueFromBag(bag, cc);
                ate.Add(new LongField("Long")
                {
                    value = ate.longAttr
                });

                ate.boolAttr = m_Bool.GetValueFromBag(bag, cc);
                ate.Add(new Toggle("Toggle")
                {
                    value = ate.boolAttr
                });

                ate.colorAttr = m_Color.GetValueFromBag(bag, cc);
                ate.Add(new ColorField("Color")
                {
                    value = ate.colorAttr
                });

                ate.enumAttr = m_Enum.GetValueFromBag(bag, cc);
                var en = new EnumField("Enum");

                en.Init(m_Enum.defaultValue);
                en.value = ate.enumAttr;
                ate.Add(en);
            }