示例#1
0
        public BoundsField()
        {
            this.m_CenterField = new Vector3Field();
            this.m_CenterField.OnValueChanged(delegate(ChangeEvent <Vector3> e)
            {
                Bounds value = base.value;
                value.center = e.newValue;
                base.SetValueAndNotify(value);
            });
            VisualElement visualElement = new VisualElement();

            visualElement.AddToClassList("group");
            visualElement.Add(new Label("Center"));
            visualElement.Add(this.m_CenterField);
            base.shadow.Add(visualElement);
            this.m_ExtentsField = new Vector3Field();
            this.m_ExtentsField.OnValueChanged(delegate(ChangeEvent <Vector3> e)
            {
                Bounds value  = base.value;
                value.extents = e.newValue;
                base.SetValueAndNotify(value);
            });
            VisualElement visualElement2 = new VisualElement();

            visualElement2.AddToClassList("group");
            visualElement2.contentContainer.Add(new Label("Extents"));
            visualElement2.contentContainer.Add(this.m_ExtentsField);
            base.shadow.Add(visualElement2);
        }
        public BoundsField()
        {
            m_CenterField = new Vector3Field();

            m_CenterField.OnValueChanged(e =>
            {
                Bounds current = value;
                current.center = e.newValue;
                value          = current;
            });

            var centerGroup = new VisualElement();

            centerGroup.AddToClassList("group");
            centerGroup.Add(new Label("Center"));
            centerGroup.Add(m_CenterField);
            this.shadow.Add(centerGroup);

            m_ExtentsField = new Vector3Field();

            m_ExtentsField.OnValueChanged(e =>
            {
                Bounds current  = value;
                current.extents = e.newValue;
                value           = current;
            });

            var extentsGroup = new VisualElement();

            extentsGroup.AddToClassList("group");
            extentsGroup.contentContainer.Add(new Label("Extents"));
            extentsGroup.contentContainer.Add(m_ExtentsField);
            this.shadow.Add(extentsGroup);
        }
            public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
            {
                base.Init(ve, bag, cc);

                Vector3Field f = (Vector3Field)ve;

                f.value = new Vector3(m_XValue.GetValueFromBag(bag), m_YValue.GetValueFromBag(bag), m_ZValue.GetValueFromBag(bag));
            }