Esempio n. 1
0
            public override void OnLoaded()
            {
                base.OnLoaded();

                _output     = (OutputBox)Elements[0];
                _typePicker = new TypePickerControl
                {
                    Bounds = new Rectangle(FlaxEditor.Surface.Constants.NodeMarginX, FlaxEditor.Surface.Constants.NodeMarginY + FlaxEditor.Surface.Constants.NodeHeaderSize, 160, 16),
                    Parent = this,
                };
                _typePicker.ValueChanged += () => Set(3);
                _removeButton             = new Button(0, _typePicker.Y + FlaxEditor.Surface.Constants.LayoutOffsetY, 20, 20)
                {
                    Text        = "-",
                    TooltipText = "Remove the last item (smaller array)",
                    Parent      = this
                };
                _removeButton.Clicked += () => Set(((Array)Values[0]).Length - 1);
                _addButton             = new Button(_removeButton.Location, _removeButton.Size)
                {
                    Text        = "+",
                    TooltipText = "Add new item to array (bigger array)",
                    Parent      = this
                };
                _addButton.Clicked += () => Set(((Array)Values[0]).Length + 1);

                UpdateUI();
            }
Esempio n. 2
0
            public override void OnDestroy()
            {
                _output          = null;
                _keyTypePicker   = null;
                _valueTypePicker = null;

                base.OnDestroy();
            }
Esempio n. 3
0
            public override void OnDestroy()
            {
                _output       = null;
                _typePicker   = null;
                _addButton    = null;
                _removeButton = null;

                base.OnDestroy();
            }
Esempio n. 4
0
        private void OnTypeValueChanged(TypePickerControl control)
        {
            var box = (InputBox)control.Tag;
            var v   = box.Value;

            if (v is string)
            {
                box.Value = control.ValueTypeName;
            }
            else if (v is Type)
            {
                box.Value = TypeUtils.GetType(control.Value);
            }
            else
            {
                box.Value = control.Value;
            }
        }
Esempio n. 5
0
        private void OnTypeValueChanged(TypePickerControl control)
        {
            var box = (InputBox)control.Tag;
            var v   = box.ParentNode.Values[box.Archetype.ValueIndex];

            if (v is string)
            {
                box.ParentNode.SetValue(box.Archetype.ValueIndex, control.ValueTypeName);
            }
            else if (v is Type)
            {
                box.ParentNode.SetValue(box.Archetype.ValueIndex, TypeUtils.GetType(control.Value));
            }
            else
            {
                box.ParentNode.SetValue(box.Archetype.ValueIndex, control.Value);
            }
        }
Esempio n. 6
0
        public Control Create(InputBox box, ref Rectangle bounds)
        {
            var value   = GetValue(box);
            var control = new TypePickerControl
            {
                Location      = new Vector2(bounds.X, bounds.Y),
                Size          = new Vector2(60.0f, bounds.Height),
                ValueTypeName = value,
                Parent        = box.Parent,
                Tag           = box,
            };

            if (box.CurrentType.Type == typeof(Type))
            {
                control.CheckValid = type => type.Type != null;
            }
            control.TypePickerValueChanged += OnTypeValueChanged;
            return(control);
        }
Esempio n. 7
0
            public override void OnLoaded()
            {
                base.OnLoaded();

                _output        = (OutputBox)Elements[0];
                _keyTypePicker = new TypePickerControl
                {
                    Bounds = new Rectangle(FlaxEditor.Surface.Constants.NodeMarginX, FlaxEditor.Surface.Constants.NodeMarginY + FlaxEditor.Surface.Constants.NodeHeaderSize, 160, 16),
                    Parent = this,
                };
                _keyTypePicker.ValueChanged += OnKeyTypeChanged;
                _valueTypePicker             = new TypePickerControl
                {
                    Bounds = new Rectangle(_keyTypePicker.X, _keyTypePicker.Y + FlaxEditor.Surface.Constants.LayoutOffsetY, _keyTypePicker.Width, _keyTypePicker.Height),
                    Parent = this,
                };
                _valueTypePicker.ValueChanged += OnValueTypeChanged;

                UpdateUI();
            }