public override void CreateIValue(object value, Type fallbackType) { IValue = InteractiveValue.Create(value, fallbackType); IValue.Owner = this; IValue.m_mainContentParent = this.m_rightGroup; IValue.m_subContentParent = this.m_subContent; }
protected virtual void registerHud() { if (interactiveValues.Length <= 0 && interactiveColors.Length <= 0) { return; } float sum = (float)(interactiveValues.Length + interactiveColors.Length); for (int i = 0; i < interactiveValues.Length; i++) { InteractiveValue v = interactiveValues[i] as InteractiveValue; HudValue slider = hud.createSlider((float)i / sum); if (slider != null) { var text = slider.GetComponentInChildren <TextMesh>(); if (text) { text.text = v._description; } object obj = v.propSet.Get(); if (obj != null) { slider.setValue((float)obj); } slider.OnValueChanged += (val) => { v.propSet.Set(Mathf.Lerp(v._min, v._max, val)); }; instancedHudValues.Add(slider); } } float tmp = interactiveValues.Length; for (int i = 0; i < interactiveColors.Length; i++) { InteractiveColor v = interactiveColors[i] as InteractiveColor; Debug.Log(string.Format("Creating hsv thing for {0}", v.name)); HudColor slider = hud.createColorPicker(((float)i + tmp) / (float)sum); if (slider != null) { var text = slider.GetComponentInChildren <TextMesh>(); if (text) { text.text = v._description; } object obj = v.fieldSet.Get(); if (obj != null) { slider.setValue((Color)obj); } slider.OnColorChanged += (val) => { v.fieldSet.Set(val); }; instancedHudColors.Add(slider); } } }
public virtual void UpdateValue() { var value = IValue.Value; // if the type has changed fundamentally, make a new interactivevalue for it var type = value == null ? FallbackType : ReflectionUtility.GetActualType(value); var ivalueType = InteractiveValue.GetIValueForType(type); if (ivalueType != IValue.GetType()) { IValue.OnDestroy(); CreateIValue(value, FallbackType); m_subContent.SetActive(false); } IValue.OnValueUpdated(); IValue.RefreshElementsAfterUpdate(); }
public override void CreateIValue(object value, Type fallbackType) { IValue = InteractiveValue.Create(value, fallbackType); IValue.Owner = this; }