コード例 #1
0
        private void OnKeyDown(KeyDownEvent evt)
        {
            BaseSlider <TValueType> .SliderKey sliderKey = BaseSlider <TValueType> .SliderKey.None;
            bool flag  = this.direction == SliderDirection.Horizontal;
            bool flag2 = (flag && evt.keyCode == KeyCode.Home) || (!flag && evt.keyCode == KeyCode.End);

            if (flag2)
            {
                sliderKey = BaseSlider <TValueType> .SliderKey.Lowest;
            }
            else
            {
                bool flag3 = (flag && evt.keyCode == KeyCode.End) || (!flag && evt.keyCode == KeyCode.Home);
                if (flag3)
                {
                    sliderKey = BaseSlider <TValueType> .SliderKey.Highest;
                }
                else
                {
                    bool flag4 = (flag && evt.keyCode == KeyCode.PageUp) || (!flag && evt.keyCode == KeyCode.PageDown);
                    if (flag4)
                    {
                        sliderKey = BaseSlider <TValueType> .SliderKey.LowerPage;
                    }
                    else
                    {
                        bool flag5 = (flag && evt.keyCode == KeyCode.PageDown) || (!flag && evt.keyCode == KeyCode.PageUp);
                        if (flag5)
                        {
                            sliderKey = BaseSlider <TValueType> .SliderKey.HigherPage;
                        }
                        else
                        {
                            bool flag6 = (flag && evt.keyCode == KeyCode.LeftArrow) || (!flag && evt.keyCode == KeyCode.DownArrow);
                            if (flag6)
                            {
                                sliderKey = BaseSlider <TValueType> .SliderKey.Lower;
                            }
                            else
                            {
                                bool flag7 = (flag && evt.keyCode == KeyCode.RightArrow) || (!flag && evt.keyCode == KeyCode.UpArrow);
                                if (flag7)
                                {
                                    sliderKey = BaseSlider <TValueType> .SliderKey.Higher;
                                }
                            }
                        }
                    }
                }
            }
            bool flag8 = sliderKey == BaseSlider <TValueType> .SliderKey.None;

            if (!flag8)
            {
                this.ComputeValueFromKey(sliderKey, evt.shiftKey);
                evt.StopPropagation();
            }
        }
コード例 #2
0
        public ClampedDragger(BaseSlider <T> slider, System.Action clickHandler, System.Action dragHandler)
            :
            base(clickHandler, ScrollWaitDefinitions.firstWait, ScrollWaitDefinitions.regularWait)
        {
            dragDirection = DragDirection.None;

            this.slider = slider;

            dragging += dragHandler;
        }
コード例 #3
0
        internal override void ComputeValueFromKey(BaseSlider <int> .SliderKey sliderKey, bool isShift)
        {
            if (sliderKey != BaseSlider <int> .SliderKey.None)
            {
                if (sliderKey != BaseSlider <int> .SliderKey.Lowest)
                {
                    if (sliderKey != BaseSlider <int> .SliderKey.Highest)
                    {
                        bool  flag = sliderKey == BaseSlider <int> .SliderKey.LowerPage || sliderKey == BaseSlider <int> .SliderKey.HigherPage;
                        float num  = BaseSlider <int> .GetClosestPowerOfTen(Mathf.Abs((float)(base.highValue - base.lowValue) * 0.01f));

                        bool flag2 = num < 1f;
                        if (flag2)
                        {
                            num = 1f;
                        }
                        bool flag3 = flag;
                        if (flag3)
                        {
                            num *= this.pageSize;
                        }
                        else if (isShift)
                        {
                            num *= 10f;
                        }
                        bool flag4 = sliderKey == BaseSlider <int> .SliderKey.Lower || sliderKey == BaseSlider <int> .SliderKey.LowerPage;
                        if (flag4)
                        {
                            num = -num;
                        }
                        this.value = Mathf.RoundToInt(BaseSlider <int> .RoundToMultipleOf((float)this.value + num * 0.5001f, Mathf.Abs(num)));
                    }
                    else
                    {
                        this.value = base.highValue;
                    }
                }
                else
                {
                    this.value = base.lowValue;
                }
            }
        }
コード例 #4
0
 internal abstract void ComputeValueFromKey(BaseSlider <TValueType> .SliderKey sliderKey, bool isShift);
コード例 #5
0
 public ClampedDragger(BaseSlider <T> slider, Action clickHandler, Action dragHandler) : base(clickHandler, 250L, 30L)
 {
     this.dragDirection = ClampedDragger <T> .DragDirection.None;
     this.slider        = slider;
     this.dragging     += dragHandler;
 }