コード例 #1
0
        static int DelayedAndDraggableIntField(Rect rect, GUIContent label, int value, ref InputEvent inputEvent, long dragSensitivity)
        {
            var id        = GUIUtility.GetControlID(FocusType.Keyboard);
            var fieldRect = EditorGUI.PrefixLabel(rect, id, label);

            rect.xMax = fieldRect.x;

            double dummy    = 0.0;
            long   refValue = value;

            inputEvent |= InputEventType(rect, id);

            EditorGUI.DragNumberValue(rect, id, false, ref dummy, ref refValue, dragSensitivity);

            EditorGUI.BeginChangeCheck();
            var result = EditorGUI.DelayedIntFieldInternal(fieldRect, GUIContent.none, (int)refValue, EditorStyles.numberField);

            if (EditorGUI.EndChangeCheck())
            {
                inputEvent |= InputEvent.KeyboardInput;
            }

            return(result);
        }