MinMaxSlider() public static method

public static MinMaxSlider ( Rect position, float &value, float &size, float visualStart, float visualEnd, float startLimit, float endLimit, GUIStyle slider, GUIStyle thumb, bool horiz ) : void
position UnityEngine.Rect
value float
size float
visualStart float
visualEnd float
startLimit float
endLimit float
slider UnityEngine.GUIStyle
thumb UnityEngine.GUIStyle
horiz bool
return void
示例#1
0
        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);

            EditorGUIExt.MinMaxSlider(position2, ref value, ref size, num2, num3, num2, num3, slider, thumb, horiz);
            bool flag = false;

            if (Event.current.type == EventType.MouseUp)
            {
                flag = true;
            }
            if (EditorGUIExt.ScrollerRepeatButton(id, rect, leftButton))
            {
                value -= num * ((visualStart >= visualEnd) ? -1f : 1f);
            }
            if (EditorGUIExt.ScrollerRepeatButton(id, rect2, rightButton))
            {
                value += num * ((visualStart >= visualEnd) ? -1f : 1f);
            }
            if (flag && Event.current.type == EventType.Used)
            {
                EditorGUIExt.scrollControlID = 0;
            }
            if (startLimit < endLimit)
            {
                value = Mathf.Clamp(value, startLimit, endLimit - size);
            }
            else
            {
                value = Mathf.Clamp(value, endLimit, startLimit - size);
            }
        }