public override void Draw() { object newValue = null; if (IsPrimitive(PropertyType)) { newValue = DrawPrimitive(); } else if (IsArray(PropertyType)) { newValue = DrawArray(); } else if (IsEnum(PropertyType)) { newValue = DrawEnum(); } else if (IsUnityObject(PropertyType)) { newValue = DrawUnityObject(); } if (newValue == Value) { return; } EventChange?.Invoke(newValue); Value = newValue; }
private void SendMessage(EventChange message) { foreach (var observer in _observers) { observer.OnNext(message); } }
public HtmlRadioGroup(string name, bool verbose, bool isPostBack) : base(verbose ? name : "") { attrName = new AttrName(name); attributes.Add(attrDisabled = new AttrDisabled()); if (isPostBack) { events.Add(eventChange = new EventChange(string.Format("__doPostBack('{0}', '');", name))); } }
public HtmlSelect(string name, bool multiple, bool isPostBack) : base(name) { attributes.Add(attrName = new AttrName(name)); attributes.Add(attrDisabled = new AttrDisabled()); attributes.Add(attrMultiple = new AttrMultiple(multiple)); attributes.Add(attrSize = new AttrSize()); if (isPostBack) { events.Add(eventChange = new EventChange(string.Format("__doPostBack('{0}', '');", name))); } }
public HtmlTextBox(string name) : base(name, "text") { attributes.Add(attrPlaceholder = new AttrPlaceholder()); attributes.Add(attrDataNumber = new AttrDataNumber()); attributes.Add(attrDataMin = new AttrDataMin()); attributes.Add(attrDataMax = new AttrDataMax()); attributes.Add(attrDataStep = new AttrDataStep()); attributes.Add(attrDataPrecision = new AttrDataPrecision()); events.Add(eventChange = new EventChange()); events.Add(eventFocus = new EventFocus()); events.Add(eventBlur = new EventBlur()); }
public override void Draw() { var options = Variants.Select(t => t.Name).ToList(); if (CanNullable) { options.Insert(0, "null"); } if (!options.Any()) { throw new InvalidDataException("options for select in dropdown not contains any element"); } var index = Variants.FindIndex(t => t.Value.Equals(Selected)); var current_selected = Selected == null ? 0 : index == -1 ? 0 : index + (CanNullable ? 1 : 0); int new_selection; if (Label == null) { new_selection = EditorGUILayout.Popup(current_selected, options.ToArray(), LayoutOptions); } else { new_selection = EditorGUILayout.Popup(new GUIContent(Label), current_selected, options.Select(t => new GUIContent(t)).ToArray(), LayoutOptions); } if (current_selected == new_selection) { return; } var variantValue = Variants.FirstOrDefault(t => t.Name == options[new_selection]); var newSelected = variantValue == null ? default(T) : variantValue.Value; EventChange?.Invoke(newSelected); Selected = newSelected; }
public HtmlSelect(string name, int size, bool isPostBack) : base(name) { attributes.Add(attrName = new AttrName(name)); attributes.Add(attrDisabled = new AttrDisabled()); attributes.Add(attrMultiple = new AttrMultiple(true)); if (size < 1) { throw new ArgumentException(); } else { attributes.Add(attrSize = new AttrSize(size)); } if (isPostBack) { events.Add(eventChange = new EventChange(string.Format("__doPostBack('{0}', '');", name))); } }
private void cmbImplementation_SelectedIndexChanged(object sender, EventArgs e) { EventChange?.Invoke((ETypeImpl)cmbImpl.SelectedIndex); NextEventChange?.Invoke((ETypeImpl)cmbImpl.SelectedIndex); }