示例#1
0
 /// <summary>
 /// Is control in hierarchy of this control
 /// </summary>
 /// <param name="control">control to check</param>
 /// <returns>true if is in hierarchy, otherwise false</returns>
 public override bool IsInHierarchy(Skill.Framework.UI.BaseControl control)
 {
     if (base.IsInHierarchy(control))
     {
         return(true);
     }
     foreach (var c in Controls)
     {
         if (c != null)
         {
             bool result = c.IsInHierarchy(control);
             if (result)
             {
                 return(result);
             }
         }
     }
     return(false);
 }
示例#2
0
 /// <summary>
 /// Is control in hierarchy of this control
 /// </summary>
 /// <param name="control">control to check</param>
 /// <returns>true if is in hierarchy, otherwise false</returns>
 public override bool IsInHierarchy(Skill.Framework.UI.BaseControl control)
 {
     if (base.IsInHierarchy(control))
     {
         return(true);
     }
     if (control == this._TbX)
     {
         return(true);
     }
     if (control == this._TbY)
     {
         return(true);
     }
     if (control == this._TbZ)
     {
         return(true);
     }
     return(false);
 }
示例#3
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);
                }
            }