private void SliderGUI() { if (this.m_HSlider) { Bounds drawingBounds = this.drawingBounds; Rect shownAreaInsideMargins = this.shownAreaInsideMargins; float num = this.styles.sliderWidth - this.styles.visualSliderWidth; float num2 = (!this.hSlider) ? 0f : num; if (this.m_HSlider) { Rect arg_FE_0 = new Rect(this.drawRect.x, this.drawRect.yMax - num, this.drawRect.width - num2, this.styles.sliderWidth); float width = shownAreaInsideMargins.width; float xMin = shownAreaInsideMargins.xMin; MinMaxSliderControl.MinMaxScroller(arg_FE_0, this.horizontalScrollbarID, ref xMin, ref width, drawingBounds.min.x, drawingBounds.max.x, float.NegativeInfinity, float.PositiveInfinity, this.styles.horizontalScrollbar, this.styles.horizontalMinMaxScrollbarThumb, this.styles.horizontalScrollbarLeftButton, this.styles.horizontalScrollbarRightButton, true); float num3 = xMin; float num4 = xMin + width; if (num3 > shownAreaInsideMargins.xMin) { num3 = Mathf.Min(num3, num4 - this.m_HScaleMin); } if (num4 < shownAreaInsideMargins.xMax) { num4 = Mathf.Max(num4, num3 + this.m_HScaleMin); } this.SetShownHRangeInsideMargins(num3, num4); } } }
private void SliderGUI() { if (this.m_HSlider) { Bounds drawingBounds = this.drawingBounds; Rect shownAreaInsideMargins = this.shownAreaInsideMargins; float num3 = this.styles.sliderWidth - this.styles.visualSliderWidth; float num4 = !this.hSlider ? 0f : num3; if (this.m_HSlider) { float size = shownAreaInsideMargins.width; float num6 = shownAreaInsideMargins.xMin; MinMaxSliderControl.MinMaxScroller(new Rect(this.drawRect.x, this.drawRect.yMax - num3, this.drawRect.width - num4, this.styles.sliderWidth), this.horizontalScrollbarID, ref num6, ref size, drawingBounds.min.x, drawingBounds.max.x, float.NegativeInfinity, float.PositiveInfinity, this.styles.horizontalScrollbar, this.styles.horizontalMinMaxScrollbarThumb, this.styles.horizontalScrollbarLeftButton, this.styles.horizontalScrollbarRightButton, true); float min = num6; float max = num6 + size; if (min > shownAreaInsideMargins.xMin) { min = Mathf.Min(min, max - this.m_HScaleMin); } if (max < shownAreaInsideMargins.xMax) { max = Mathf.Max(max, min + this.m_HScaleMin); } this.SetShownHRangeInsideMargins(min, max); } } }
public static void MinMaxScroller(Rect position, int id, ref float value, ref float size, float visualStart, float visualEnd, float startLimit, float endLimit, GUIStyle slider, GUIStyle thumb, GUIStyle leftButton, GUIStyle rightButton, bool horiz) { float num; if (horiz) { num = size * 10f / position.width; } else { num = size * 10f / position.height; } Rect position2; Rect rect; Rect rect2; if (horiz) { position2 = new Rect(position.x + leftButton.fixedWidth, position.y, position.width - leftButton.fixedWidth - rightButton.fixedWidth, position.height); rect = new Rect(position.x, position.y, leftButton.fixedWidth, position.height); rect2 = new Rect(position.xMax - rightButton.fixedWidth, position.y, rightButton.fixedWidth, position.height); } else { position2 = new Rect(position.x, position.y + leftButton.fixedHeight, position.width, position.height - leftButton.fixedHeight - rightButton.fixedHeight); rect = new Rect(position.x, position.y, position.width, leftButton.fixedHeight); rect2 = new Rect(position.x, position.yMax - rightButton.fixedHeight, position.width, rightButton.fixedHeight); } float num2 = Mathf.Min(visualStart, value); float num3 = Mathf.Max(visualEnd, value + size); MinMaxSliderControl.MinMaxSlider(position2, ref value, ref size, num2, num3, num2, num3, slider, thumb, horiz); bool flag = false; if ((int)Event.current.type == 1) { flag = true; } if (MinMaxSliderControl.ScrollerRepeatButton(id, rect, leftButton)) { value -= num * ((visualStart >= visualEnd) ? -1f : 1f); } if (MinMaxSliderControl.ScrollerRepeatButton(id, rect2, rightButton)) { value += num * ((visualStart >= visualEnd) ? -1f : 1f); } if (flag && (int)Event.current.type == 12) { MinMaxSliderControl.scrollControlID = 0; } if (startLimit < endLimit) { value = Mathf.Clamp(value, startLimit, endLimit - size); return; } value = Mathf.Clamp(value, endLimit, startLimit - size); }
private static bool ScrollerRepeatButton(int scrollerID, Rect rect, GUIStyle style) { bool result = false; if (MinMaxSliderControl.DoRepeatButton(rect, GUIContent.none, style, (FocusType)2)) { bool arg_22_0 = MinMaxSliderControl.scrollControlID != scrollerID; MinMaxSliderControl.scrollControlID = scrollerID; if (arg_22_0) { result = true; MinMaxSliderControl.nextScrollStepTime = Time.realtimeSinceStartup + 0.001f * (float)MinMaxSliderControl.firstScrollWait; } else if (Time.realtimeSinceStartup >= MinMaxSliderControl.nextScrollStepTime) { result = true; MinMaxSliderControl.nextScrollStepTime = Time.realtimeSinceStartup + 0.001f * (float)MinMaxSliderControl.scrollWait; } } return(result); }
public static void MinMaxSlider(Rect position, ref float value, ref float size, float visualStart, float visualEnd, float startLimit, float endLimit, GUIStyle slider, GUIStyle thumb, bool horiz) { MinMaxSliderControl.DoMinMaxSlider(position, GUIUtility.GetControlID(MinMaxSliderControl.s_MinMaxSliderHash, (FocusType)2), ref value, ref size, visualStart, visualEnd, startLimit, endLimit, slider, thumb, horiz); }