private ITreeStringNode addToTree(InspectorProperty property, ITreeStringNode parent) { if (property.IsReadonly) { return(addReadonlyNodeToTree(property, parent)); } IInspectorPropertyEditor editor; var propType = property.Prop.PropertyType; if (propType == typeof(bool)) { editor = new BoolPropertyEditor(_factory, _actions); } else if (propType == typeof(Color)) { editor = new ColorPropertyEditor(_factory, _actions); } else if (propType == typeof(int)) { editor = new NumberPropertyEditor(_actions, _state, _factory, true, false); } else if (propType == typeof(float)) { editor = new NumberPropertyEditor(_actions, _state, _factory, false, false); } else if (propType == typeof(SizeF)) { editor = new SizeFPropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(Size)) { editor = new SizePropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(PointF)) { editor = new PointFPropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(Point)) { editor = new PointPropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(Vector2)) { editor = new Vector2PropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(Vector3)) { editor = new Vector3PropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(Vector4)) { editor = new Vector4PropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(ILocation)) { var entity = _currentEntity; var drawable = entity == null ? null : entity.GetComponent <IDrawableInfoComponent>(); editor = new LocationPropertyEditor(_actions, _state, _factory, false, _settings, drawable); } else if (propType == typeof(RectangleF)) { editor = new RectangleFPropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(Rectangle)) { editor = new RectanglePropertyEditor(_actions, _state, _factory, false); } else if (propType == typeof(int?)) { editor = new NumberPropertyEditor(_actions, _state, _factory, true, true); } else if (propType == typeof(float?)) { editor = new NumberPropertyEditor(_actions, _state, _factory, false, true); } else if (propType == typeof(SizeF?)) { editor = new SizeFPropertyEditor(_actions, _state, _factory, true); } else if (propType == typeof(Size?)) { editor = new SizePropertyEditor(_actions, _state, _factory, true); } else if (propType == typeof(PointF?)) { editor = new PointFPropertyEditor(_actions, _state, _factory, true); } else if (propType == typeof(Point?)) { editor = new PointPropertyEditor(_actions, _state, _factory, true); } else if (propType == typeof(Vector2?)) { editor = new Vector2PropertyEditor(_actions, _state, _factory, true); } else if (propType == typeof(Vector3?)) { editor = new Vector3PropertyEditor(_actions, _state, _factory, true); } else if (propType == typeof(Vector4?)) { editor = new Vector4PropertyEditor(_actions, _state, _factory, true); } else if (propType == typeof(RectangleF?)) { editor = new RectangleFPropertyEditor(_actions, _state, _factory, true); } else if (propType == typeof(Rectangle?)) { editor = new RectanglePropertyEditor(_actions, _state, _factory, true); } else { var typeInfo = propType.GetTypeInfo(); if (typeInfo.IsEnum) { editor = new EnumPropertyEditor(_factory.UI, _actions); } else { editor = new StringPropertyEditor(_factory, propType == typeof(string), _actions); } } ITreeStringNode node = new InspectorTreeNode(property, editor); return(addToTree(node, parent)); }
private void addToTree(ITreeStringNode parent, InspectorProperty prop) { var node = addToTree(prop, parent); addChildrenToTree(node, prop); }