public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.Space(); serializedObject.Update(); EditorGUILayout.PropertyField(m_FillRect); EditorGUILayout.PropertyField(m_HandleRect); if (m_FillRect.objectReferenceValue != null || m_HandleRect.objectReferenceValue != null) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_Direction); if (EditorGUI.EndChangeCheck()) { Slider.Direction direction = (Slider.Direction)m_Direction.enumValueIndex; foreach (var obj in serializedObject.targetObjects) { Slider slider = obj as Slider; slider.SetDirection(direction, true); } } EditorGUILayout.PropertyField(m_MinValue); EditorGUILayout.PropertyField(m_MaxValue); EditorGUILayout.PropertyField(m_WholeNumbers); EditorGUILayout.Slider(m_Value, m_MinValue.floatValue, m_MaxValue.floatValue); bool warning = false; foreach (var obj in serializedObject.targetObjects) { Slider slider = obj as Slider; Slider.Direction dir = slider.direction; if (dir == Slider.Direction.LeftToRight || dir == Slider.Direction.RightToLeft) { warning = (slider.navigation.mode != Navigation.Mode.Automatic && (slider.FindSelectableOnLeft() != null || slider.FindSelectableOnRight() != null)); } else { warning = (slider.navigation.mode != Navigation.Mode.Automatic && (slider.FindSelectableOnDown() != null || slider.FindSelectableOnUp() != null)); } } if (warning) { EditorGUILayout.HelpBox("The selected slider direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning); } // Draw the event notification options EditorGUILayout.Space(); EditorGUILayout.PropertyField(m_OnValueChanged); } else { EditorGUILayout.HelpBox("Specify a RectTransform for the slider fill or the slider handle or both. Each must have a parent RectTransform that it can slide within.", MessageType.Info); } serializedObject.ApplyModifiedProperties(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.Space(); serializedObject.Update(); EditorGUILayout.PropertyField(m_FillRect); EditorGUILayout.PropertyField(m_HandleRect); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(m_Direction); if (EditorGUI.EndChangeCheck()) { Slider.Direction direction = (Slider.Direction)m_Direction.enumValueIndex; foreach (var obj in serializedObject.targetObjects) { Slider slider = obj as Slider; slider.SetDirection(direction, true); } } EditorGUILayout.PropertyField(m_wrapValues); EditorGUILayout.HelpBox("When using Wrap Values, the Max Value becomes equal to the Min Value. Keep this in mind if these values are tied to an array of objects.", MessageType.Info); EditorGUILayout.PropertyField(m_MinValue); EditorGUILayout.PropertyField(m_MaxValue); EditorGUILayout.PropertyField(m_WholeNumbers); EditorGUILayout.Slider(m_Value, m_MinValue.floatValue, m_MaxValue.floatValue); EditorGUILayout.PropertyField(m_decrementButton); EditorGUILayout.PropertyField(m_incrementButton); bool warning = false; foreach (var obj in serializedObject.targetObjects) { Slider slider = obj as Slider; Slider.Direction dir = slider.direction; if (dir == Slider.Direction.LeftToRight || dir == Slider.Direction.RightToLeft) { warning = (slider.navigation.mode != Navigation.Mode.Automatic && (slider.FindSelectableOnLeft() != null || slider.FindSelectableOnRight() != null)); } else { warning = (slider.navigation.mode != Navigation.Mode.Automatic && (slider.FindSelectableOnDown() != null || slider.FindSelectableOnUp() != null)); } } if (warning) { EditorGUILayout.HelpBox("The selected slider direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning); } // Draw the event notification options EditorGUILayout.Space(); EditorGUILayout.PropertyField(m_OnValueChanged); serializedObject.ApplyModifiedProperties(); }
private void ProcessSwipe(Direction dir, float stepVal) { j_SlDirection = j_Slider.direction; j_SwipeDirectionCntrl = 1; j_AddVal = j_StepOffset * stepVal; if (dir == Direction.Horizontal && (j_SlDirection == Slider.Direction.BottomToTop || j_SlDirection == Slider.Direction.TopToBottom)) { return; } else if (dir == Direction.Vertical && (j_SlDirection == Slider.Direction.LeftToRight || j_SlDirection == Slider.Direction.RightToLeft)) { return; } else { if (j_SlDirection == Slider.Direction.RightToLeft) { j_SwipeDirectionCntrl = -1; } else if (j_SlDirection == Slider.Direction.TopToBottom) { j_SwipeDirectionCntrl = -1; } } OnSwipe?.Invoke(); j_AdjustVal = j_Slider.value + j_AddVal * j_SwipeDirectionCntrl; j_AdjustVal = j_AdjustVal > j_Slider.maxValue ? j_Slider.maxValue : j_AdjustVal < j_Slider.minValue ? j_Slider.minValue : j_AdjustVal; j_Slider.value = j_AdjustVal; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.Space(); base.serializedObject.Update(); EditorGUILayout.PropertyField(this.m_FillRect, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_HandleRect, new GUILayoutOption[0]); if (this.m_FillRect.objectReferenceValue != null || this.m_HandleRect.objectReferenceValue != null) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(this.m_Direction, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { Slider.Direction enumValueIndex = (Slider.Direction) this.m_Direction.enumValueIndex; UnityEngine.Object[] targetObjects = base.serializedObject.targetObjects; for (int i = 0; i < targetObjects.Length; i++) { UnityEngine.Object @object = targetObjects[i]; Slider slider = @object as Slider; slider.SetDirection(enumValueIndex, true); } } EditorGUILayout.PropertyField(this.m_MinValue, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_MaxValue, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_WholeNumbers, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_Value, this.m_MinValue.floatValue, this.m_MaxValue.floatValue, new GUILayoutOption[0]); bool flag = false; UnityEngine.Object[] targetObjects2 = base.serializedObject.targetObjects; for (int j = 0; j < targetObjects2.Length; j++) { UnityEngine.Object object2 = targetObjects2[j]; Slider slider2 = object2 as Slider; Slider.Direction direction = slider2.direction; if (direction == Slider.Direction.LeftToRight || direction == Slider.Direction.RightToLeft) { flag = (slider2.navigation.mode != Navigation.Mode.Automatic && (slider2.FindSelectableOnLeft() != null || slider2.FindSelectableOnRight() != null)); } else { flag = (slider2.navigation.mode != Navigation.Mode.Automatic && (slider2.FindSelectableOnDown() != null || slider2.FindSelectableOnUp() != null)); } } if (flag) { EditorGUILayout.HelpBox("The selected slider direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning); } EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_OnValueChanged, new GUILayoutOption[0]); } else { EditorGUILayout.HelpBox("Specify a RectTransform for the slider fill or the slider handle or both. Each must have a parent RectTransform that it can slide within.", MessageType.Info); } base.serializedObject.ApplyModifiedProperties(); }
static int SetDirection(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); Slider obj = (Slider)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Slider"); Slider.Direction arg0 = (Slider.Direction)LuaScriptMgr.GetNetObject(L, 2, typeof(Slider.Direction)); bool arg1 = LuaScriptMgr.GetBoolean(L, 3); obj.SetDirection(arg0, arg1); return(0); }
protected override void OnSpawn() { base.OnSpawn(); ToolTip component = base.transform.parent.gameObject.GetComponent <ToolTip>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { UnityEngine.Object.DestroyImmediate(toolTip); toolTip = component; } minSlider.value = currentMinValue; maxSlider.value = currentMaxValue; minSlider.interactable = interactable; maxSlider.interactable = interactable; minSlider.maxValue = maxLimit; maxSlider.maxValue = maxLimit; minSlider.minValue = minLimit; maxSlider.minValue = minLimit; Slider slider = minSlider; Slider.Direction direction = this.direction; maxSlider.direction = direction; slider.direction = direction; if ((UnityEngine.Object)isOverPowered != (UnityEngine.Object)null) { isOverPowered.enabled = false; } minSlider.gameObject.SetActive(false); if (mode != 0) { minSlider.gameObject.SetActive(true); } if ((UnityEngine.Object)extraSlider != (UnityEngine.Object)null) { extraSlider.value = currentExtraValue; Slider slider2 = extraSlider; bool flag = wholeNumbers; maxSlider.wholeNumbers = flag; flag = flag; minSlider.wholeNumbers = flag; slider2.wholeNumbers = flag; extraSlider.direction = this.direction; extraSlider.interactable = interactable; extraSlider.maxValue = maxLimit; extraSlider.minValue = minLimit; extraSlider.gameObject.SetActive(false); if (mode == Mode.Triple) { extraSlider.gameObject.SetActive(true); } } }
/// <summary> /// <para>See Editor.OnInspectorGUI.</para> /// </summary> public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.Space(); base.serializedObject.Update(); EditorGUILayout.PropertyField(this.m_FillRect, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_HandleRect, new GUILayoutOption[0]); if ((this.m_FillRect.objectReferenceValue != null) || (this.m_HandleRect.objectReferenceValue != null)) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(this.m_Direction, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { Slider.Direction enumValueIndex = (Slider.Direction) this.m_Direction.enumValueIndex; foreach (UnityEngine.Object obj2 in base.serializedObject.targetObjects) { (obj2 as Slider).SetDirection(enumValueIndex, true); } } EditorGUILayout.PropertyField(this.m_MinValue, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_MaxValue, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_WholeNumbers, new GUILayoutOption[0]); EditorGUILayout.Slider(this.m_Value, this.m_MinValue.floatValue, this.m_MaxValue.floatValue, new GUILayoutOption[0]); bool flag = false; foreach (UnityEngine.Object obj3 in base.serializedObject.targetObjects) { Slider slider2 = obj3 as Slider; switch (slider2.direction) { case Slider.Direction.LeftToRight: case Slider.Direction.RightToLeft: flag = (slider2.navigation.mode != Navigation.Mode.Automatic) && ((slider2.FindSelectableOnLeft() != null) || (slider2.FindSelectableOnRight() != null)); break; default: flag = (slider2.navigation.mode != Navigation.Mode.Automatic) && ((slider2.FindSelectableOnDown() != null) || (slider2.FindSelectableOnUp() != null)); break; } } if (flag) { EditorGUILayout.HelpBox("The selected slider direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning); } EditorGUILayout.Space(); EditorGUILayout.PropertyField(this.m_OnValueChanged, new GUILayoutOption[0]); } else { EditorGUILayout.HelpBox("Specify a RectTransform for the slider fill or the slider handle or both. Each must have a parent RectTransform that it can slide within.", MessageType.Info); } base.serializedObject.ApplyModifiedProperties(); }
public override void OnEnter() { GameObject _go = Fsm.GetOwnerDefaultTarget(gameObject); if (_go != null) { _slider = _go.GetComponent <Slider>(); } if (resetOnExit.Value) { _originalValue = _slider.direction; } DoSetValue(); }
public void SetDirection(Slider.Direction direction, bool includeRectLayouts) { Slider.Axis axis = this.axis; bool reverseValue = this.reverseValue; this.direction = direction; if (includeRectLayouts) { if (this.axis != axis) { RectTransformUtility.FlipLayoutAxes(base.transform as RectTransform, true, true); } if (this.reverseValue != reverseValue) { RectTransformUtility.FlipLayoutOnAxis(base.transform as RectTransform, (int)this.axis, true, true); } } }
private static int SetDirection(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 3); Slider slider = (Slider)ToLua.CheckObject(L, 1, typeof(Slider)); Slider.Direction direction = (Slider.Direction)((int)ToLua.CheckObject(L, 2, typeof(Slider.Direction))); bool includeRectLayouts = LuaDLL.luaL_checkboolean(L, 3); slider.SetDirection(direction, includeRectLayouts); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
private static int set_direction(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); Slider slider = (Slider)obj; Slider.Direction direction = (Slider.Direction)((int)ToLua.CheckObject(L, 2, typeof(Slider.Direction))); slider.direction = direction; result = 0; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index direction on a nil value"); } return(result); }
private static int get_direction(IntPtr L) { object obj = null; int result; try { obj = ToLua.ToObject(L, 1); Slider slider = (Slider)obj; Slider.Direction direction = slider.direction; ToLua.Push(L, direction); result = 1; } catch (Exception ex) { result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index direction on a nil value"); } return(result); }
public Slider(float start, float end, Action <float> valueChanged, Slider.Direction direction = Slider.Direction.Horizontal, float pageSize = 10f) { //this.valueChanged = valueChanged; this.direction = direction; this.pageSize = pageSize; this.lowValue = start; this.highValue = end; base.Add(new VisualElement { name = "TrackElement" }); this.dragElement = new VisualElement { name = "DragElement" }; base.Add(this.dragElement); this.clampedDragger = new ClampedDragger(this, new Action(this.SetSliderValueFromClick), new Action(this.SetSliderValueFromDrag)); this.AddManipulator(this.clampedDragger); }
private Controls.Slider.Direction ConvertDirection(Slider.Direction sliderDirection) { switch (sliderDirection) { case Slider.Direction.LeftToRight: return(Controls.Slider.Direction.LeftToRight); case Slider.Direction.RightToLeft: return(Controls.Slider.Direction.RightToLeft); case Slider.Direction.TopToBottom: return(Controls.Slider.Direction.TopToBottom); case Slider.Direction.BottomToTop: return(Controls.Slider.Direction.BottomToTop); } return(Controls.Slider.Direction.LeftToRight); }
/// <summary> /// Turn a Slider direction into a UIDirection /// </summary> /// <param name="direction">The UnityEngine UI Slider direction</param> /// <returns>The UIDirection corresponding to the slider direction</returns> public static EUIDirection SliderDirectionToUIDirection(Slider.Direction direction) { switch (direction) { case (Slider.Direction.TopToBottom): return(EUIDirection.TopToBottom); case (Slider.Direction.BottomToTop): return(EUIDirection.BottomToTop); case (Slider.Direction.LeftToRight): return(EUIDirection.LeftToRight); case (Slider.Direction.RightToLeft): return(EUIDirection.RightToLeft); default: return(EUIDirection.TopToBottom); } }
public Scroller(float lowValue, float highValue, Action <float> valueChanged, Slider.Direction direction = Slider.Direction.Vertical) { this.direction = direction; this.valueChanged = valueChanged; this.slider = new Slider(lowValue, highValue, new Action <float>(this.OnSliderValueChange), direction, 10f) { name = "Slider", persistenceKey = "Slider" }; base.Add(this.slider); this.lowButton = new ScrollerButton(new Action(this.ScrollPageUp), 250L, 30L) { name = "LowButton" }; base.Add(this.lowButton); this.highButton = new ScrollerButton(new Action(this.ScrollPageDown), 250L, 30L) { name = "HighButton" }; base.Add(this.highButton); }
protected override void InternalConstructFromXML(XML cxml) { XML xml = cxml.GetNode("Slider"); bool reverse = xml.GetAttributeBool("reverse"); Slider.Direction dir = Slider.Direction.LeftToRight; GObject bar = this.GetChild("bar"); if (bar == null) { bar = this.GetChild("bar_v"); if (bar != null) { dir = reverse ? Slider.Direction.BottomToTop : Slider.Direction.TopToBottom; } } else { if (reverse) { dir = Slider.Direction.RightToLeft; } } this._content.titleObject = this.GetChild("title") as GTextField; this._content.barObject = bar; this._content.aniObject = this.GetChild("ani") as GMovieClip; this._content.gripObject = this.GetChild("grip"); this._content.direction = dir; this._content.maxValue = xml.GetAttributeInt("max"); this._content.value = xml.GetAttributeInt("value"); string str = xml.GetAttribute("titleType"); this._content.titleType = str != null?FieldTypes.ParseProgressTitleType(str) : ProgressTitleType.Percent; }
public Scroller(float lowValue, float highValue, System.Action <float> valueChanged, Slider.Direction direction = Slider.Direction.Vertical) { this.direction = direction; this.valueChanged = valueChanged; // Add children in correct order slider = new Slider(lowValue, highValue, OnSliderValueChange, direction) { name = "Slider", persistenceKey = "Slider" }; Add(slider); lowButton = new ScrollerButton(ScrollPageUp, ScrollWaitDefinitions.firstWait, ScrollWaitDefinitions.regularWait) { name = "LowButton" }; Add(lowButton); highButton = new ScrollerButton(ScrollPageDown, ScrollWaitDefinitions.firstWait, ScrollWaitDefinitions.regularWait) { name = "HighButton" }; Add(highButton); }
public static SwingMeterRenderer Create(Canvas canvas, Vector2 size, Slider.Direction direction) { SwingMeterRenderer meter = new GameObject("Swing Meter").AddComponent <SwingMeterRenderer>(); meter._slider.direction = direction; meter.transform.SetParent(canvas.transform); meter.rectTransform.sizeDelta = size; switch (direction) { case Slider.Direction.BottomToTop: meter.rectTransform.pivot = new Vector2(0.5f, 0f); break; case Slider.Direction.TopToBottom: meter.rectTransform.pivot = new Vector2(0.5f, 1f); break; case Slider.Direction.LeftToRight: meter.rectTransform.pivot = new Vector2(1f, 0.5f); break; case Slider.Direction.RightToLeft: meter.rectTransform.pivot = new Vector2(0f, 0.5f); break; } return(meter); }
public void SetDirection(Slider.Direction direction, bool includeRectLayouts) { Axis oldAxis = axis; bool oldReverse = reverseValue; this.direction = direction; if (!includeRectLayouts) { return; } if (axis != oldAxis) { RectTransformUtility.FlipLayoutAxes(transform as RectTransform, true, true); } if (reverseValue != oldReverse) { RectTransformUtility.FlipLayoutOnAxis(transform as RectTransform, (int)axis, true, true); } }
private void OnDirectionChanged(Slider.Direction newValue) { slider.direction = newValue; }
/// <summary> /// My black vodoo script, do not use outside /// </summary> /// <param name="ScreenMgr"></param> /// <param name="children"></param> private void UpdateNavigation(ScreenManager ScreenMgr, BaseScreen[] children) { for (int i = 0; i < children.Length; i++) { children[i].gameObject.SetActive(false); } List <Selectable> selectables = new List <Selectable>(); for (int i = 0; i < children.Length; i++) { // Transform parent = children[i]; Transform parent = children[i].transform; // BaseScreen screen = parent.GetComponent<BaseScreen>(); BaseScreen screen = children[i]; if (!screen.generateNavigation) { continue; } parent.gameObject.SetActive(true); selectables.Clear(); parent.GetComponentsInChildren <Selectable>(selectables); Selectable[] directions = new Selectable[4]; foreach (Selectable selectableUI in selectables) { //Debug.Log("<b>" + parent.name + "</b>." + selectableUI.name, selectableUI); Transform t = selectableUI.transform; directions[0] = FindSelectable(parent, t, selectables, t.rotation * Vector3.up); directions[1] = FindSelectable(parent, t, selectables, t.rotation * Vector3.right); directions[2] = FindSelectable(parent, t, selectables, t.rotation * Vector3.down); directions[3] = FindSelectable(parent, t, selectables, t.rotation * Vector3.left); if (selectableUI is Slider) { Slider.Direction dir = (selectableUI as Slider).direction; if (dir == Slider.Direction.TopToBottom || dir == Slider.Direction.BottomToTop) { directions[0] = directions[2] = null; } else { directions[1] = directions[3] = null; } } selectableUI.navigation = new Navigation() { mode = Navigation.Mode.Explicit, selectOnUp = directions[0], selectOnRight = directions[1], selectOnDown = directions[2], selectOnLeft = directions[3], }; CancelTrigger sctrigger = selectableUI.gameObject.GetComponent <CancelTrigger>(); if (sctrigger == null) { var cancelHandlerAvailable = selectableUI.GetComponent <ICancelHandler>(); if (cancelHandlerAvailable == null) { sctrigger = selectableUI.gameObject.AddComponent <CancelTrigger>(); sctrigger.disableCancelHandler = cancelHandlerAvailable != null; } } } parent.gameObject.SetActive(false); } if (ScreenMgr.defaultScreen != null) { ScreenMgr.defaultScreen.gameObject.SetActive(true); } }
public override void OnInspectorGUI() { OSCEditorInterface.LogoLayout(); GUILayout.Label($"Value: {_valueProperty.floatValue}", EditorStyles.boldLabel); GUILayout.BeginVertical(OSCEditorStyles.Box); GUILayout.Label(_settingsContent, EditorStyles.boldLabel); GUILayout.BeginVertical(OSCEditorStyles.Box); base.OnInspectorGUI(); GUILayout.EndVertical(); serializedObject.Update(); GUILayout.Label(_sliderSettingsContent, EditorStyles.boldLabel); GUILayout.BeginVertical(OSCEditorStyles.Box); EditorGUILayout.PropertyField(_fillRecrProperty); EditorGUILayout.PropertyField(_handleProperty); EditorGUILayout.PropertyField(_multiplyControllerProperty); if (_fillRecrProperty.objectReferenceValue != null || _handleProperty.objectReferenceValue != null) { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(_directionProperty); if (EditorGUI.EndChangeCheck()) { Slider.Direction direction = (Slider.Direction)_directionProperty.enumValueIndex; foreach (var targetObject in serializedObject.targetObjects) { var slider = targetObject as Slider; if (slider != null) { slider.SetDirection(direction, true); } } } GUILayout.EndVertical(); GUILayout.Label(_valueSettingsContent, EditorStyles.boldLabel); GUILayout.BeginVertical(OSCEditorStyles.Box); EditorGUILayout.PropertyField(_minValueProperty); EditorGUILayout.PropertyField(_maxValueProperty); EditorGUILayout.PropertyField(_wholeNumbersProperty); EditorGUILayout.Slider(_valueProperty, _minValueProperty.floatValue, _maxValueProperty.floatValue); GUILayout.EndVertical(); GUILayout.Label(_resetValueContent, EditorStyles.boldLabel); GUILayout.BeginVertical(OSCEditorStyles.Box); EditorGUILayout.PropertyField(_resetValueProperty); EditorGUILayout.PropertyField(_resetValueTimeProperty); EditorGUILayout.PropertyField(_callbackOnResetProperty); GUILayout.EndVertical(); bool warning = false; foreach (var targetObject in serializedObject.targetObjects) { if (targetObject is Slider slider) { var direction = slider.direction; if (direction == Slider.Direction.LeftToRight || direction == Slider.Direction.RightToLeft) { warning = (slider.navigation.mode != Navigation.Mode.Automatic && (slider.FindSelectableOnLeft() != null || slider.FindSelectableOnRight() != null)); } else { warning = (slider.navigation.mode != Navigation.Mode.Automatic && (slider.FindSelectableOnDown() != null || slider.FindSelectableOnUp() != null)); } } } if (warning) { EditorGUILayout.HelpBox("The selected slider direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning); } EditorGUILayout.Space(); EditorGUILayout.PropertyField(_onValueChangedProperty); } else { GUILayout.EndVertical(); EditorGUILayout.HelpBox("Specify a RectTransform for the slider fill or the slider handle or both. Each must have a parent RectTransform that it can slide within.", MessageType.Info); } GUILayout.EndVertical(); serializedObject.ApplyModifiedProperties(); }
public Scroller(float lowValue, float highValue, Action <float> valueChanged, Slider.Direction direction = Slider.Direction.Vertical) { base.phaseInterest = EventPhase.BubbleUp; this.direction = direction; this.valueChanged = valueChanged; this.slider = new Slider(lowValue, highValue, new Action <float>(this.OnSliderValueChange), direction, 10f) { name = "Slider" }; base.AddChild(this.slider); this.lowButton = new ScrollerButton(new Action(this.ScrollPageUp), 250L, 30L) { name = "LowButton" }; base.AddChild(this.lowButton); this.highButton = new ScrollerButton(new Action(this.ScrollPageDown), 250L, 30L) { name = "HighButton" }; base.AddChild(this.highButton); }
public UISlider Direction(Slider.Direction direction) { slider.direction = direction; return(this); }
protected override void SetProp(string name, string val) { switch (name) { case "text": Text = val; break; case "minValue": { float v = 0; if (float.TryParse(val, out v)) { Slider.minValue = v; } break; } case "maxValue": { float v = 0; if (float.TryParse(val, out v)) { Slider.maxValue = v; } break; } case "value": { float v = 0; if (float.TryParse(val, out v)) { Slider.value = v; } break; } case "valFormatText": valFormatText = val; break; case "direction": { Slider.Direction v = 0; if (System.Enum.TryParse(val, out v)) { Slider.direction = v; } break; } case "wholeNumbers": { bool v = false; if (bool.TryParse(val, out v)) { Slider.wholeNumbers = v; } break; } default: base.SetProp(name, val); break; } }