public Vector4Properties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _Field = new Skill.Editor.UI.Vector4Field(); _Field.ValueChanged += Vector4Field_ValueChanged; _Field.Label = attribute.Name; }
internal void ReplaceObject(System.Object obj) { if (obj == null) { _Fields.Clear(); Controls.Clear(); } else if (_PreObject != obj) { _PreObject = base.Object = obj; Controls.Clear(); PropertyInfo[] infos = Object.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance); Type epaType = typeof(ExposePropertyAttribute); foreach (PropertyInfo info in infos) { if (!(info.CanRead && info.CanWrite)) { continue; } object[] attributes = info.GetCustomAttributes(true); ExposePropertyAttribute exposePropertyAttribute = null; foreach (object o in attributes) { if (o.GetType() == epaType) { exposePropertyAttribute = (ExposePropertyAttribute)o; break; } } if (exposePropertyAttribute == null) { continue; } PropertyType type; if (GetPropertyType(info.PropertyType, out type)) { ControlProperties control = CreateProperties(type, info, exposePropertyAttribute); if (control != null) { _Fields.Add(control); } } } if (_Fields.Count > 0) { _Fields.Sort(new ControlPropertiesComparer()); foreach (var item in _Fields) { item.Control.UserData = item; Controls.Add(item.Control); } } CreateCustomFileds(); } }
public Vector3Properties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _Field = new Skill.Editor.UI.Vector3Field(); _Field.ValueChanged += Vector3Field_ValueChanged; _Field.Label.text = attribute.Name; _Field.Label.tooltip = attribute.Description; }
public UnityObjectProperties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _Field = new Skill.Editor.UI.UntypedObjectField(Info.PropertyType.IsArray ? Info.PropertyType.GetElementType() : Info.PropertyType); _Field.ObjectChanged += ObjectField_ValueChanged; _Field.Label.text = attribute.Name; _Field.Label.tooltip = attribute.Description; }
public EnumProperties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _Field = new Skill.Editor.UI.EnumPopup(); _Field.Label.text = attribute.Name; _Field.Label.tooltip = attribute.Description; _Field.ValueChanged += EnumPopup_ValueChanged; }
public IntegerProperties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _Field = new Skill.Editor.UI.IntField(); _Field.ValueChanged += IntField_ValueChanged; _Field.Label.text = attribute.Name; _Field.Label.tooltip = attribute.Description; _Field.ChangeOnReturn = false; }
public BooleanProperties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _Field = new Skill.Editor.UI.ToggleButton(); _Field.Left = false; _Field.Label.text = attribute.Name; _Field.Label.tooltip = attribute.Description; _Field.Changed += ToggleButton_Changed; }
public StringProperties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { object[] attributes = info.GetCustomAttributes(true); PasteTextFieldAttribute pasteTextFieldAttribute = null; AreaFieldAttribute areaAtt = null; System.Type ptType = typeof(PasteTextFieldAttribute); System.Type aType = typeof(AreaFieldAttribute); foreach (object o in attributes) { if (o.GetType() == ptType) { pasteTextFieldAttribute = (PasteTextFieldAttribute)o; } if (o.GetType() == aType) { areaAtt = (AreaFieldAttribute)o; } } if (pasteTextFieldAttribute != null) { _PasteTextField = new PasteTextField(pasteTextFieldAttribute.Persian, areaAtt != null); _TextField = _PasteTextField.TextField; if (areaAtt != null) { _PasteTextField.Height = Mathf.Max(18, areaAtt.Height); } } else { _TextField = new Skill.Editor.UI.TextField(); if (areaAtt != null) { _TextField.Height = Mathf.Max(18, areaAtt.Height); } } _TextField.TextChanged += TextField_ValueChanged; _TextField.Label.text = attribute.Name; _TextField.Label.tooltip = attribute.Description; }
public ArrayProperties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _Fields = new List <ControlProperties>(); _SizeField = new IntField() { Value = 0, ChangeOnReturn = true }; _SizeField.ValueChanged += _SizeField_ValueChanged; _Panel = new Framework.UI.StackPanel() { Orientation = Framework.UI.Orientation.Vertical }; _Panel.Margin = new Framework.UI.Thickness(4, 0, 0, 0); _Panel.Controls.Add(_SizeField); _Expander = new VerticalExpander(_Panel); _Expander.Foldout.Content.text = attribute.Name; _Expander.Foldout.Content.tooltip = attribute.Description; }
public SerializableObjectProperties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _ExposeProperties = new SerializableObjectExposeProperties(null, Owner); _ExposeProperties.Margin = new Framework.UI.Thickness(4, 0, 0, 0); _Expander = new VerticalExpander(_ExposeProperties); _Name = _Expander.Foldout.Content.text = attribute.Name; _Expander.Foldout.Content.tooltip = attribute.Description; }
private ControlProperties CreateProperties(PropertyType type, PropertyInfo info, ExposePropertyAttribute attribute) { ControlProperties control = null; switch (type) { case PropertyType.AnimationCurve: control = new AnimationCurveProperties(this, info, attribute); break; case PropertyType.Boolean: control = new BooleanProperties(this, info, attribute); break; case PropertyType.Bounds: control = new BoundsProperties(this, info, attribute); break; case PropertyType.Color: control = new ColorProperties(this, info, attribute); break; case PropertyType.Enum: control = new EnumProperties(this, info, attribute); break; case PropertyType.Float: control = new FloatProperties(this, info, attribute); break; case PropertyType.Integer: control = new IntegerProperties(this, info, attribute); break; case PropertyType.LayerMask: control = new LayerMaskProperties(this, info, attribute); break; case PropertyType.ObjectReference: control = new UnityObjectProperties(this, info, attribute); break; case PropertyType.Quaternion: control = new QuaternionProperties(this, info, attribute); break; case PropertyType.Rect: control = new RectProperties(this, info, attribute); break; case PropertyType.String: control = new StringProperties(this, info, attribute); break; case PropertyType.Vector2: control = new Vector2Properties(this, info, attribute); break; case PropertyType.Vector3: control = new Vector3Properties(this, info, attribute); break; case PropertyType.Vector4: control = new Vector4Properties(this, info, attribute); break; case PropertyType.SerializableObject: control = new SerializableObjectProperties(this, info, attribute); break; case PropertyType.Array: control = new ArrayProperties(this, info, attribute); break; } if (control != null) { var margin = control.Control.Margin; margin.Left += 2; margin.Top += 2; margin.Bottom += 2; control.Control.Margin = margin; } return(control); }
public AnimationCurveProperties(ExposeProperties owner, PropertyInfo info, ExposePropertyAttribute attribute) : base(owner, attribute.Order, info) { _CurveField = new Skill.Editor.UI.CurveField(); _CurveField.Label.text = attribute.Name; _CurveField.Label.tooltip = attribute.Description; }