Example #1
0
 public DiscreteKeyView(DiscreteTrackBar <V> trackBar, IPropertyKey <V> key)
     : base(trackBar)
 {
     this.Key = key;
     _ImgIcon = new Skill.Framework.UI.Image()
     {
         Row = 0, Column = 0, RowSpan = 10, ColumnSpan = 10, HorizontalAlignment = Skill.Framework.UI.HorizontalAlignment.Center, VerticalAlignment = Skill.Framework.UI.VerticalAlignment.Center, Width = 10, Height = 10
     };
     Controls.Add(_ImgIcon);
 }
Example #2
0
 public ContinuousKeyView(ContinuousTrackBar <V> trackBar, AnimationCurve curve, int curveIndex, int keyIndex)
     : base(trackBar)
 {
     this.Curve      = curve;
     this.CurveIndex = curveIndex;
     this.KeyIndex   = keyIndex;
     this._ImgIcon   = new Skill.Framework.UI.Image()
     {
         TintColor = CurveColors[curveIndex], Row = 0, Column = 0, RowSpan = 10, ColumnSpan = 10, HorizontalAlignment = Skill.Framework.UI.HorizontalAlignment.Center, VerticalAlignment = Skill.Framework.UI.VerticalAlignment.Center, Width = 10, Height = 10
     };
     this.Controls.Add(_ImgIcon);
 }
Example #3
0
            //private EventKey _EventKey;

            public EventKeyView(EventTrackBar trackBar, EventKey key)
                : base(trackBar, key)
            {
                //_EventKey = key;

                this.ColumnDefinitions.Add(10, Framework.UI.GridUnitType.Pixel);
                this.ColumnDefinitions.Add(1, Framework.UI.GridUnitType.Star);


                _Bg       = new Framework.UI.Box();
                _ImgState = new Skill.Framework.UI.Image()
                {
                    Row = 0, Column = 0
                };

                Controls.Add(_Bg);
                Controls.Add(_ImgState);
            }
Example #4
0
            public ParameterField(ParameterEditor owner, ParameterData data)
            {
                this._Owner   = owner;
                this._Data    = data;
                this.UserData = data;
                this.Height   = 22;

                this.ColumnDefinitions.Add(22, Framework.UI.GridUnitType.Pixel);
                this.ColumnDefinitions.Add(1, Framework.UI.GridUnitType.Star);
                this.ColumnDefinitions.Add(1, Framework.UI.GridUnitType.Star);

                _Icon = new Framework.UI.Image()
                {
                    Column = 0, Scale = UnityEngine.ScaleMode.ScaleToFit, Texture = UnityEditor.EditorGUIUtility.FindTexture("Toolbar Minus")
                };
                this.Controls.Add(_Icon);

                _ParameterName = new UI.TextField()
                {
                    Column = 1, Margin = new Framework.UI.Thickness(2), Text = _Data.Name
                };
                this.Controls.Add(_ParameterName);
                _ParameterName.TextChanged += _ParameterName_TextChanged;

                switch (_Data.Type)
                {
                case ParameterType.Int:
                    _ParameterField = new UI.IntField();
                    int v = 0;
                    if (int.TryParse(_Data.Value, out v))
                    {
                        ((UI.IntField)_ParameterField).Value = v;
                    }
                    else
                    {
                        ((UI.IntField)_ParameterField).Value = 0;
                        _Data.Value = "0";
                    }
                    ((UI.IntField)_ParameterField).ValueChanged += intField_ValueChanged;
                    break;

                case ParameterType.Bool:
                    _ParameterField = new UI.ToggleButton();

                    bool b = false;
                    if (bool.TryParse(_Data.Value, out b))
                    {
                        ((UI.ToggleButton)_ParameterField).IsChecked = b;
                    }
                    else
                    {
                        ((UI.ToggleButton)_ParameterField).IsChecked = false;
                        _Data.Value = "false";
                    }
                    ((UI.ToggleButton)_ParameterField).Changed += boolField_Changed;
                    break;

                case ParameterType.Float:
                    _ParameterField = new UI.FloatField();

                    float f = 0;
                    if (float.TryParse(_Data.Value, out f))
                    {
                        ((UI.FloatField)_ParameterField).Value = f;
                    }
                    else
                    {
                        ((UI.FloatField)_ParameterField).Value = 0;
                        _Data.Value = "0";
                    }
                    ((UI.FloatField)_ParameterField).ValueChanged += floatField_ValueChanged;
                    break;

                case ParameterType.String:
                    _ParameterField = new UI.TextField();
                    ((UI.TextField)_ParameterField).Text         = _Data.Value;
                    ((UI.TextField)_ParameterField).TextChanged += textField_TextChanged;
                    break;
                }
                if (_ParameterField != null)
                {
                    _ParameterField.Column = 2;
                    _ParameterField.Margin = new Framework.UI.Thickness(2);
                    this.Controls.Add(_ParameterField);
                }
            }
Example #5
0
        public ParameterEditor(IBehaviorItem item, ParameterDataCollection dataDifinition, ParameterDataCollection data)
        {
            _Item           = item;
            _DataDifinition = dataDifinition;
            _Data           = data;

            this._RefreshStyle = true;

            this.RowDefinitions.Add(16, Skill.Framework.UI.GridUnitType.Pixel); // title
            this.RowDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);   // list
            this.RowDefinitions.Add(16, Skill.Framework.UI.GridUnitType.Pixel); // buttons

            _Title = new Framework.UI.Label {
                Row = 0, Text = "Parameters"
            };
            this.Controls.Add(_Title);

            _FieldsList = new Skill.Framework.UI.ListBox()
            {
                Row = 1
            };
            _FieldsList.DisableFocusable();
            _FieldsList.BackgroundVisible = true;
            this.Controls.Add(_FieldsList);

            _ButtonsPanel = new Framework.UI.Grid()
            {
                Row = 2
            };
            _ButtonsPanel.ColumnDefinitions.Add(1, Skill.Framework.UI.GridUnitType.Star);
            _ButtonsPanel.ColumnDefinitions.Add(20, Skill.Framework.UI.GridUnitType.Pixel);
            _ButtonsPanel.ColumnDefinitions.Add(20, Skill.Framework.UI.GridUnitType.Pixel);
            this.Controls.Add(_ButtonsPanel);

            _BtnAddImage = new Framework.UI.Image()
            {
                Column = 1
            };
            _ButtonsPanel.Controls.Add(_BtnAddImage);


            _BtnAdd = new UI.IntPopup()
            {
                Column = 1
            };
            _BtnAdd.Options.Add(new UI.PopupOption(1, "float"));
            _BtnAdd.Options.Add(new UI.PopupOption(2, "int"));
            _BtnAdd.Options.Add(new UI.PopupOption(3, "bool"));
            _BtnAdd.Options.Add(new UI.PopupOption(4, "string"));
            _ButtonsPanel.Controls.Add(_BtnAdd);

            _BtnRemove = new Framework.UI.Button()
            {
                Column = 2, IsEnabled = false
            };
            _ButtonsPanel.Controls.Add(_BtnRemove);


            _BtnAdd.OptionChanged        += _BtnAdd_OptionChanged;
            _BtnRemove.Click             += _BtnRemove_Click;
            _FieldsList.SelectionChanged += _FieldsList_SelectionChanged;

            Rebuild();
        }