using System; namespace UnityEngine.Experimental.UIElements { // Token: 0x02000326 RID: 806 internal class IMScroller : IMElement { // Token: 0x060032B8 RID: 12984 RVA: 0x0004D01C File Offset: 0x0004B21C public IMScroller() { this.m_NextScrollStepTime = DateTime.Now; this.m_Slider = new IMSlider(); this.m_LeftButton = new IMRepeatButton(); this.m_RightButton = new IMRepeatButton(); } // Token: 0x17000B82 RID: 2946 // (get) Token: 0x060032B9 RID: 12985 RVA: 0x0004D05C File Offset: 0x0004B25C // (set) Token: 0x060032BA RID: 12986 RVA: 0x0004D078 File Offset: 0x0004B278 public float value { get; private set; } // Token: 0x060032BB RID: 12987 RVA: 0x0004D084 File Offset: 0x0004B284 public void SetProperties(Rect pos, float val, float size, float leftValue, float rightValue, GUIStyle slider, GUIStyle thumb, GUIStyle leftButton, GUIStyle rightButton, bool horiz) { base.position = pos; this.m_PageSize = size; this.m_LeftValue = leftValue; this.m_RightValue = rightValue; this.value = val; Rect rect; Rect rect2; Rect rect3; this.GetRects(horiz, base.position, leftButton, rightButton, out rect, out rect2, out rect3); this.m_Slider.SetProperties(rect, this.value, size, leftValue, rightValue, slider, thumb, horiz); this.m_LeftButton.position = rect2; this.m_LeftButton.style = leftButton; this.m_RightButton.position = rect3; this.m_RightButton.style = rightButton; } // Token: 0x060032BC RID: 12988 RVA: 0x0004D120 File Offset: 0x0004B320 public override void OnReuse() { base.OnReuse(); this.m_Slider.OnReuse(); this.m_LeftButton.OnReuse(); this.m_RightButton.OnReuse(); } // Token: 0x060032BD RID: 12989 RVA: 0x0004D14C File Offset: 0x0004B34C public override bool OnGUI(Event evt) { bool flag = this.m_Slider.OnGUI(evt); this.value = this.m_Slider.value; bool flag2 = evt.type == EventType.MouseUp; flag |= this.m_LeftButton.OnGUI(evt); if (this.m_LeftButton.isPressed && this.OnScrollerButton(evt)) { this.value -= 10f * ((this.m_LeftValue >= this.m_RightValue) ? (-1f) : 1f); } flag |= this.m_RightButton.OnGUI(evt); if (this.m_RightButton.isPressed && this.OnScrollerButton(evt)) { this.value += 10f * ((this.m_LeftValue >= this.m_RightValue) ? (-1f) : 1f); } if (flag2 && evt.type == EventType.Used) { IMScroller.s_ScrollControlId = 0; } if (this.m_LeftValue < this.m_RightValue) { this.value = Mathf.Clamp(this.value, this.m_LeftValue, this.m_RightValue - this.m_PageSize); } else { this.value = Mathf.Clamp(this.value, this.m_RightValue, this.m_LeftValue - this.m_PageSize); } if (flag) { evt.Use(); } this.m_Slider.value = this.value; return flag; } // Token: 0x060032BE RID: 12990 RVA: 0x0004D2E4 File Offset: 0x0004B4E4 protected override int DoGenerateControlID() { this.m_Slider.GenerateControlID(); this.m_LeftButton.GenerateControlID(); this.m_RightButton.GenerateControlID(); return GUIUtility.GetControlID("IMScroller".GetHashCode(), base.focusType, base.position); } // Token: 0x060032BF RID: 12991 RVA: 0x0004D338 File Offset: 0x0004B538 private void GetRects(bool horiz, Rect pos, GUIStyle leftButton, GUIStyle rightButton, out Rect sliderRect, out Rect minRect, out Rect maxRect) { if (horiz) { sliderRect = new Rect(pos.x + leftButton.fixedWidth, pos.y, pos.width - leftButton.fixedWidth - rightButton.fixedWidth, pos.height); minRect = new Rect(pos.x, pos.y, leftButton.fixedWidth, pos.height); maxRect = new Rect(pos.xMax - rightButton.fixedWidth, pos.y, rightButton.fixedWidth, pos.height); } else { sliderRect = new Rect(pos.x, pos.y + leftButton.fixedHeight, pos.width, pos.height - leftButton.fixedHeight - rightButton.fixedHeight); minRect = new Rect(pos.x, pos.y, pos.width, leftButton.fixedHeight); maxRect = new Rect(pos.x, pos.yMax - rightButton.fixedHeight, pos.width, rightButton.fixedHeight); } } // Token: 0x060032C0 RID: 12992 RVA: 0x0004D464 File Offset: 0x0004B664 private bool OnScrollerButton(Event evt) { bool flag = IMScroller.s_ScrollControlId != this.m_Slider.id; IMScroller.s_ScrollControlId = this.m_Slider.id; bool flag2 = false; if (flag) { flag2 = true; this.m_NextScrollStepTime = DateTime.Now.AddMilliseconds(250.0); } else if (DateTime.Now >= this.m_NextScrollStepTime) { flag2 = true; this.m_NextScrollStepTime = DateTime.Now.AddMilliseconds(30.0); } if (evt.type == EventType.Repaint) { GUI.InternalRepaintEditorWindow(); } return flag2; } // Token: 0x04000A4B RID: 2635 private const float ScrollStepSize = 10f; // Token: 0x04000A4C RID: 2636 private readonly IMSlider m_Slider; // Token: 0x04000A4D RID: 2637 private readonly IMRepeatButton m_LeftButton; // Token: 0x04000A4E RID: 2638 private readonly IMRepeatButton m_RightButton; // Token: 0x04000A4F RID: 2639 private float m_PageSize; // Token: 0x04000A50 RID: 2640 private float m_LeftValue; // Token: 0x04000A51 RID: 2641 private float m_RightValue; // Token: 0x04000A52 RID: 2642 public DateTime m_NextScrollStepTime = DateTime.Now; // Token: 0x04000A53 RID: 2643 private static int s_ScrollControlId = 0; } }