// ---------------
        public override void OnInspectorGUI()
        {
            ControlFreak2.SuperTouchZone c = (ControlFreak2.SuperTouchZone) this.target;

            GUILayout.Box(GUIContent.none, CFEditorStyles.Inst.headerTouchZone, GUILayout.ExpandWidth(true));


            this.DrawWarnings(c);



            int
                maxFingers = c.maxFingers;
            float
                strictMultiTouchTime = c.strictMultiTouchTime;
            float
                touchSmoothing = c.touchSmoothing;
            bool
                strictMultiTouch        = c.strictMultiTouch,
                freezeTwistWhenTooClose = c.freezeTwistWhenTooClose,
                noPinchAfterDrag        = c.noPinchAfterDrag,
                noPinchAfterTwist       = c.noPinchAfterTwist,
                noTwistAfterDrag        = c.noTwistAfterDrag,
                noTwistAfterPinch       = c.noTwistAfterPinch,
                noDragAfterPinch        = c.noDragAfterPinch,
                noDragAfterTwist        = c.noDragAfterTwist,
                startPinchWhenTwisting  = c.startPinchWhenTwisting,
                startPinchWhenDragging  = c.startPinchWhenDragging,
                startDragWhenPinching   = c.startDragWhenPinching,
                startDragWhenTwisting   = c.startDragWhenTwisting,
                startTwistWhenDragging  = c.startTwistWhenDragging,
                startTwistWhenPinching  = c.startTwistWhenPinching;

            ControlFreak2.SuperTouchZone.GestureDetectionOrder
                gestureDetectionOrder = c.gestureDetectionOrder;



            bool
                emuWithKeys = c.emuWithKeys;
            KeyCode
                emuKeyOneFinger         = c.emuKeyOneFinger,
                emuKeyTwoFingers        = c.emuKeyTwoFingers,
                emuKeyThreeFingers      = c.emuKeyThreeFingers,
                emuKeySwipeU            = c.emuKeySwipeU,
                emuKeySwipeR            = c.emuKeySwipeR,
                emuKeySwipeD            = c.emuKeySwipeD,
                emuKeySwipeL            = c.emuKeySwipeL,
                emuKeyTwistR            = c.emuKeyTwistR,
                emuKeyTwistL            = c.emuKeyTwistL,
                emuKeyPinch             = c.emuKeyPinch,
                emuKeySpread            = c.emuKeySpread,
                emuMouseTwoFingersKey   = c.emuMouseTwoFingersKey,
                emuMouseTwistKey        = c.emuMouseTwistKey,
                emuMousePinchKey        = c.emuMousePinchKey,
                emuMouseThreeFingersKey = c.emuMouseThreeFingersKey;

            ControlFreak2.SuperTouchZone.EmuMouseAxis
                emuMousePinchAxis = c.emuMousePinchAxis,
                emuMouseTwistAxis = c.emuMouseTwistAxis;

            float
                emuKeySwipeSpeed          = c.emuKeySwipeSpeed,
                emuKeyPinchSpeed          = c.emuKeyPinchSpeed,
                emuKeyTwistSpeed          = c.emuKeyTwistSpeed,
                mouseEmuTwistScreenFactor = c.mouseEmuTwistScreenFactor;



            if (InspectorUtils.BeginIndentedSection(new GUIContent("Touch Zone Settings"), ref this.settingsFoldedOut))
            {
                maxFingers = CFGUI.IntSlider(new GUIContent("Max finger number", "Maximal number of fingers allowed at the same time."),
                                             maxFingers, 1, ControlFreak2.SuperTouchZone.MAX_FINGERS, 120);

                touchSmoothing = CFGUI.Slider(new GUIContent("Touch. smoothing", "Amount of smoothing applied to controlling touch position. "),
                                              touchSmoothing, 0, 1, 120);



                if (maxFingers >= 2)
                {
                    EditorGUILayout.Space();

                    InspectorUtils.BeginIndentedSection(new GUIContent("Multi-finger Gesture Settings"));

                    strictMultiTouch = EditorGUILayout.ToggleLeft(new GUIContent("Strict multi-touch", "Use strict rules when detecting multi-finger touch gestures."),
                                                                  strictMultiTouch);

                    if (strictMultiTouch)
                    {
                        strictMultiTouchTime = CFGUI.FloatFieldEx(new GUIContent("Strict multi-touch time", "Time in milliseconds to wait for more fingers when starting a multi-finger touch. Touh zone will wait (and not report the fingers already pressed) until time runs out or any of the fingers already pressed moves."),
                                                                  strictMultiTouchTime, 0, 1.0f, 1000, true, 150);
                    }

                    freezeTwistWhenTooClose = EditorGUILayout.ToggleLeft(new GUIContent("Freeze twist when too close.", "Freeze Twist angle when two fingers get too close."),
                                                                         freezeTwistWhenTooClose);

                    EditorGUILayout.Space();

                    noPinchAfterDrag = EditorGUILayout.ToggleLeft(new GUIContent("No Pinch after Swipe.", "Don't allow Pinch gesture to activate after swipe has been detected."),
                                                                  noPinchAfterDrag);
                    noPinchAfterTwist = EditorGUILayout.ToggleLeft(new GUIContent("No Pinch after Twist.", "Don't allow Pinch gesture to activate after twist has been detected."),
                                                                   noPinchAfterTwist);

                    EditorGUILayout.Space();

                    noTwistAfterDrag = EditorGUILayout.ToggleLeft(new GUIContent("No Twist after Swipe.", "Don't allow Twist gesture to activate after swipe has been detected."),
                                                                  noTwistAfterDrag);
                    noTwistAfterPinch = EditorGUILayout.ToggleLeft(new GUIContent("No Twist after Pinch.", "Don't allow Twist gesture to activate after pinch has been detected."),
                                                                   noTwistAfterPinch);

                    EditorGUILayout.Space();

                    noDragAfterPinch = EditorGUILayout.ToggleLeft(new GUIContent("No Swipe after Pinch.", "Don't allow Swipe gesture to activate after pinch has been detected."),
                                                                  noDragAfterPinch);
                    noDragAfterTwist = EditorGUILayout.ToggleLeft(new GUIContent("No Swipe after Twist.", "Don't allow Swipe gesture to activate after twist has been detected."),
                                                                  noDragAfterTwist);

                    EditorGUILayout.Space();


                    startPinchWhenTwisting = EditorGUILayout.ToggleLeft(new GUIContent("Start Pinch when Twisting", "Auto-activate Pinch gesture when Twist gesture has been detected."),
                                                                        startPinchWhenTwisting);
                    startPinchWhenDragging = EditorGUILayout.ToggleLeft(new GUIContent("Start Pinch when Swiping", "Auto-activate Pinch gesture when Swipe gesture has been detected."),
                                                                        startPinchWhenDragging);
                    EditorGUILayout.Space();

                    startDragWhenPinching = EditorGUILayout.ToggleLeft(new GUIContent("Start Swipe when Pinching", "Auto-activate Swipe gesture when Pinch gesture has been detected."),
                                                                       startDragWhenPinching);
                    startDragWhenTwisting = EditorGUILayout.ToggleLeft(new GUIContent("Start Swipe when Twisting", "Auto-activate Swipe gesture when Twist gesture has been detected."),
                                                                       startDragWhenTwisting);
                    EditorGUILayout.Space();

                    startTwistWhenDragging = EditorGUILayout.ToggleLeft(new GUIContent("Start Twist when Swiping", "Auto-activate Twist esture when Swipe gesture has been detected."),
                                                                        startTwistWhenDragging);
                    startTwistWhenPinching = EditorGUILayout.ToggleLeft(new GUIContent("Start Twist when Pinching", "Auto-activate Twist gesture when Pinching gesture has been detected."),
                                                                        startTwistWhenPinching);
                    EditorGUILayout.Space();



                    gestureDetectionOrder = (SuperTouchZone.GestureDetectionOrder)CFGUI.EnumPopup(new GUIContent("Gesture detect. order",
                                                                                                                 "Gesture Detection Order. Useful is you don't allow some gesture combinations at the same time."), gestureDetectionOrder, 130);

                    InspectorUtils.EndIndentedSection();
                }


                // Thresholds...

                EditorGUILayout.Space();

                this.touchThreshInsp.DrawGUI(c.customThresh);

                // Finger configs...

                for (int i = 0; i < Mathf.Min(c.maxFingers, this.multiFingerConfigInspArray.Length); ++i)
                {
                    EditorGUILayout.Space();

                    this.multiFingerConfigInspArray[i].DrawConfigGUI(c.multiFingerConfigs[i]);
                }



                InspectorUtils.EndIndentedSection();
            }



            EditorGUILayout.Space();

            if (InspectorUtils.BeginIndentedSection(new GUIContent("Touch Zone Bindings"), ref this.multiFingerBindingsFoldedOut))
            {
                //InspectorUtils.BeginIndentedSection(new GUIContent("Touch Zone Bindings"));
                //	if (InspectorUtils.BeginIndentedSection(new GUIContent("Multi-Finger Touch Bindings"), ref this.multiFingerBindingsFoldedOut))
                //		{


                for (int i = 0; i < Mathf.Min(c.maxFingers, this.multiFingerConfigInspArray.Length); ++i)
                {
                    this.multiFingerConfigInspArray[i].DrawBindingGUI(c.multiFingerConfigs[i]);
                    EditorGUILayout.Space();
                }

                //InspectorUtils.EndIndentedSection();
                //}

                if (maxFingers >= 2)
                {
                    if (InspectorUtils.BeginIndentedSection(new GUIContent("Twist and Pinch Bindings"), ref this.twistAndPinchBindingFoldedOut))
                    {
                        this.twistAnalogBindingInsp.Draw(c.twistAnalogBinding, c.rig);
                        this.twistDeltaBindingInsp.Draw(c.twistDeltaBinding, c.rig);
                        //this.twistKeyBindingInsp.Draw(c.twistKeyBinding, c.rig);

                        this.twistRightDigitalBindingInsp.Draw(c.twistRightDigitalBinding, c.rig);
                        this.twistLeftDigitalBindingInsp.Draw(c.twistLeftDigitalBinding, c.rig);

                        this.twistScrollDeltaBindingInsp.Draw(c.twistScrollDeltaBinding, c.rig);


                        EditorGUILayout.Space();

                        this.pinchAnalogBindingInsp.Draw(c.pinchAnalogBinding, c.rig);
                        this.pinchDeltaBindingInsp.Draw(c.pinchDeltaBinding, c.rig);
                        //this.pinchKeyBindingInsp.Draw(c.pinchKeyBinding, c.rig);

                        this.pinchDigitalBindingInsp.Draw(c.pinchDigitalBinding, c.rig);
                        this.spreadDigitalBindingInsp.Draw(c.spreadDigitalBinding, c.rig);

                        this.pinchScrollDeltaBindingInsp.Draw(c.pinchScrollDeltaBinding, c.rig);

                        InspectorUtils.EndIndentedSection();
                    }
                }


                EditorGUILayout.Space();

                InspectorUtils.BeginIndentedSection(new GUIContent("Misc. Touch Zone Bindings"));


                this.separateFingersAsEmuTouchesBindingInsp.Draw(c.separateFingersAsEmuTouchesBinding, c.rig);

                InspectorUtils.EndIndentedSection();

                InspectorUtils.EndIndentedSection();
            }


            EditorGUILayout.Space();


            if (InspectorUtils.BeginIndentedSection(new GUIContent("Keyboard Settings"), ref this.keyboardFoldedOut))
            {
                emuWithKeys = EditorGUILayout.ToggleLeft(new GUIContent("Keyboard control", "Use keyboard to control this touch control."),
                                                         emuWithKeys);

                const float KEY_LABEL_WIDTH = 120;

                if (emuWithKeys)
                {
                    emuKeyOneFinger = (KeyCode)CFGUI.EnumPopup(new GUIContent("One Finger Press", "Static press with one finger."),
                                                               emuKeyOneFinger, KEY_LABEL_WIDTH);

                    if (maxFingers >= 2)
                    {
                        emuKeyTwoFingers = (KeyCode)CFGUI.EnumPopup(new GUIContent("Two Finger Press", "Static press with two fingers."),
                                                                    emuKeyTwoFingers, KEY_LABEL_WIDTH);
                    }

                    if (maxFingers >= 3)
                    {
                        emuKeyThreeFingers = (KeyCode)CFGUI.EnumPopup(new GUIContent("Three Finger Press", "Static press with three fingers."),
                                                                      emuKeyThreeFingers, KEY_LABEL_WIDTH);
                    }

                    EditorGUILayout.Space();

                    emuKeySwipeU = (KeyCode)CFGUI.EnumPopup(new GUIContent("Swipe Up", "Swipe Up.\nNote: you can start a multi-finger press with one of keys defined above and then simulate swipe with one of these keys."),
                                                            emuKeySwipeU, KEY_LABEL_WIDTH);
                    emuKeySwipeR = (KeyCode)CFGUI.EnumPopup(new GUIContent("Swipe Right", "Swipe Right.\nNote: you can start a multi-finger press with one of keys defined above and then simulate swipe with one of these keys."),
                                                            emuKeySwipeR, KEY_LABEL_WIDTH);
                    emuKeySwipeD = (KeyCode)CFGUI.EnumPopup(new GUIContent("Swipe Down", "Swipe Down.\nNote: you can start a multi-finger press with one of keys defined above and then simulate swipe with one of these keys."),
                                                            emuKeySwipeD, KEY_LABEL_WIDTH);
                    emuKeySwipeL = (KeyCode)CFGUI.EnumPopup(new GUIContent("Swipe Left", "Swipe Left.\nNote: you can start a multi-finger press with one of keys defined above and then simulate swipe with one of these keys."),
                                                            emuKeySwipeL, KEY_LABEL_WIDTH);


                    if (maxFingers >= 2)
                    {
                        EditorGUILayout.Space();

                        emuKeyTwistR = (KeyCode)CFGUI.EnumPopup(new GUIContent("Twist Right", "Start a two-finger press and twist clockwise.\nNote: This can be combined with pinching and swiping!"),
                                                                emuKeyTwistR, KEY_LABEL_WIDTH);
                        emuKeyTwistL = (KeyCode)CFGUI.EnumPopup(new GUIContent("Twist Left", "Start a two-finger press and twist counter-colckwise.\nNote: This can be combined with pinching and swiping!"),
                                                                emuKeyTwistL, KEY_LABEL_WIDTH);

                        emuKeyPinch = (KeyCode)CFGUI.EnumPopup(new GUIContent("Pinch", "Start a two-finger press and pinch them together.\nNote: This can be combined with twisting and swiping!"),
                                                               emuKeyPinch, KEY_LABEL_WIDTH);
                        emuKeySpread = (KeyCode)CFGUI.EnumPopup(new GUIContent("Spread", "Start a two-finger press and spread them apart.\nNote: This can be combined with twisting and swiping!"),
                                                                emuKeySpread, KEY_LABEL_WIDTH);

                        emuKeySwipeSpeed = CFGUI.Slider(new GUIContent("Key Swipe Speed", "Keyboard swipe speed in screen widths per second."),
                                                        emuKeySwipeSpeed, 0.1f, 1.0f, KEY_LABEL_WIDTH);
                        emuKeyPinchSpeed = CFGUI.Slider(new GUIContent("Key Pinch Speed", "Keyboard pinch speed in screen widths per second."),
                                                        emuKeyPinchSpeed, 0.1f, 1.0f, KEY_LABEL_WIDTH);
                        emuKeyTwistSpeed = CFGUI.Slider(new GUIContent("Key Twist Speed", "Keyboard twist speed in degrees per second."),
                                                        emuKeyTwistSpeed, 25, 360, KEY_LABEL_WIDTH);


                        EditorGUILayout.Space();

                        emuMouseTwoFingersKey = (KeyCode)CFGUI.EnumPopup(new GUIContent("2-finger mouse mod.", "Holding this key and clicking with a mouse will start two virtual touches."),
                                                                         emuMouseTwoFingersKey, KEY_LABEL_WIDTH);

                        if (maxFingers >= 3)
                        {
                            emuMouseThreeFingersKey = (KeyCode)CFGUI.EnumPopup(new GUIContent("3-finger mouse mod.", "Holding this key and clicking with a mouse will start three virtual touches."),
                                                                               emuMouseThreeFingersKey, KEY_LABEL_WIDTH);
                        }

                        EditorGUILayout.Space();

                        emuMouseTwistKey = (KeyCode)CFGUI.EnumPopup(new GUIContent("Twist mouse mod.", "Twist mouse modifier. Holding this key and clicking with a mouse will start two virtual touches. Dragging the mouse along axis selected below will simulate twist."),
                                                                    emuMouseTwistKey, KEY_LABEL_WIDTH);

                        emuMousePinchKey = (KeyCode)CFGUI.EnumPopup(new GUIContent("Pinch mouse mod.", "Pinch mouse modifier. Holding this key and clicking with a mouse will start two virtual touches. Dragging the mouse along axis selected below will simulate pinch."),
                                                                    emuMousePinchKey, KEY_LABEL_WIDTH);

                        emuMouseTwistAxis = (ControlFreak2.SuperTouchZone.EmuMouseAxis)CFGUI.EnumPopup(new GUIContent("Mouse twist axis", "Select mouse drag axis to simulate twist.\nNote: If twist and pinch axes are not the same, twist and pinch mouse modifers can be combined to twist and pinch with a mouse at the same time."),
                                                                                                       emuMouseTwistAxis, KEY_LABEL_WIDTH);
                        emuMousePinchAxis = (ControlFreak2.SuperTouchZone.EmuMouseAxis)CFGUI.EnumPopup(new GUIContent("Mouse pinch axis", "Select mouse drag axis to simulate pinch.\nNote: If twist and pinch axes are not the same, twist and pinch mouse modifers can be combined to twist and pinch with a mouse at the same time."),
                                                                                                       emuMousePinchAxis, KEY_LABEL_WIDTH);


                        mouseEmuTwistScreenFactor = CFGUI.Slider(new GUIContent("Mouse Twist Factor", "Fraction of screen width to drag to twist virtual fingers by 360 degrees."),
                                                                 mouseEmuTwistScreenFactor, 0.2f, 1.0f, KEY_LABEL_WIDTH);
                    }
                }

                InspectorUtils.EndIndentedSection();
            }


            // Register undo...



            if ((maxFingers != c.maxFingers) ||
                (touchSmoothing != c.touchSmoothing) ||
                (strictMultiTouchTime != c.strictMultiTouchTime) ||
                (strictMultiTouch != c.strictMultiTouch) ||
                (freezeTwistWhenTooClose != c.freezeTwistWhenTooClose) ||
                (noPinchAfterDrag != c.noPinchAfterDrag) ||
                (noPinchAfterTwist != c.noPinchAfterTwist) ||
                (noTwistAfterDrag != c.noTwistAfterDrag) ||
                (noTwistAfterPinch != c.noTwistAfterPinch) ||
                (noDragAfterPinch != c.noDragAfterPinch) ||
                (noDragAfterTwist != c.noDragAfterTwist) ||
                (startPinchWhenTwisting != c.startPinchWhenTwisting) ||
                (startPinchWhenDragging != c.startPinchWhenDragging) ||
                (startDragWhenPinching != c.startDragWhenPinching) ||
                (startDragWhenTwisting != c.startDragWhenTwisting) ||
                (startTwistWhenDragging != c.startTwistWhenDragging) ||
                (startTwistWhenPinching != c.startTwistWhenPinching) ||
                (gestureDetectionOrder != c.gestureDetectionOrder) ||
                //(bindSeparateFingersToEmuTouches	!= c.bindSeparateFingersToEmuTouches) ||
//			(twistBindMode			!= c.twistBindMode) ||
//			(pinchBindMode			!= c.pinchBindMode) ||
                (emuWithKeys != c.emuWithKeys) ||
                (emuKeyOneFinger != c.emuKeyOneFinger) ||
                (emuKeyTwoFingers != c.emuKeyTwoFingers) ||
                (emuKeyThreeFingers != c.emuKeyThreeFingers) ||
                (emuKeySwipeU != c.emuKeySwipeU) ||
                (emuKeySwipeR != c.emuKeySwipeR) ||
                (emuKeySwipeD != c.emuKeySwipeD) ||
                (emuKeySwipeL != c.emuKeySwipeL) ||
                (emuKeyTwistR != c.emuKeyTwistR) ||
                (emuKeyTwistL != c.emuKeyTwistL) ||
                (emuKeyPinch != c.emuKeyPinch) ||
                (emuKeySpread != c.emuKeySpread) ||
                (emuMouseTwoFingersKey != c.emuMouseTwoFingersKey) ||
                (emuMouseTwistKey != c.emuMouseTwistKey) ||
                (emuMousePinchKey != c.emuMousePinchKey) ||
                (emuMouseThreeFingersKey != c.emuMouseThreeFingersKey) ||
                (emuMousePinchAxis != c.emuMousePinchAxis) ||
                (emuMouseTwistAxis != c.emuMouseTwistAxis) ||
                (emuKeySwipeSpeed != c.emuKeySwipeSpeed) ||
                (emuKeyPinchSpeed != c.emuKeyPinchSpeed) ||
                (emuKeyTwistSpeed != c.emuKeyTwistSpeed) ||
                (mouseEmuTwistScreenFactor != c.mouseEmuTwistScreenFactor))
            {
                CFGUI.CreateUndo("CF2 Touch Zone modification", c);

                c.maxFingers              = maxFingers;
                c.strictMultiTouchTime    = strictMultiTouchTime;
                c.strictMultiTouch        = strictMultiTouch;
                c.freezeTwistWhenTooClose = freezeTwistWhenTooClose;
                c.noPinchAfterDrag        = noPinchAfterDrag;
                c.noPinchAfterTwist       = noPinchAfterTwist;
                c.noTwistAfterDrag        = noTwistAfterDrag;
                c.noTwistAfterPinch       = noTwistAfterPinch;
                c.noDragAfterPinch        = noDragAfterPinch;
                c.noDragAfterTwist        = noDragAfterTwist;
                c.startPinchWhenTwisting  = startPinchWhenTwisting;
                c.startPinchWhenDragging  = startPinchWhenDragging;
                c.startDragWhenPinching   = startDragWhenPinching;
                c.startDragWhenTwisting   = startDragWhenTwisting;
                c.startTwistWhenDragging  = startTwistWhenDragging;
                c.startTwistWhenPinching  = startTwistWhenPinching;
                c.gestureDetectionOrder   = gestureDetectionOrder;

                if (c.touchSmoothing != touchSmoothing)
                {
                    c.SetTouchSmoothing(touchSmoothing);
                }


                c.emuWithKeys               = emuWithKeys;
                c.emuKeyOneFinger           = emuKeyOneFinger;
                c.emuKeyTwoFingers          = emuKeyTwoFingers;
                c.emuKeyThreeFingers        = emuKeyThreeFingers;
                c.emuKeySwipeU              = emuKeySwipeU;
                c.emuKeySwipeR              = emuKeySwipeR;
                c.emuKeySwipeD              = emuKeySwipeD;
                c.emuKeySwipeL              = emuKeySwipeL;
                c.emuKeyTwistR              = emuKeyTwistR;
                c.emuKeyTwistL              = emuKeyTwistL;
                c.emuKeyPinch               = emuKeyPinch;
                c.emuKeySpread              = emuKeySpread;
                c.emuMouseTwoFingersKey     = emuMouseTwoFingersKey;
                c.emuMouseTwistKey          = emuMouseTwistKey;
                c.emuMousePinchKey          = emuMousePinchKey;
                c.emuMouseThreeFingersKey   = emuMouseThreeFingersKey;
                c.emuMousePinchAxis         = emuMousePinchAxis;
                c.emuMouseTwistAxis         = emuMouseTwistAxis;
                c.emuKeySwipeSpeed          = emuKeySwipeSpeed;
                c.emuKeyPinchSpeed          = emuKeyPinchSpeed;
                c.emuKeyTwistSpeed          = emuKeyTwistSpeed;
                c.mouseEmuTwistScreenFactor = mouseEmuTwistScreenFactor;



                CFGUI.EndUndo(c);
            }


            // Draw Shared Control Params...

            this.DrawTouchContolGUI(c);
        }
Пример #2
0
        // -------------------
        public void DrawTouchContolGUI(TouchControl c)
        {
            if (c == null)
            {
                return;
            }

            bool
                ignoreFingerRadius       = c.ignoreFingerRadius,
                cantBeControlledDirectly = c.cantBeControlledDirectly,
                shareTouch = c.shareTouch,
                dontAcceptSharedTouches = c.dontAcceptSharedTouches,
                canBeSwipedOver         = c.canBeSwipedOver,
                restictSwipeOverTargets = c.restictSwipeOverTargets;

            TouchControl.SwipeOverOthersMode
                swipeOverOthersMode = c.swipeOverOthersMode;
            TouchControl.SwipeOffMode
                swipeOffMode = c.swipeOffMode;
            TouchControl.Shape
                shape = c.shape;


            // GUI...

            InspectorUtils.BeginIndentedSection(new GUIContent("Basic Settings"));

            shape = (TouchControl.Shape)CFGUI.EnumPopup(new GUIContent("Shape", "Control's shape"), shape, LABEL_WIDTH);

            ignoreFingerRadius = EditorGUILayout.ToggleLeft(new GUIContent("Ignore finger radius", "When enabled, this can only be hit by finger's center - finger's radius defined in Touch Control Panel will be ignored when hit testing."),
                                                            ignoreFingerRadius, GUILayout.MinWidth(30));

            cantBeControlledDirectly = EditorGUILayout.ToggleLeft(new GUIContent("Can't be touched directly", "When enabled, this control will not respond to direct touches, only to touches passed by it's dynamic region or other controls."),
                                                                  cantBeControlledDirectly, GUILayout.MinWidth(30));
            shareTouch = EditorGUILayout.ToggleLeft(new GUIContent("Touch-Through", "When touched, this control will pass it's controling touch down to control other controls below (if they accept shared touches)."),
                                                    shareTouch, GUILayout.MinWidth(30));
            dontAcceptSharedTouches = EditorGUILayout.ToggleLeft(new GUIContent("Don't accept shared touches", "When enabled, this control will not respond to touches already controlling other controls."),
                                                                 dontAcceptSharedTouches, GUILayout.MinWidth(30));

            EditorGUILayout.Space();

            canBeSwipedOver = EditorGUILayout.ToggleLeft(new GUIContent("Can be swiped over", "This control can be touched by swiping over it."),
                                                         canBeSwipedOver, GUILayout.MinWidth(30));

            swipeOffMode = (TouchControl.SwipeOffMode)CFGUI.EnumPopup(new GUIContent("Swipe Off", "Release when finger swipes off this control?"),
                                                                      swipeOffMode, 100);

            swipeOverOthersMode = (TouchControl.SwipeOverOthersMode)CFGUI.EnumPopup(new GUIContent("Swipe Over Others", "When to allow swiping over other controls?"),
                                                                                    swipeOverOthersMode, 100);



            if (swipeOverOthersMode != TouchControl.SwipeOverOthersMode.Disabled)
            {
                restictSwipeOverTargets = EditorGUILayout.ToggleLeft(new GUIContent("Restrict Swipe Over Targets", "Choose specific controls that can be swiped over from this control..."),
                                                                     restictSwipeOverTargets, GUILayout.MinWidth(30));

                if (restictSwipeOverTargets)
                {
                    this.swipeOverTargetListInsp.DrawGUI();
                }
            }


            InspectorUtils.EndIndentedSection();



            // Hiding conditions section...

            this.disablingConditionSetInsp.DrawGUI();



            // Refister undo...

            if (
                (ignoreFingerRadius != c.ignoreFingerRadius) ||
                (cantBeControlledDirectly != c.cantBeControlledDirectly) ||
                (shareTouch != c.shareTouch) ||
                (shareTouch != c.shareTouch) ||
                (dontAcceptSharedTouches != c.dontAcceptSharedTouches) ||

                (canBeSwipedOver != c.canBeSwipedOver) ||
                (swipeOffMode != c.swipeOffMode) ||
                (swipeOverOthersMode != c.swipeOverOthersMode) ||
                (restictSwipeOverTargets != c.restictSwipeOverTargets) ||

                (shape != c.shape))
            {
                CFGUI.CreateUndo("Touch Control Base Param modification", c);

                c.ignoreFingerRadius       = ignoreFingerRadius;
                c.cantBeControlledDirectly = cantBeControlledDirectly;
                c.shareTouch = shareTouch;
                c.dontAcceptSharedTouches = dontAcceptSharedTouches;
                c.shape = shape;

                c.canBeSwipedOver         = canBeSwipedOver;
                c.swipeOffMode            = swipeOffMode;
                c.swipeOverOthersMode     = swipeOverOthersMode;
                c.restictSwipeOverTargets = restictSwipeOverTargets;


                CFGUI.EndUndo(c);
            }
        }
Пример #3
0
        // -----------------
        public void DrawDynamicTouchControlGUI(DynamicTouchControl c)
        {
            // Draw basic TouchControl GUI...

            this.DrawTouchContolGUI(c);


            // Dynamic-only GUI...

            bool
                fadeOutWhenReleased = c.fadeOutWhenReleased,
                startFadedOut       = c.startFadedOut;
            float
                fadeOutTargetAlpha = c.fadeOutTargetAlpha,
                fadeInDuration     = c.fadeInDuration,
                fadeOutDelay       = c.fadeOutDelay,
                fadeOutDuration    = c.fadeOutDuration;

            bool
                centerOnDirectTouch   = c.centerOnDirectTouch,
                centerOnIndirectTouch = c.centerOnIndirectTouch,
                centerWhenFollowing   = c.centerWhenFollowing,

                stickyMode        = c.stickyMode,
                clampInsideRegion = c.clampInsideRegion,
                clampInsideCanvas = c.clampInsideCanvas,

                returnToStartingPosition = c.returnToStartingPosition;

            Vector2
                directInitialVector   = c.directInitialVector,
                indirectInitialVector = c.indirectInitialVector;
            float
                originSmoothTime = c.originSmoothTime,
                touchSmoothing   = c.touchSmoothing;
            DynamicRegion
                targetDynamicRegion = c.targetDynamicRegion;


            // GUI...



            InspectorUtils.BeginIndentedSection(new GUIContent("Dynamic Control Settings"));

            if (targetDynamicRegion == null)
            {
                EditorGUILayout.HelpBox("Connect this control to a Dynamic Region to make it dynamic.", MessageType.Info);
            }
            //else
            //	{
            //	GUI.enabled = false;
            targetDynamicRegion = (DynamicRegion)CFGUI.ObjectField(new GUIContent("Region", "Control's Dynamic Region.\n\nWARNING: Only one control can be assigned to a dynamic region!"),
                                                                   targetDynamicRegion, typeof(DynamicRegion), LABEL_WIDTH);
            //	GUI.enabled = true;
            //	}

            EditorGUILayout.Space();

            if (targetDynamicRegion != null)
            {
                if ((fadeOutWhenReleased = EditorGUILayout.ToggleLeft(new GUIContent("Fade-out when released", "Fade-out control when released (Dynamic mode ONLY)."),
                                                                      fadeOutWhenReleased)))
                {
                    CFGUI.BeginIndentedVertical();

                    startFadedOut = EditorGUILayout.ToggleLeft(new GUIContent("Start faded out", "This tontrol will start invisible at the begining."),
                                                               startFadedOut);

                    fadeOutTargetAlpha = CFGUI.Slider(new GUIContent("F.O. Alpha", "Fade-Out Target Alpha. Default value is ZERO (completely invisible)."),
                                                      fadeOutTargetAlpha, 0, 1, LABEL_WIDTH);

                    EditorGUILayout.Space();

                    fadeInDuration = CFGUI.FloatFieldEx(new GUIContent("Fade-In Dur.", "Fade-In duration (ms) : 0 = instant fade-in."),
                                                        fadeInDuration, 0, 2, 1000, true, 100);
                    fadeOutDuration = CFGUI.FloatFieldEx(new GUIContent("Fade-Out Dur.", "Fade-Out duration (ms) : 0 = instant fade-out."),
                                                         fadeOutDuration, 0, 2, 1000, true, 100);

                    fadeOutDelay = CFGUI.FloatFieldEx(new GUIContent("Fade-Out Delay.", "Fade-Out delay (ms)."),
                                                      fadeOutDelay, 0, 2, 1000, true, 100);

                    CFGUI.EndIndentedVertical();

                    EditorGUILayout.Space();
                }
            }


            if (targetDynamicRegion != null)
            {
                centerOnDirectTouch = EditorGUILayout.ToggleLeft(new GUIContent("Center On Direct Touch"),
                                                                 centerOnDirectTouch);
                centerOnIndirectTouch = EditorGUILayout.ToggleLeft(new GUIContent("Center On Indirect Touch"),
                                                                   centerOnIndirectTouch);

                const string initialPosTooltip =
                    "Normalized position that the control will center itself after being activated by a touch.\n" +
                    "Default if (0,0) (center).";

                if (centerOnDirectTouch)
                {
                    EditorGUILayout.LabelField(new GUIContent("Direct Touch Initial Pos", initialPosTooltip));
                    CFGUI.BeginIndentedVertical();
                    directInitialVector.x = CFGUI.Slider(new GUIContent("X", initialPosTooltip), directInitialVector.x, -1, 1, 20);
                    directInitialVector.y = CFGUI.Slider(new GUIContent("Y", initialPosTooltip), directInitialVector.y, -1, 1, 20);
                    CFGUI.EndIndentedVertical();
                }

                if (centerOnIndirectTouch)
                {
                    EditorGUILayout.LabelField(new GUIContent("Indirect Touch Initial Pos", initialPosTooltip));
                    CFGUI.BeginIndentedVertical();
                    indirectInitialVector.x = CFGUI.Slider(new GUIContent("X", initialPosTooltip), indirectInitialVector.x, -1, 1, 20);
                    indirectInitialVector.y = CFGUI.Slider(new GUIContent("Y", initialPosTooltip), indirectInitialVector.y, -1, 1, 20);
                    CFGUI.EndIndentedVertical();
                }

                EditorGUILayout.Space();
            }



            //GUI.enabled = (c.swipeOffMode == TouchControl.SwipeOffMode.Disabled);
            GUI.enabled = (c.swipeOffMode != TouchControl.SwipeOffMode.Enabled);


            stickyMode = EditorGUILayout.ToggleLeft(new GUIContent("Sticky Mode", "Control will follow the finger is it goes out of control bounds. This option will be disabled if control's Swipe Off Mode is det to Enabled!"),
                                                    stickyMode);

            if (stickyMode)
            {
                CFGUI.BeginIndentedVertical();
                centerWhenFollowing = EditorGUILayout.ToggleLeft(new GUIContent("Center when following.", "WARNING! Don't use this option on Joysticks or Steering Wheels - it will make them unusable!"),
                                                                 centerWhenFollowing);
                CFGUI.EndIndentedVertical();
            }

            GUI.enabled = true;

            EditorGUILayout.Space();


            clampInsideRegion = EditorGUILayout.ToggleLeft(new GUIContent("Clamp Inside Region", "Control will be clamped inside Dynamic Region when in Sticky Mode or when started by indirect touch."),
                                                           clampInsideRegion);

            clampInsideCanvas = EditorGUILayout.ToggleLeft(new GUIContent("Clamp Inside Canvas", "Control will be clamped inside parent canvas when in Sticky Mode or when started by indirect touch."),
                                                           clampInsideCanvas);


            EditorGUILayout.Space();

            if (targetDynamicRegion != null)
            {
                returnToStartingPosition = EditorGUILayout.ToggleLeft(new GUIContent("Return to start position", "Control will return to starting position after being released (Dynamic Mode)"),
                                                                      returnToStartingPosition);

                EditorGUILayout.Space();
            }


            originSmoothTime = CFGUI.Slider(new GUIContent("Move. smoothing", "Movement smoothing time (sticky mode, dynamic mode).\n\n0.0 = no smoothing/no animation.\n1.0 = slow movement."),
                                            originSmoothTime, 0, 1, 110);

            touchSmoothing = CFGUI.Slider(new GUIContent("Touch smoothing", "Amount of smoothing applied to controlling touch position. "),
                                          touchSmoothing, 0, 1, 110);


            InspectorUtils.EndIndentedSection();



            // Register Undo...

            if ((fadeOutWhenReleased != c.fadeOutWhenReleased) ||
                (startFadedOut != c.startFadedOut) ||
                (fadeOutTargetAlpha != c.fadeOutTargetAlpha) ||
                (fadeInDuration != c.fadeInDuration) ||
                (fadeOutDelay != c.fadeOutDelay) ||
                (fadeOutDuration != c.fadeOutDuration) ||
                (centerOnDirectTouch != c.centerOnDirectTouch) ||
                (centerOnIndirectTouch != c.centerOnIndirectTouch) ||
                (stickyMode != c.stickyMode) ||
                (clampInsideRegion != c.clampInsideRegion) ||
                (clampInsideCanvas != c.clampInsideCanvas) ||
                (targetDynamicRegion != c.targetDynamicRegion) ||
                (returnToStartingPosition != c.returnToStartingPosition) ||
                (directInitialVector != c.directInitialVector) ||
                (indirectInitialVector != c.indirectInitialVector) ||
                (touchSmoothing != c.touchSmoothing) ||
                (originSmoothTime != c.originSmoothTime))
            {
                CFGUI.CreateUndo("Dynamic Touch Control modification.", c);

                c.fadeOutWhenReleased      = fadeOutWhenReleased;
                c.startFadedOut            = startFadedOut;
                c.fadeOutTargetAlpha       = fadeOutTargetAlpha;
                c.fadeInDuration           = fadeInDuration;
                c.fadeOutDelay             = fadeOutDelay;
                c.fadeOutDuration          = fadeOutDuration;
                c.centerOnDirectTouch      = centerOnDirectTouch;
                c.centerOnIndirectTouch    = centerOnIndirectTouch;
                c.stickyMode               = stickyMode;
                c.clampInsideRegion        = clampInsideRegion;
                c.clampInsideCanvas        = clampInsideCanvas;
                c.returnToStartingPosition = returnToStartingPosition;
                c.directInitialVector      = directInitialVector;
                c.indirectInitialVector    = indirectInitialVector;
                c.originSmoothTime         = originSmoothTime;

                if (c.touchSmoothing != touchSmoothing)
                {
                    c.SetTouchSmoothing(touchSmoothing);
                }

                if (targetDynamicRegion != c.targetDynamicRegion)
                {
                    c.SetTargetDynamicRegion(targetDynamicRegion);
                }

                CFGUI.EndUndo(c);
            }
        }
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchSteeringWheel c = (TouchSteeringWheel)this.target;

            GUILayout.Box(GUIContent.none, CFEditorStyles.Inst.headerWheel, GUILayout.ExpandWidth(true));

            this.DrawWarnings(c);

            // Steerign wheel GUI...

            TouchSteeringWheel.WheelMode
                wheelMode = c.wheelMode;

            bool
                limitTurnSpeed = c.limitTurnSpeed;
            float
                minTurnTime      = c.minTurnTime,
                maxReturnTime    = c.maxReturnTime,
                maxTurnAngle     = c.maxTurnAngle,
                turnModeDeadZone = c.turnModeDeadZone;
            //	digitalThresh		= c.digitalThresh;
            bool
                physicalMode            = c.physicalMode,
                sendInputWhileReturning = c.sendInputWhileReturning;
            float
                physicalMoveRangeCm = c.physicalMoveRangeCm;

            this.emulateTouchPressure = c.emulateTouchPressure;


            const float LABEL_WIDTH = 120;


            // Steering Wheel specific inspector....

            InspectorUtils.BeginIndentedSection(new GUIContent("Steering Wheel Settings"));

            wheelMode = (TouchSteeringWheel.WheelMode)CFGUI.EnumPopup(new GUIContent("Wheel Mode"), wheelMode, LABEL_WIDTH);

            if (c.wheelMode == TouchSteeringWheel.WheelMode.Turn)
            {
                maxTurnAngle = CFGUI.FloatField(new GUIContent("Max. Turn Angle", "Maximal Turn angle in degrees (TURN Wheel Mode)."),
                                                maxTurnAngle, 1, 3600, LABEL_WIDTH);

                turnModeDeadZone = CFGUI.Slider(new GUIContent("Dead-zone", "Dead-zone - how far from wheel's center a finger must be to interact with it."),
                                                turnModeDeadZone, 0.01f, 0.9f, LABEL_WIDTH);
            }
            else
            {
                physicalMode = EditorGUILayout.ToggleLeft(new GUIContent("Physical Swipe Mode", "Define wheel's range in centimeters."), physicalMode);
                if (physicalMode)
                {
                    InspectorUtils.BeginIndentedSection();
                    physicalMoveRangeCm = CFGUI.FloatFieldEx(new GUIContent("Range (cm)", "Physical Mode's range in centimeters."),
                                                             physicalMoveRangeCm, 0.1f, 10, 1, false, LABEL_WIDTH);
                    InspectorUtils.EndIndentedSection();
                }
            }

            limitTurnSpeed = EditorGUILayout.ToggleLeft(new GUIContent("Limit turn speed", "Limit how fast the wheel can turn and how fast it can return to neutral position."),
                                                        limitTurnSpeed);


            if (limitTurnSpeed)
            {
                InspectorUtils.BeginIndentedSection();
                minTurnTime = CFGUI.FloatFieldEx(new GUIContent("Turn Time", "Turn Time in milliseconds - how quick can this wheel move from neutral position to maximal turn angle.\nSet to zero to remove speed limit."),
                                                 minTurnTime, 0, 5, 1000, true, LABEL_WIDTH);
                maxReturnTime = CFGUI.FloatFieldEx(new GUIContent("Return Time", "Time in milliseconds needed to return from maximal turn angle to neutral position."),
                                                   maxReturnTime, 0, 5, 1000, true, LABEL_WIDTH);
                InspectorUtils.EndIndentedSection();
            }



            EditorGUILayout.Space();

            this.analogConfigInsp.DrawGUI(c.analogConfig);

            InspectorUtils.EndIndentedSection();



            InspectorUtils.BeginIndentedSection(new GUIContent("Steering Wheel Bindings"));

            sendInputWhileReturning = EditorGUILayout.ToggleLeft(new GUIContent("Send input while returning", "If enabled, wheel's analog state will be sent to the rig while the wheel is returning to the neutral position."),
                                                                 sendInputWhileReturning, GUILayout.MinWidth(30));

            EditorGUILayout.Space();

            this.pressBindingInsp.Draw(c.pressBinding, c.rig);
            this.touchPressureBindingInsp.Draw(c.touchPressureBinding, c.rig);
            this.analogTurnBindingInsp.Draw(c.analogTurnBinding, c.rig);
            this.turnLeftBindingInsp.Draw(c.turnLeftBinding, c.rig);
            this.turnRightBindingInsp.Draw(c.turnRightBinding, c.rig);

            InspectorUtils.EndIndentedSection();


            // Register undo...


            if ((limitTurnSpeed != c.limitTurnSpeed) ||
                (minTurnTime != c.minTurnTime) ||
                (maxReturnTime != c.maxReturnTime) ||
                (wheelMode != c.wheelMode) ||
                (maxTurnAngle != c.maxTurnAngle) ||
                (turnModeDeadZone != c.turnModeDeadZone) ||
                (sendInputWhileReturning != c.sendInputWhileReturning) ||
                (this.emulateTouchPressure != c.emulateTouchPressure) ||
                (physicalMode != c.physicalMode) ||
                (physicalMoveRangeCm != c.physicalMoveRangeCm))
            {
                if ((wheelMode == TouchSteeringWheel.WheelMode.Turn) && (wheelMode != c.wheelMode) && (c.analogConfig.analogDeadZone != 0))
                {
                    c.analogConfig.analogDeadZone = 0;
                }


                CFGUI.CreateUndo("CF2 Steering Wheel modification", c);

                c.limitTurnSpeed          = limitTurnSpeed;
                c.minTurnTime             = minTurnTime;
                c.maxReturnTime           = maxReturnTime;
                c.emulateTouchPressure    = this.emulateTouchPressure;
                c.physicalMode            = physicalMode;
                c.physicalMoveRangeCm     = physicalMoveRangeCm;
                c.wheelMode               = wheelMode;
                c.maxTurnAngle            = maxTurnAngle;
                c.turnModeDeadZone        = turnModeDeadZone;
                c.sendInputWhileReturning = sendInputWhileReturning;


                CFGUI.EndUndo(c);
            }

            // Draw Shared Dynamic Control Params...

            this.DrawDynamicTouchControlGUI(c);
        }
Пример #5
0
        // ------------------
        public void Draw(TouchGestureStateBinding bind, TouchGestureConfig config, InputRig rig)
        {
            bool bindingEnabled = bind.enabled;


            //EditorGUILayout.BeginVertical();

            //if (bindingEnabled = EditorGUILayout.ToggleLeft(this.labelContent, bindingEnabled, GUILayout.MinWidth(30), GUILayout.ExpandWidth(true)))
            //	{
            //	CFGUI.BeginIndentedVertical();

            if (InspectorUtils.BeginIndentedSection(this.labelContent, ref bindingEnabled))
            {
                InspectorUtils.BeginIndentedSection(new GUIContent("Press bindings"));

                this.rawPressBinding.Draw(bind.rawPressBinding, rig);
                this.rawPressMousePosBindingInsp.Draw(bind.rawPressMousePosBinding, rig);
                EditorGUILayout.Space();

                this.normalPressBinding.Draw(bind.normalPressBinding, rig);
                this.normalPressMousePosBindingInsp.Draw(bind.normalPressMousePosBinding, rig);
                EditorGUILayout.Space();

                if ((config == null) || config.detectLongPress)
                {
                    this.longPressBinding.Draw(bind.longPressBinding, rig);
                    this.longPressMousePosBindingInsp.Draw(bind.longPressMousePosBinding, rig);
                }

                EditorGUILayout.Space();

                this.rawPressEmuTouchInsp.Draw(bind.rawPressEmuTouchBinding, rig);
                this.normalPressEmuTouchInsp.Draw(bind.normalPressEmuTouchBinding, rig);

                if ((config == null) || config.detectLongPress)
                {
                    this.longPressEmuTouchInsp.Draw(bind.longPressEmuTouchBinding, rig);
                }


                InspectorUtils.EndIndentedSection();

                if ((config == null) || (config.maxTapCount >= 1) || (config.detectLongTap))
                {
                    InspectorUtils.BeginIndentedSection(new GUIContent("Tap bindings"));

                    if ((config == null) || (config.maxTapCount >= 1))
                    {
                        this.tapBinding.Draw(bind.tapBinding, rig);
                        this.tapMousePosBindingInsp.Draw(bind.tapMousePosBinding, rig);
                        EditorGUILayout.Space();
                    }

                    if ((config == null) || (config.maxTapCount >= 2))
                    {
                        this.doubleTapBinding.Draw(bind.doubleTapBinding, rig);
                        this.doubleTapMousePosBindingInsp.Draw(bind.doubleTapMousePosBinding, rig);
                        EditorGUILayout.Space();
                    }


                    if ((config == null) || (config.detectLongPress && config.detectLongTap))
                    {
                        this.longTapBinding.Draw(bind.longTapBinding, rig);
                        this.longTapMousePosBindingInsp.Draw(bind.longTapMousePosBinding, rig);
                        EditorGUILayout.Space();
                    }

                    InspectorUtils.EndIndentedSection();
                }


                InspectorUtils.BeginIndentedSection(new GUIContent("Swipe bindings"));

                this.normalPressSwipeHorzAxisBinding.Draw(bind.normalPressSwipeHorzAxisBinding, rig);
                this.normalPressSwipeVertAxisBinding.Draw(bind.normalPressSwipeVertAxisBinding, rig);
                this.normalPressSwipeMousePosBindingInsp.Draw(bind.normalPressSwipeMousePosBinding, rig);
                this.normalPressSwipeDirBinding.Draw(bind.normalPressSwipeDirBinding, rig);
                this.normalPressSwipeJoyBinding.Draw(bind.normalPressSwipeJoyBinding, rig);

                if ((config == null) || config.detectLongPress)
                {
                    this.longPressSwipeHorzAxisBinding.Draw(bind.longPressSwipeHorzAxisBinding, rig);
                    this.longPressSwipeVertAxisBinding.Draw(bind.longPressSwipeVertAxisBinding, rig);
                    this.longPressSwipeMousePosBindingInsp.Draw(bind.longPressSwipeMousePosBinding, rig);
                    this.longPressSwipeDirBinding.Draw(bind.longPressSwipeDirBinding, rig);
                    this.longPressSwipeJoyBinding.Draw(bind.longPressSwipeJoyBinding, rig);
                }

                InspectorUtils.EndIndentedSection();

                InspectorUtils.BeginIndentedSection(new GUIContent("Scroll bindings"));
                this.normalPressScrollHorzBinding.Draw(bind.normalPressScrollHorzBinding, rig);
                this.normalPressScrollVertBinding.Draw(bind.normalPressScrollVertBinding, rig);

                if ((config == null) || config.detectLongPress)
                {
                    this.longPressScrollHorzBinding.Draw(bind.longPressScrollHorzBinding, rig);
                    this.longPressScrollVertBinding.Draw(bind.longPressScrollVertBinding, rig);
                }
                InspectorUtils.EndIndentedSection();



                if (this.customPostGUICallback != null)
                {
                    InspectorUtils.BeginIndentedSection(new GUIContent("Other"));

                    this.customPostGUICallback();

                    InspectorUtils.EndIndentedSection();
                }


                InspectorUtils.EndIndentedSection();
                //CFGUI.EndIndentedVertical();
                //GUILayout.Space(InputBindingGUIUtils.VERT_MARGIN);
            }

            //EditorGUILayout.EndVertical();



            if ((bindingEnabled != bind.enabled))
            {
                CFGUI.CreateUndo("Touch Binding modification.", this.undoObject);

                bind.enabled = bindingEnabled;

                CFGUI.EndUndo(this.undoObject);
            }
        }
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchSteeringWheelSpriteAnimator target = this.target as TouchSteeringWheelSpriteAnimator;

            if ((target == null))
            {
                return;
            }

            if (!TouchControlSpriteAnimatorInspector.DrawSourceGUI(target))
            {
                return;
            }

            TouchSteeringWheel wheel = target.sourceControl as TouchSteeringWheel;



            InspectorUtils.BeginIndentedSection(new GUIContent("Sprite Settings"));

            this.spriteNeutral.Draw(target.spriteNeutral, target, true, false);

            EditorGUILayout.Space();
            this.spritePressed.Draw(target.spritePressed, target, target.IsIllegallyAttachedToSource());


            InspectorUtils.EndIndentedSection();


            // Scaling GUI...

            float
                rotationRange         = target.rotationRange,
                rotationSmoothingTime = target.rotationSmoothingTime;


            InspectorUtils.BeginIndentedSection(new GUIContent("Transform Animation Settings"));


            if ((wheel != null) && (wheel.wheelMode == TouchSteeringWheel.WheelMode.Turn))
            {
                GUI.enabled = false;
                CFGUI.FloatField(new GUIContent("Rot. range", "Wheel's Rotation Range - in TURN wheel mode it's taken from Wheel."),
                                 wheel.maxTurnAngle, 0, 100000, 65);
                GUI.enabled = true;
            }
            else
            {
                rotationRange = CFGUI.Slider(new GUIContent("Rot. range", "Wheel's Rotation Range"), rotationRange, 0, 180, 65);
            }


            rotationSmoothingTime = CFGUI.FloatFieldEx(new GUIContent("Smooting Time (ms)", "Wheel Rotation Smooting Time in milliseconds"),
                                                       rotationSmoothingTime, 0, 10, 1000, true, 120);

            EditorGUILayout.Space();

//			TouchControlSpriteAnimatorInspector.DrawScaleGUI(target);

            InspectorUtils.EndIndentedSection();



            if ((rotationRange != target.rotationRange) ||
                (rotationSmoothingTime != target.rotationSmoothingTime))
            {
                CFGUI.CreateUndo("Sprite Animator Trsnaform modification", target);

                target.rotationRange         = rotationRange;
                target.rotationSmoothingTime = rotationSmoothingTime;

                CFGUI.EndUndo(target);
            }
        }