예제 #1
0
        // ---------------------
        private void DrawBasicGUI(TouchGestureThresholds target)
        {
            //MultiTouchGestureThresholds multiTarget = (target as MultiTouchGestureThresholds);


            float
                tapMoveThreshCm    = target.tapMoveThreshCm,
                tapPosThreshCm     = target.tapPosThreshCm,
                dragThreshCm       = target.dragThreshCm,
                scrollThreshCm     = target.scrollThreshCm,
                scrollMagnetFactor = target.scrollMagnetFactor,

                swipeSegLenCm      = target.swipeSegLenCm,
                swipeJoystickRadCm = target.swipeJoystickRadCm,
            //dragJoyDeadZone		= target.dragJoyDeadZone,

                tapMaxDur          = target.tapMaxDur,
                multiTapMaxTimeGap = target.multiTapMaxTimeGap,

            //longTapMinTime		= target.longTapMinTime,
                longTapMaxDuration = target.longTapMaxDuration,

                longPressMinTime = target.longPressMinTime;



            // GUI...


            tapMoveThreshCm = CFGUI.FloatField(new GUIContent("Static Thresh. (cm)", "Static touch threshold - maximal allowed movement distance for touch to be counted as a static tap."),
                                               tapMoveThreshCm, 0.01f, 1.0f, LABEL_WIDTH);

            dragThreshCm = CFGUI.FloatField(new GUIContent("Swipe Thresh (cm)", "Minimal swipe distance in centimeters to activate that gesture. This value should be grater then the Static Threshold!"),
                                            dragThreshCm, 0.01f, 5.0f, LABEL_WIDTH);

            EditorGUILayout.Space();

            scrollThreshCm = CFGUI.FloatField(new GUIContent("Scroll Step (cm)", "Swipe distance in centimeters for one scroll step"),
                                              scrollThreshCm, 0.01f, 5.0f, LABEL_WIDTH);

            scrollMagnetFactor = CFGUI.Slider(new GUIContent("Scroll Magnet", "Scroll magnet factor."),
                                              scrollMagnetFactor, 0, 0.5f, LABEL_WIDTH);


            EditorGUILayout.Space();
            swipeSegLenCm = CFGUI.FloatField(new GUIContent("Swipe Segment Len. (cm)", "Swipe segment length in centimeters used to determinate changing direction of a single swipe."),
                                             swipeSegLenCm, 0.1f, 10.0f, LABEL_WIDTH);

            swipeJoystickRadCm = CFGUI.FloatField(new GUIContent("Swipe Joy Rad (cm)", "Swipe joystick radius in centimeters."),
                                                  swipeJoystickRadCm, 0.1f, 10.0f, LABEL_WIDTH);


            EditorGUILayout.Space();


            tapPosThreshCm = CFGUI.FloatField(new GUIContent("Max Tap Dist. (cm)", "Maximal allowed distance between consecutive taps."),
                                              tapPosThreshCm, 0.1f, 10.0f, LABEL_WIDTH);


            tapMaxDur = CFGUI.FloatFieldEx(new GUIContent("Tap Max. Duration", "Maximal allowed tap touch duration in milliseconds."),
                                           tapMaxDur, 0.02f, 1.0f, 1000, true, LABEL_WIDTH);

            multiTapMaxTimeGap = CFGUI.FloatFieldEx(new GUIContent("Tap Max. Gap", "Maximal allowed time \'gap\' between consecutive taps."),
                                                    multiTapMaxTimeGap, 0.02f, 2.0f, 1000, true, LABEL_WIDTH);



            longPressMinTime = CFGUI.FloatFieldEx(new GUIContent("Long Press Min Time", "Minimal \'hold\' touch duration in milliseconds."),
                                                  longPressMinTime, 0.02f, 1000f, 1000, true, LABEL_WIDTH);

            longTapMaxDuration = CFGUI.FloatFieldEx(new GUIContent("Long Tap Max Duration", "Maximal duration of a long tap in milliseconds."),
                                                    longTapMaxDuration, 0.02f, 1000f, 1000, true, LABEL_WIDTH);



            // Register Undo...

            if ((tapMoveThreshCm != target.tapMoveThreshCm) ||
                (tapPosThreshCm != target.tapPosThreshCm) ||
                (dragThreshCm != target.dragThreshCm) ||
                (scrollThreshCm != target.scrollThreshCm) ||
                (scrollMagnetFactor != target.scrollMagnetFactor) ||
                (swipeSegLenCm != target.swipeSegLenCm) ||
                (swipeJoystickRadCm != target.swipeJoystickRadCm) ||
                (tapMaxDur != target.tapMaxDur) ||
                (multiTapMaxTimeGap != target.multiTapMaxTimeGap) ||
                //(longTapMinTime		!= target.longTapMinTime) ||
                (longTapMaxDuration != target.longTapMaxDuration) ||
                (longPressMinTime != target.longPressMinTime))
//			(chargeMinTime		!= target.chargeMinTime) ||
//			(repeatDelay		!= target.repeatDelay) ||
//			(repeatInterval		!= target.repeatInterval) ||
//			(velSustainTime		!= target.velSustainTime))
            {
                CFGUI.CreateUndo("Touch Gesture Thresholds modification", this.undoObject);

                target.tapMoveThreshCm    = tapMoveThreshCm;
                target.tapPosThreshCm     = tapPosThreshCm;
                target.dragThreshCm       = dragThreshCm;
                target.scrollThreshCm     = scrollThreshCm;
                target.scrollMagnetFactor = scrollMagnetFactor;
                target.swipeSegLenCm      = swipeSegLenCm;
                target.swipeJoystickRadCm = swipeJoystickRadCm;
                target.tapMaxDur          = tapMaxDur;
                target.multiTapMaxTimeGap = multiTapMaxTimeGap;
                target.longTapMaxDuration = longTapMaxDuration;
                target.longPressMinTime   = longPressMinTime;

                CFGUI.EndUndo(this.undoObject);
            }
        }