コード例 #1
0
        // ---------------
        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);
        }
        // ---------------
        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);
        }
コード例 #4
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();
            }
        }
コード例 #5
0
        // ---------------
        public override void OnInspectorGUI()
        {
            TouchJoystickSpriteAnimator target = this.target as TouchJoystickSpriteAnimator;

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



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


            TouchJoystickSpriteAnimator.SpriteMode
                spriteMode = target.spriteMode;
            TouchJoystickSpriteAnimator.RotationMode
                rotationMode = target.rotationMode;
            float
                simpleRotationRange      = target.simpleRotationRange,
                rotationSmoothingTime    = target.rotationSmoothingTime,
                translationSmoothingTime = target.translationSmoothingTime;
            Vector2
                moveScale = target.moveScale;
            bool
                animateTransl = target.animateTransl;


            if (target.sourceControl == null)
            {
            }
            else
            {
                InspectorUtils.BeginIndentedSection(new GUIContent("Sprite Settings"));

                spriteMode = (TouchJoystickSpriteAnimator.SpriteMode)EditorGUILayout.EnumPopup(new GUIContent("Sprite Mode", ""),
                                                                                               spriteMode, GUILayout.MinWidth(30), GUILayout.ExpandWidth(true));

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

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

                if (spriteMode >= TouchJoystickSpriteAnimator.SpriteMode.FourWay)
                {
                    EditorGUILayout.Space();                this.spriteUp.Draw(target.spriteUp, target, target.IsIllegallyAttachedToSource());

                    if (spriteMode >= TouchJoystickSpriteAnimator.SpriteMode.EightWay)
                    {
                        EditorGUILayout.Space();        this.spriteUpRight.Draw(target.spriteUpRight, target, target.IsIllegallyAttachedToSource());
                    }

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

                    if (spriteMode >= TouchJoystickSpriteAnimator.SpriteMode.EightWay)
                    {
                        EditorGUILayout.Space();        this.spriteDownRight.Draw(target.spriteDownRight, target, target.IsIllegallyAttachedToSource());
                    }

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

                    if (spriteMode >= TouchJoystickSpriteAnimator.SpriteMode.EightWay)
                    {
                        EditorGUILayout.Space();        this.spriteDownLeft.Draw(target.spriteDownLeft, target, target.IsIllegallyAttachedToSource());
                    }

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

                    if (spriteMode >= TouchJoystickSpriteAnimator.SpriteMode.EightWay)
                    {
                        EditorGUILayout.Space();        this.spriteUpLeft.Draw(target.spriteUpLeft, target, target.IsIllegallyAttachedToSource());
                    }
                }

                InspectorUtils.EndIndentedSection();
            }


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



            animateTransl = EditorGUILayout.ToggleLeft(new GUIContent("Animate Translation"),
                                                       animateTransl, GUILayout.MinWidth(30), GUILayout.ExpandWidth(true));

            if (animateTransl)
            {
                CFGUI.BeginIndentedVertical();

                moveScale.x = CFGUI.Slider(new GUIContent("X Move. Scale", "Horizontal Movement scale"), moveScale.x, 0, 2, 50);
                moveScale.y = CFGUI.Slider(new GUIContent("Y Move. Scale", "Vertical Movement scale"), moveScale.y, 0, 2, 50);

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

                CFGUI.EndIndentedVertical();
            }


            EditorGUILayout.Space();

            rotationMode = (TouchJoystickSpriteAnimator.RotationMode)CFGUI.EnumPopup(new GUIContent("Rotation Animation Mode", "How rotation should be animated..."),
                                                                                     rotationMode, 150);

            if (rotationMode != TouchJoystickSpriteAnimator.RotationMode.Disabled)
            {
                CFGUI.BeginIndentedVertical();

                if ((rotationMode == TouchJoystickSpriteAnimator.RotationMode.SimpleHorizontal) ||
                    (rotationMode == TouchJoystickSpriteAnimator.RotationMode.SimpleVertical))
                {
                    simpleRotationRange = CFGUI.Slider(new GUIContent("Rotation Range"),
                                                       simpleRotationRange, -360, 360, 120);
                }

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

                CFGUI.EndIndentedVertical();
            }

            EditorGUILayout.Space();

//			TouchControlSpriteAnimatorInspector.DrawScaleGUI(target);



            InspectorUtils.EndIndentedSection();



            // Register Undo...

            if ((spriteMode != target.spriteMode) ||
                (simpleRotationRange != target.simpleRotationRange) ||
                (rotationSmoothingTime != target.rotationSmoothingTime) ||
                (translationSmoothingTime != target.translationSmoothingTime) ||
                (rotationMode != target.rotationMode) ||
                (moveScale != target.moveScale) ||
                (animateTransl != target.animateTransl))
            {
                CFGUI.CreateUndo("Joystick Sprite Animator modification", target);



                target.spriteMode               = spriteMode;
                target.simpleRotationRange      = simpleRotationRange;
                target.rotationSmoothingTime    = rotationSmoothingTime;
                target.translationSmoothingTime = translationSmoothingTime;
                target.rotationMode             = rotationMode;
                target.moveScale     = moveScale;
                target.animateTransl = animateTransl;


                CFGUI.EndUndo(target);
            }
        }