// ------------------
        public void Draw(JoystickStateBinding bind, InputRig rig)
        {
            bool bindingEnabled = bind.enabled;

            EditorGUILayout.BeginVertical();

            if (bindingEnabled = EditorGUILayout.ToggleLeft(this.labelContent, bindingEnabled, GUILayout.MinWidth(30)))
            {
                InspectorUtils.BeginIndentedSection();

                this.horzAxisInspector.Draw(bind.horzAxisBinding, rig);
                this.vertAxisInspector.Draw(bind.vertAxisBinding, rig);


                this.dirInspector.Draw(bind.dirBinding, rig);

                InspectorUtils.EndIndentedSection();

                GUILayout.Space(InputBindingGUIUtils.VERT_MARGIN);
            }

            EditorGUILayout.EndVertical();


            if ((bindingEnabled != bind.enabled))
            {
                CFGUI.CreateUndo("Joy State 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;
            }



            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"));

            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);
            }
        }
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchTrackPadSpriteAnimator target = this.target as TouchTrackPadSpriteAnimator;

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

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

//		TouchControlSpriteAnimatorInspector.DrawTimingGUI(target);



            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();

//
//		TouchControlSpriteAnimatorInspector.DrawDefaultTransformGUI(target);
        }
Exemple #4
0
        // ---------------------
        override protected void DrawPresentationGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Presentation"));

            this.animatorStyle = (AnimatorStyle)CFGUI.EnumPopup(new GUIContent("Style", "Animator Style"), this.animatorStyle,
                                                                ControlCreationWizardBase.MAX_LABEL_WIDTH);

            if (this.animatorStyle == AnimatorStyle.BaseAndHat)
            {
                this.hatScale = CFGUI.Slider(new GUIContent("Hat Scale", "Hat's Scale relative to joystick's size"), this.hatScale, 0.1f, 1.0f,
                                             ControlCreationWizardBase.MAX_LABEL_WIDTH);
            }

            EditorGUILayout.Space();


            EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

            EditorGUILayout.Space();
            if (this.animatorStyle == AnimatorStyle.BaseAndHat)
            {
                this.baseSprite = DrawSpriteBox(new GUIContent("Base", "Base Sprite for new joystick."), this.baseSprite);
                this.hatSprite  = DrawSpriteBox(new GUIContent("Hat", "Hat sprite for new joystick."), this.hatSprite);
            }
            else
            {
                this.defaultSprite = DrawSpriteBox(new GUIContent("Sprite", "Sprite for new joystick."), this.defaultSprite);
            }

            EditorGUILayout.Space();

            EditorGUILayout.EndHorizontal();

            InspectorUtils.EndIndentedSection();
        }
Exemple #5
0
        // ---------------
        public void DrawGUI(TouchGestureThresholds target)
        {
            if (this.foldable)
            {
                if (!CFGUI.BoldFoldout(this.titleContent, ref this.foldedOut))
                {
                    return;
                }


                InspectorUtils.BeginIndentedSection();         //CFGUI.BeginIndentedVertical(CFEditorStyles.Inst.transpSunkenBG);
            }
            else
            {
                InspectorUtils.BeginIndentedSection(this.titleContent);
            }


            this.DrawBasicGUI(target);

            MultiTouchGestureThresholds multiTarget = (target as MultiTouchGestureThresholds);

            if (multiTarget != null)
            {
                EditorGUILayout.Space();
                this.DrawMultiTouchGUI(multiTarget);
            }

            //CFGUI.EndIndentedVertical();
            InspectorUtils.EndIndentedSection();
        }
        // ------------------
        public void Draw(MousePositionBinding bind, InputRig rig)
        {
            bool bindingEnabled = bind.enabled;
            int  priority       = bind.priority;

            EditorGUILayout.BeginVertical();
            if (bindingEnabled = EditorGUILayout.ToggleLeft(this.labelContent, bindingEnabled, GUILayout.MinWidth(30)))
            {
                InspectorUtils.BeginIndentedSection();

                priority = EditorGUILayout.IntSlider(new GUIContent("Pos. prio.", "Position priority used to pick mouse position if there is more than one mouse position source in the rig at given frame."),
                                                     priority, 0, 100, GUILayout.MinWidth(30));

                InspectorUtils.EndIndentedSection();
            }
            EditorGUILayout.EndVertical();


            if ((bindingEnabled != bind.enabled) ||
                (priority != bind.priority))
            {
                CFGUI.CreateUndo("Mouse Position Binding modification.", this.undoObject);

                bind.enabled  = bindingEnabled;
                bind.priority = priority;

                CFGUI.EndUndo(this.undoObject);
            }
        }
Exemple #7
0
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchJoystick c = (TouchJoystick)this.target;

            this.DrawWarnings(c);

            // Joystick GUI...


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

            // Steering Wheel specific inspector....

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

            this.joyConfigInsp.DrawGUI(c.config);

            InspectorUtils.EndIndentedSection();


            InspectorUtils.BeginIndentedSection(new GUIContent("Joystick Bindings"));


            this.pressBindingInsp.Draw(c.pressBinding, c.rig);

            this.joyStateBindingInsp.Draw(c.joyStateBinding, c.rig);

            InspectorUtils.EndIndentedSection();



            // Draw Shared Dynamic Control Params...

            this.DrawDynamicTouchControlGUI(c);
        }
        // -----------------
        virtual protected void DrawNameGUI()
        {
            InspectorUtils.BeginIndentedSection();     //this.GetTitle());

            this.controlName = CFGUI.TextField(new GUIContent("Name"), this.controlName, MAX_LABEL_WIDTH);

            InspectorUtils.EndIndentedSection();
        }
        // ---------------------
        override protected void DrawBindingGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Binding"));

            this.pressBindingInsp.Draw(this.pressBinding, this.panel.rig);
            this.toggleBindingInsp.Draw(this.toggleBinding, this.panel.rig);

            InspectorUtils.EndIndentedSection();
        }
            // ---------------------
            public void Draw()
            {
                InspectorUtils.BeginIndentedSection(new GUIContent(this.prefix + " Binding Setup"));

                this.gestureBindingInsp.Draw(this.gestureBinding, null, this.wizard.panel.rig);


                InspectorUtils.EndIndentedSection();
            }
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchTrackPad c = (TouchTrackPad)this.target;

            float
                touchSmoothing = c.touchSmoothing;

            this.emulateTouchPressure = c.emulateTouchPressure;

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


            this.DrawWarnings(c);



            //Trackpad inspector....

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

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

            InspectorUtils.EndIndentedSection();


            InspectorUtils.BeginIndentedSection(new GUIContent("TrackPad Bindings"));


            this.pressBindingInsp.Draw(c.pressBinding, c.rig);
            this.touchPressureBindingInsp.Draw(c.touchPressureBinding, c.rig);
            this.horzSwipeBindingInsp.Draw(c.horzSwipeBinding, c.rig);
            this.vertSwipeBindingInsp.Draw(c.vertSwipeBinding, c.rig);

            InspectorUtils.EndIndentedSection();


            // Register Undo...

            if ((touchSmoothing != c.touchSmoothing) ||
                (this.emulateTouchPressure != c.emulateTouchPressure))
            {
                CFGUI.CreateUndo("Dynamic Touch Control modification.", c);

                c.SetTouchSmoothing(touchSmoothing);

                c.emulateTouchPressure = this.emulateTouchPressure;

                CFGUI.EndUndo(c);
            }


            // Draw Shared Control Params...

            this.DrawTouchContolGUI(c);
        }
Exemple #12
0
        // ---------------------
        override protected void DrawBindingGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Binding Settings"));

            this.pressBindingInsp.Draw(this.pressBinding, this.panel.rig);

            this.horzDeltaBindingInsp.Draw(this.horzDeltaBinding, this.panel.rig);
            this.vertDeltaBindingInsp.Draw(this.vertDeltaBinding, this.panel.rig);

            InspectorUtils.EndIndentedSection();
        }
        // ---------------------
        override protected void DrawBindingGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Binding Settings"));

            for (int i = 0; i < this.fingerBinding.Length; ++i)
            {
                this.fingerBinding[i].Draw();
            }


            InspectorUtils.EndIndentedSection();
        }
        // ----------------
        virtual protected void DrawPresentationGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Presentation"));

            EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            EditorGUILayout.Space();
            this.defaultSprite = DrawSpriteBox(new GUIContent("Sprite", "Simple single sprite for new control."), this.defaultSprite);
            EditorGUILayout.Space();
            EditorGUILayout.EndHorizontal();

            InspectorUtils.EndIndentedSection();
        }
        // ---------------------
        override protected void DrawBindingGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Binding"));

            this.pressBindingInsp.Draw(this.pressBinding, this.panel.rig);

            //this.joyNameBindingInsp.Draw(this.joyNameBinding, this.panel.rig);

            this.horzAxisBindingInsp.Draw(this.horzAxisBinding, this.panel.rig);
            this.vertAxisBindingInsp.Draw(this.vertAxisBinding, this.panel.rig);

            InspectorUtils.EndIndentedSection();
        }
Exemple #16
0
        // ---------------
        public override void OnInspectorGUI()
        {
            GamepadManager m = (GamepadManager)this.target;


            // Gamepad Manager GUI...

            float
                connectionCheckInterval = m.connectionCheckInterval;
            bool
                dontDestroyOnLoad = m.dontDestroyOnLoad;


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


            EditorGUILayout.Space();

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

            connectionCheckInterval = CFGUI.FloatFieldEx(new GUIContent("Connection Check Interval (ms)", "Gamepad connection Check Interval in milliseconds.\nEach call of Input.GetJoystickNames() allocates at least 40 bytes - that's not much, but..."),
                                                         connectionCheckInterval, 0, 10, 1000, true, 190);

            dontDestroyOnLoad = EditorGUILayout.ToggleLeft(new GUIContent("Don't destroy on load.", "This game object will not be destroyed when new scene/level is loaded."),
                                                           dontDestroyOnLoad);

            InspectorUtils.EndIndentedSection();


            EditorGUILayout.Space();


            // Register undo...

            if (    //(gamepadOrderMode			!= m.gamepadOrderMode)
                (connectionCheckInterval != m.connectionCheckInterval) ||
                (dontDestroyOnLoad != m.dontDestroyOnLoad)

                )
            {
                CFGUI.CreateUndo("CF2 Gamepad Manager modification", m);

                //m.gamepadOrderMode		 = gamepadOrderMode;

                m.connectionCheckInterval = connectionCheckInterval;
                m.dontDestroyOnLoad       = dontDestroyOnLoad;

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

            this.emulateTouchPressure = c.emulateTouchPressure;

            this.DrawWarnings(c);

            // Joystick GUI...


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

            // Steering Wheel specific inspector....

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

            this.joyConfigInsp.DrawGUI(c.config);

            InspectorUtils.EndIndentedSection();


            InspectorUtils.BeginIndentedSection(new GUIContent("Joystick Bindings"));


            this.pressBindingInsp.Draw(c.pressBinding, c.rig);
            this.touchPressureBindingInsp.Draw(c.touchPressureBinding, c.rig);

            this.joyStateBindingInsp.Draw(c.joyStateBinding, c.rig);

            InspectorUtils.EndIndentedSection();


            // Register Undo...

            if ((this.emulateTouchPressure != c.emulateTouchPressure))
            {
                CFGUI.CreateUndo("Dynamic Touch Control modification.", c);

                c.emulateTouchPressure = this.emulateTouchPressure;

                CFGUI.EndUndo(c);
            }


            // Draw Shared Dynamic Control Params...

            this.DrawDynamicTouchControlGUI(c);
        }
        // ---------------------
        override protected void DrawBindingGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Binding Settings"));

            this.pressBindingInsp.Draw(this.pressBinding, this.panel.rig);
            this.touchPressureBindingInsp.Draw(this.touchPressureBinding, this.panel.rig);

            this.turnBindingInsp.Draw(this.turnBinding, this.panel.rig);

            this.turnLeftBindingInsp.Draw(this.turnLeftBinding, this.panel.rig);
            this.turnRightBindingInsp.Draw(this.turnRightBinding, this.panel.rig);


            InspectorUtils.EndIndentedSection();
        }
Exemple #19
0
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchControlPanel panel = (TouchControlPanel)this.target;


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

            if (panel.rig == null)
            {
                InspectorUtils.DrawErrorBox("This panel is not connected to a Input Rig!");
            }



            if (GUILayout.Button("Add Button"))
            {
                TouchButtonCreationWizard.ShowWizard(panel);
            }

            if (GUILayout.Button("Add Joystick"))
            {
                TouchJoystickCreationWizard.ShowWizard(panel);
            }

            if (GUILayout.Button("Add Steering Wheel"))
            {
                TouchWheelCreationWizard.ShowWizard(panel);
            }

            if (GUILayout.Button("Add Trackpad"))
            {
                TouchTrackPadCreationWizard.ShowWizard(panel);
            }

            if (GUILayout.Button("Add Touch Zone"))
            {
                SuperTouchZoneCreationWizard.ShowWizard(panel);
            }

            if (GUILayout.Button("Add Touch Splitter"))
            {
                TouchSplitterCreationWizard.ShowWizard(panel);
            }


            // Settings GUI...
        }
        // ---------------
        public override void OnInspectorGUI()
        {
            SuperTouchZoneSpriteAnimator target = this.target as SuperTouchZoneSpriteAnimator;

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

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

            //TouchControlSpriteAnimatorInspector.DrawTimingGUI(target);



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

            if (this.spriteConfigInspArray != null)
            {
                for (SuperTouchZoneSpriteAnimator.ControlState i = SuperTouchZoneSpriteAnimator.ControlStateFirst;
                     i < SuperTouchZoneSpriteAnimator.ControlStateCount; ++i)
                {
                    if (this.spriteConfigInspArray[(int)i] == null)
                    {
                        EditorGUILayout.LabelField("ERROR");
                    }
                    else
                    {
                        this.spriteConfigInspArray[(int)i].Draw(target.GetStateSpriteConfig(i), target, ((int)i == 0), ((int)i != 0));
                    }
                }
            }
//
//			this.spriteNeutral.Draw(target.spriteNeutral, target, true);
//
//			EditorGUILayout.Space();
//			this.spritePressed.Draw(target.spritePressed, target, target.IsIllegallyAttachedToSource());


            InspectorUtils.EndIndentedSection();


            //TouchControlSpriteAnimatorInspector.DrawDefaultTransformGUI(target);
        }
Exemple #21
0
        // -----------------------
        public void DrawGUI()
        {
            bool
                disableWhenTouchScreenInactive = this.target.disableWhenTouchScreenInactive,
                disableWhenCursorIsUnlocked    = this.target.disableWhenCursorIsUnlocked;

            DisablingConditionSet.MobileModeRelation
                mobileModeRelation = this.target.mobileModeRelation;


            InspectorUtils.BeginIndentedSection(this.titleContent);

            mobileModeRelation = (DisablingConditionSet.MobileModeRelation)CFGUI.EnumPopup(new GUIContent("Mobile Mode Relation"),
                                                                                           mobileModeRelation, 130);

            disableWhenCursorIsUnlocked = EditorGUILayout.ToggleLeft(new GUIContent("Disable when Cursor is unlocked", "Disable this element when mouse cursor is unlocked. \nUse this option if your game is using cursor lock state to display menus and things like that..."),
                                                                     disableWhenCursorIsUnlocked);
            disableWhenTouchScreenInactive = EditorGUILayout.ToggleLeft(new GUIContent("Disable when Touch Screen is inactive", "Disable this element when touch screen hasn't been used for some time (Check out Input Rig's General Settings)."),
                                                                        disableWhenTouchScreenInactive);

            EditorGUILayout.Space();

            if (this.switchListInsp != null)
            {
                this.switchListInsp.DrawGUI();
            }


            InspectorUtils.EndIndentedSection();



            // Refister undo...

            if ((mobileModeRelation != this.target.mobileModeRelation) ||
                (disableWhenCursorIsUnlocked != this.target.disableWhenCursorIsUnlocked) ||
                (disableWhenTouchScreenInactive != this.target.disableWhenTouchScreenInactive))
            {
                CFGUI.CreateUndo("Disabling Conditions modification", this.undoObject);

                this.target.mobileModeRelation             = mobileModeRelation;
                this.target.disableWhenCursorIsUnlocked    = disableWhenCursorIsUnlocked;
                this.target.disableWhenTouchScreenInactive = disableWhenTouchScreenInactive;

                CFGUI.EndUndo(this.undoObject);
            }
        }
Exemple #22
0
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchButtonSpriteAnimator target = this.target as TouchButtonSpriteAnimator;

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



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



            if (target.sourceControl == null)
            {
            }               //InspectorUtils.DrawErrorBox("Source Button is not connected!");
            else
            {
                InspectorUtils.BeginIndentedSection(new GUIContent("Sprite Settings"));



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

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

                    if (((TouchButton)target.sourceControl).toggle)
                    {
                        EditorGUILayout.Space();
                        this.spriteToggled.Draw(target.spriteToggled, target, target.IsIllegallyAttachedToSource());

                        EditorGUILayout.Space();
                        this.spriteToggledAndPressed.Draw(target.spriteToggledAndPressed, target, target.IsIllegallyAttachedToSource());
                    }
                }

                InspectorUtils.EndIndentedSection();
            }
        }
        // ----------------
        override protected void DrawPresentationGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Presentation"));

            this.createSpriteAnimator = EditorGUILayout.ToggleLeft(new GUIContent("Create Sprite Animator"), this.createSpriteAnimator);

            if (this.createSpriteAnimator)
            {
                EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                EditorGUILayout.Space();
                this.defaultSprite = DrawSpriteBox(new GUIContent("Sprite", "Simple single sprite for new control."), this.defaultSprite);
                EditorGUILayout.Space();
                EditorGUILayout.EndHorizontal();
            }

            InspectorUtils.EndIndentedSection();
        }
 // -------------------
 public void DrawWarnings(TouchControl c)
 {
     if (!c.gameObject.activeInHierarchy)
     {
         EditorGUILayout.HelpBox("This control is inactive!", MessageType.Info);
     }
     else
     {
         if (c.rig == null)
         {
             InspectorUtils.DrawErrorBox("This control is not connected to a CF2 Input Rig!!");
         }
         if (c.panel == null)
         {
             InspectorUtils.DrawErrorBox("This control is not connected to a CF2 Touch Control Panel!");
         }
     }
 }
Exemple #25
0
        // -------------------
        public void DrawGUI(AnalogConfig target)
        {
            EditorGUILayout.BeginVertical();

            if (!string.IsNullOrEmpty(this.titleContent.text))
            {
//EditorGUILayout.LabelField("Fodable: " + this.isFoldable  + " Folded:" + this.isFoldedOut);

                if (this.isFoldable)
                {
                    InspectorUtils.DrawSectionHeader(this.titleContent, ref this.isFoldedOut);
                }
                else
                {
                    EditorGUILayout.LabelField(this.titleContent, CFEditorStyles.Inst.boldText, GUILayout.ExpandWidth(true), GUILayout.MinWidth(30));
                    this.isFoldedOut = true;
                }
            }
            else
            {
                this.isFoldedOut = true;
            }


            if (this.isFoldedOut)
            {
                CFGUI.BeginIndentedVertical(CFEditorStyles.Inst.transpSunkenBG);

                JoystickConfig joyConfig = target as JoystickConfig;
                if (joyConfig != null)
                {
                    this.DrawJoystickConfigGUI(joyConfig);
                }

                this.DrawAnalogConfigGUI(target);

                CFGUI.EndIndentedVertical();
            }

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
        }
        // -------------------
        virtual protected void DrawPositionAndModeGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Positioning"));

            this.dynamicMode = (ControlMode)CFGUI.EnumPopup(new GUIContent("Mode", "Positioning Mode - Static or Dynamic?"),
                                                            this.dynamicMode, MAX_LABEL_WIDTH);

            //EditorGUILayout.Toggle(new GUIContent("Dynamic Mode", "Create this control with it's own DynamicRegion."),
            //this.dynamicWithRegion, GUILayout.ExpandWidth(true));

            if (this.dynamicMode == ControlMode.DynamicWithRegion)
            {
                this.regionRect = (RegionRectPreset)CFGUI.EnumPopup(new GUIContent("Region", "Select Dynamic Region's screen position."),
                                                                    this.regionRect, MAX_LABEL_WIDTH);
            }
            else
            {
                this.staticAnchor = (ControlAnchorPoint)CFGUI.EnumPopup(new GUIContent("Anchor", "New control will be automatically placed near selected anchor point."),
                                                                        this.staticAnchor, MAX_LABEL_WIDTH);
            }

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

            this.controlSize = CFGUI.Slider(new GUIContent("Size", "Control's size relative to the shorter dimension of parent canvas."),
                                            this.controlSize, 0.05f, 0.5f, MAX_LABEL_WIDTH);


            this.controlDepth = (float)DrawDepthSlider(new GUIContent("Control Depth", "Depth of the control - how far to push the control into the screen.\n\nControls of depth closer to screen (smaller values) are picked first!"),
                                                       this.controlDepth, MAX_LABEL_WIDTH);

            if (this.dynamicMode == ControlMode.DynamicWithRegion)
            {
                this.regionDepth = (float)DrawDepthSlider(new GUIContent("Region Depth", "Depth of control's dynamic region. It's recommended to use higher depth for region than for the control itself.\n\nControls of depth closer to screen (smaller values) are picked first!"),
                                                          this.regionDepth, MAX_LABEL_WIDTH);
            }


            InspectorUtils.EndIndentedSection();
        }
        // ---------------------
        override protected void DrawPositionAndModeGUI()
        {
            InspectorUtils.BeginIndentedSection(new GUIContent("Positioning"));

            this.positionMode = (PositionMode)CFGUI.EnumPopup(new GUIContent("Mode", "Positioning Mode - Const Size or Stretchy Screen Region?"),
                                                              this.positionMode, MAX_LABEL_WIDTH);

            if (this.positionMode == PositionMode.Stretch)
            {
                this.regionRect = (RegionRectPreset)CFGUI.EnumPopup(new GUIContent("Region", "Select Dynamic Region's screen position."),
                                                                    this.regionRect, MAX_LABEL_WIDTH);
            }
            else
            {
                this.staticAnchor = (ControlAnchorPoint)CFGUI.EnumPopup(new GUIContent("Anchor", "New control will be automatically placed near selected anchor point."),
                                                                        this.staticAnchor, MAX_LABEL_WIDTH);

                this.controlSize = CFGUI.Slider(new GUIContent("Size", "Control's size relative to the shorter dimension of parent canvas."),
                                                this.controlSize, 0.05f, 0.5f, MAX_LABEL_WIDTH);
            }

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


            if (this.positionMode == PositionMode.Stretch)
            {
                this.regionDepth = (float)DrawDepthSlider(new GUIContent("Control Depth", "Depth of the control - how far to push the control into the screen.\n\nControls of depth closer to screen (smaller values) are picked first!"),
                                                          this.regionDepth, MAX_LABEL_WIDTH);
            }
            else
            {
                this.controlDepth = (float)DrawDepthSlider(new GUIContent("Control Depth", "Depth of the control - how far to push the control into the screen.\n\nControls of depth closer to screen (smaller values) are picked first!"),
                                                           this.controlDepth, MAX_LABEL_WIDTH);
            }



            InspectorUtils.EndIndentedSection();
        }
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchSplitter c = (TouchSplitter)this.target;

            this.DrawWarnings(c);



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

            // Steering Wheel specific inspector....

            InspectorUtils.BeginIndentedSection(new GUIContent("Target Controls"));

            this.targetControlListInsp.DrawGUI();

            InspectorUtils.EndIndentedSection();



            // Draw Shared Touch Control Params...

            this.DrawTouchContolGUI(c);
        }
Exemple #29
0
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchButton c = (TouchButton)this.target;

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

            this.DrawWarnings(c);


            bool
                toggle = c.toggle,
                linkToggleToRigSwitch = c.linkToggleToRigSwitch,
                autoToggleOff         = c.autoToggleOff,
                toggleOffWhenHiding   = c.toggleOffWhenHiding;
            float
                autoToggleOffTimeOut = c.autoToggleOffTimeOut;

            TouchButton.ToggleOnAction
                toggleOnAction = c.toggleOnAction;
            TouchButton.ToggleOffAction
                toggleOffAction = c.toggleOffAction;
            string
                toggleRigSwitchName = c.toggleRigSwitchName;

            this.emulateTouchPressure = c.emulateTouchPressure;

            // Button specific inspector....



            const float LABEL_WIDTH = 110;


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

            toggle = EditorGUILayout.ToggleLeft(new GUIContent("Toggle Mode", "Enable toggle mode."),
                                                toggle);

            if (toggle)
            {
                CFGUI.BeginIndentedVertical();

                toggleOnAction = (TouchButton.ToggleOnAction)CFGUI.EnumPopup(new GUIContent("Toggle On Action", "Select when toggle state should change from OFF to ON."),
                                                                             toggleOnAction, LABEL_WIDTH);
                toggleOffAction = (TouchButton.ToggleOffAction)CFGUI.EnumPopup(new GUIContent("Toggle Off Action", "Select when toggle state should change from ON to OFF."),
                                                                               toggleOffAction, LABEL_WIDTH);

                if (toggleOffAction != TouchButton.ToggleOffAction.OnTimeout)
                {
                    autoToggleOff = EditorGUILayout.ToggleLeft(new GUIContent("Auto Toggle Off", "When enabled, this button will auto-toggle off itself after specified amount of time."),
                                                               autoToggleOff);
                }

                if (autoToggleOff || toggleOffAction == TouchButton.ToggleOffAction.OnTimeout)
                {
                    CFGUI.BeginIndentedVertical();

                    autoToggleOffTimeOut = CFGUI.FloatFieldEx(new GUIContent("Timeout (ms)", "Auto-toggle off time-out in milliseconds."),
                                                              autoToggleOffTimeOut, 0.1f, 1000, 1000, true, LABEL_WIDTH);

                    CFGUI.EndIndentedVertical();
                }

                linkToggleToRigSwitch = EditorGUILayout.ToggleLeft(new GUIContent("Link toggle to Rig Switch", "Links this toggle button to Rig Switch's state.\nExternal modification to assigned flag will also affect this button's toggle state!"),
                                                                   linkToggleToRigSwitch);

                if (linkToggleToRigSwitch)
                {
                    CFGUI.BeginIndentedVertical();

                    toggleRigSwitchName = this.toggleRigSwitchInsp.Draw("Switch", toggleRigSwitchName, c.rig, 50);

                    toggleOffWhenHiding = EditorGUILayout.ToggleLeft(new GUIContent("Turn the Switch Off when hiding", "When enabled, this button will turn off linked Rig Switch when hidden."),
                                                                     toggleOffWhenHiding);

                    CFGUI.EndIndentedVertical();
                }



                CFGUI.EndIndentedVertical();
            }

            InspectorUtils.EndIndentedSection();



            InspectorUtils.BeginIndentedSection(new GUIContent("Button Bindings"));


            this.pressBindingInsp.Draw(c.pressBinding, c.rig);
            this.touchPressureBindingInsp.Draw(c.touchPressureBinding, c.rig);

            if (toggle)
            {
                this.toggleBindingInsp.Draw(c.toggleOnlyBinding, c.rig);
            }

            InspectorUtils.EndIndentedSection();


            // Register undo...

            if ((toggle != c.toggle) ||
                (linkToggleToRigSwitch != c.linkToggleToRigSwitch) ||
                (toggleOnAction != c.toggleOnAction) ||
                (toggleOffAction != c.toggleOffAction) ||
                (autoToggleOff != c.autoToggleOff) ||
                (autoToggleOffTimeOut != c.autoToggleOffTimeOut) ||
                (this.emulateTouchPressure != c.emulateTouchPressure) ||
                (toggleOffWhenHiding != c.toggleOffWhenHiding) ||
                (toggleRigSwitchName != c.toggleRigSwitchName))
            {
                CFGUI.CreateUndo("CF2 Button modification", c);

                c.toggle = toggle;
                c.linkToggleToRigSwitch = linkToggleToRigSwitch;
                c.toggleOnAction        = toggleOnAction;
                c.toggleOffAction       = toggleOffAction;
                c.toggleRigSwitchName   = toggleRigSwitchName;
                c.autoToggleOff         = autoToggleOff;
                c.autoToggleOffTimeOut  = autoToggleOffTimeOut;
                c.toggleOffWhenHiding   = toggleOffWhenHiding;
                c.emulateTouchPressure  = this.emulateTouchPressure;


                CFGUI.EndUndo(c);
            }


            // Draw Shared Dynamic Control Params...

            this.DrawDynamicTouchControlGUI(c);
        }
        // -------------------
        static public bool DrawSourceGUI(TouchControlSpriteAnimatorBase target)
        {
            bool
                autoConnect = target.autoConnectToSource;
            TouchControl
                sourceControl = target.sourceControl;


            bool initiallyEnabled = GUI.enabled;

            InspectorUtils.BeginIndentedSection(new GUIContent("Source Control Connection"));

            GUI.enabled = (sourceControl != null);
            if (GUILayout.Button(new GUIContent("Select Source Control"), GUILayout.ExpandWidth(true), GUILayout.Height(20)))
            {
                Selection.activeObject = sourceControl;
                return(false);
            }

            GUI.enabled = initiallyEnabled;

            autoConnect = EditorGUILayout.ToggleLeft(new GUIContent("Auto Connect To Control", "When enabled, this animator will automatically pick source control whenever this gameobject's hierarchy changes."),
                                                     autoConnect, GUILayout.MinWidth(30), GUILayout.ExpandWidth(true));

            if (autoConnect)
            {
                GUI.enabled = false;
            }

            sourceControl = (TouchControl)EditorGUILayout.ObjectField(new GUIContent("Source Control"), sourceControl, target.GetSourceControlType(), true,
                                                                      GUILayout.MaxWidth(30), GUILayout.ExpandWidth(true));

            GUI.enabled = initiallyEnabled;

            if (sourceControl == null)
            {
                InspectorUtils.DrawErrorBox("Source Control is not connected!");
            }
            else if (target.IsIllegallyAttachedToSource())
            {
                InspectorUtils.DrawErrorBox("This Animator is attached to the source control's game object!!\nTransformation Animation will not be possible!!");
            }

            InspectorUtils.EndIndentedSection();


            // Register Undo...

            if ((autoConnect != target.autoConnectToSource) ||
                (sourceControl != target.sourceControl))
            {
                CFGUI.CreateUndo("Sprite Animator Source modification", target);

                target.autoConnectToSource = autoConnect;
                target.SetSourceControl(sourceControl);

                if (target.autoConnectToSource)
                {
                    target.AutoConnectToSource();
                }

                CFGUI.EndUndo(target);
            }

            return(true);
        }