Ejemplo n.º 1
0
        private static void JCSUnityEditor()
        {
            JCSUnity_EditorWindow window = (JCSUnity_EditorWindow)GetWindow(typeof(JCSUnity_EditorWindow));

            window.titleContent = new GUIContent(JCSUnity_About.EDITOR_INI["editor_title"]);
            window.Show();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check if any specific button's buffer need to be invert.
        /// </summary>
        /// <param name="label"></param>
        /// <returns></returns>
        public static bool IsInvert(JCS_JoystickButton label)
        {
            JCSUnity_EditorWindow jcsunity_ew = JCSUnity_EditorWindow.instance;

            switch (jcsunity_ew.SelectGamepadType)
            {
            case 0:      /* ==> Select Platform <== */
                return(false);

            /* Sony Play Station */
            case 1:      /* ==> PS <== */
            case 2:      /* ==> PS2 <== */
            case 3:      /* ==> PS3 <== */
            case 4:      /* ==> PS4 <== */
            {
                switch (label)
                {
                case JCS_JoystickButton.BUTTON_LEFT:
                case JCS_JoystickButton.BUTTON_DOWN:
                    return(true);
                }
            }
            break;

            /* Microsoft XBox */
            case 5:      /* ==> XBox <== */
            case 6:      /* ==> XBox 360 <== */
            case 7:      /* ==> XBox One <== */
            {
                switch (label)
                {
                case JCS_JoystickButton.BUTTON_LEFT:
                case JCS_JoystickButton.BUTTON_DOWN:
                case JCS_JoystickButton.LEFT_TRIGGER:
                    return(true);
                }
            }
            break;
            }

            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Design the input we want to add here.
        /// </summary>
        public static void SetupInputManager()
        {
            // Add gamepad definitions
            JCSUnity_EditorWindow jcsunity_ew = JCSUnity_EditorWindow.instance;

            switch (jcsunity_ew.SelectGamepadType)
            {
            case 0:      /* ==> Select Platform <== */

                break;

            /* Sony Play Station */
            case 1:      /* ==> PS <== */

                break;

            case 2:      /* ==> PS2 <== */

                break;

            case 3:      /* ==> PS3 <== */

                break;

            case 4:      /* ==> PS4 <== */
                SetupPS4Joystick();
                break;

            /* Microsoft XBox */
            case 5:      /* ==> XBox <== */

                break;

            case 6:      /* ==> XBox 360 <== */
                SetupXBox360Joystick();
                break;

            case 7:      /* ==> XBox One <== */

                break;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get the axis type depends on the joystick button label.
        /// </summary>
        /// <param name="label"></param>
        /// <returns></returns>
        public static JCS_AxisType GetAxisType(JCS_JoystickButton label)
        {
            JCSUnity_EditorWindow jcsunity_ew = JCSUnity_EditorWindow.instance;

            switch (jcsunity_ew.SelectGamepadType)
            {
            case 0:      /* ==> Select Platform <== */
                break;

            /* Sony Play Station */
            case 1:      /* ==> PS <== */
            case 2:      /* ==> PS2 <== */
            case 3:      /* ==> PS3 <== */
            case 4:      /* ==> PS4 <== */
            {
                switch (label)
                {
                case JCS_JoystickButton.BUTTON_A:
                case JCS_JoystickButton.BUTTON_B:
                case JCS_JoystickButton.BUTTON_X:
                case JCS_JoystickButton.BUTTON_Y:

                case JCS_JoystickButton.HOME_BUTTON:

                case JCS_JoystickButton.START_BUTTON:
                case JCS_JoystickButton.BACK_BUTTON:

                case JCS_JoystickButton.LEFT_BUMPER:
                case JCS_JoystickButton.RIGHT_BUMPER:
                {
                    return(JCS_AxisType.KeyOrMouseButton);
                }

                case JCS_JoystickButton.BUTTON_UP:
                case JCS_JoystickButton.BUTTON_DOWN:
                case JCS_JoystickButton.BUTTON_LEFT:
                case JCS_JoystickButton.BUTTON_RIGHT:
                {
                    return(JCS_AxisType.JoystickAxis);
                }

                case JCS_JoystickButton.STICK_LEFT_X:
                case JCS_JoystickButton.STICK_LEFT_Y:

                case JCS_JoystickButton.STICK_RIGHT_X:
                case JCS_JoystickButton.STICK_RIGHT_Y:
                {
                    return(JCS_AxisType.JoystickAxis);
                }

                case JCS_JoystickButton.LEFT_TRIGGER:
                case JCS_JoystickButton.RIGHT_TRIGGER:
                {
                    return(JCS_AxisType.KeyOrMouseButton);
                }
                }
            }
            break;

            /* Microsoft XBox */
            case 5:      /* ==> XBox <== */
            case 6:      /* ==> XBox 360 <== */
            case 7:      /* ==> XBox One <== */
            {
                switch (label)
                {
                case JCS_JoystickButton.BUTTON_A:
                case JCS_JoystickButton.BUTTON_B:
                case JCS_JoystickButton.BUTTON_X:
                case JCS_JoystickButton.BUTTON_Y:

                case JCS_JoystickButton.HOME_BUTTON:

                case JCS_JoystickButton.START_BUTTON:
                case JCS_JoystickButton.BACK_BUTTON:

                case JCS_JoystickButton.LEFT_BUMPER:
                case JCS_JoystickButton.RIGHT_BUMPER:
                {
                    return(JCS_AxisType.KeyOrMouseButton);
                }

                case JCS_JoystickButton.BUTTON_UP:
                case JCS_JoystickButton.BUTTON_DOWN:
                case JCS_JoystickButton.BUTTON_LEFT:
                case JCS_JoystickButton.BUTTON_RIGHT:

                case JCS_JoystickButton.STICK_LEFT_X:
                case JCS_JoystickButton.STICK_LEFT_Y:

                case JCS_JoystickButton.STICK_RIGHT_X:
                case JCS_JoystickButton.STICK_RIGHT_Y:

                case JCS_JoystickButton.LEFT_TRIGGER:
                case JCS_JoystickButton.RIGHT_TRIGGER:
                {
                    return(JCS_AxisType.JoystickAxis);
                }
                }
            }
            break;
            }



            /* Returns default. */
            return(JCS_AxisType.KeyOrMouseButton);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Get axis channel for Unity's built-in InputManager.
        /// </summary>
        /// <param name="label"></param>
        /// <returns></returns>
        public static JCS_AxisChannel GetAxisChannel(JCS_JoystickButton label)
        {
            JCSUnity_EditorWindow jcsunity_ew = JCSUnity_EditorWindow.instance;

            switch (jcsunity_ew.SelectGamepadType)
            {
            case 0:      /* ==> Select Platform <== */
                break;

            /* Sony Play Station */
            case 1:      /* ==> PS <== */
            case 2:      /* ==> PS2 <== */
            case 3:      /* ==> PS3 <== */
            case 4:      /* ==> PS4 <== */
            {
                switch (label)
                {
                case JCS_JoystickButton.BUTTON_UP:
                case JCS_JoystickButton.BUTTON_DOWN:
                    return(JCS_AxisChannel.CHANNEL_08);

                case JCS_JoystickButton.BUTTON_RIGHT:
                case JCS_JoystickButton.BUTTON_LEFT:
                    return(JCS_AxisChannel.CHANNEL_07);

                case JCS_JoystickButton.STICK_LEFT_X:
                    return(JCS_AxisChannel.X_Axis);

                case JCS_JoystickButton.STICK_LEFT_Y:
                    return(JCS_AxisChannel.Y_Axis);

                case JCS_JoystickButton.STICK_RIGHT_X:
                    return(JCS_AxisChannel.CHANNEL_03);

                case JCS_JoystickButton.STICK_RIGHT_Y:
                    return(JCS_AxisChannel.CHANNEL_06);

                case JCS_JoystickButton.LEFT_TRIGGER:              // this need to be invert.
                case JCS_JoystickButton.RIGHT_TRIGGER:
                    return(JCS_AxisChannel.CHANNEL_03);
                }
            }
            break;

            /* Microsoft XBox */
            case 5:      /* ==> XBox <== */
            case 6:      /* ==> XBox 360 <== */
            case 7:      /* ==> XBox One <== */
            {
                switch (label)
                {
                case JCS_JoystickButton.BUTTON_UP:
                case JCS_JoystickButton.BUTTON_DOWN:
                    return(JCS_AxisChannel.CHANNEL_07);

                case JCS_JoystickButton.BUTTON_RIGHT:
                case JCS_JoystickButton.BUTTON_LEFT:
                    return(JCS_AxisChannel.CHANNEL_06);

                case JCS_JoystickButton.STICK_LEFT_X:
                    return(JCS_AxisChannel.X_Axis);

                case JCS_JoystickButton.STICK_LEFT_Y:
                    return(JCS_AxisChannel.Y_Axis);

                case JCS_JoystickButton.STICK_RIGHT_X:
                    return(JCS_AxisChannel.CHANNEL_04);

                case JCS_JoystickButton.STICK_RIGHT_Y:
                    return(JCS_AxisChannel.CHANNEL_05);

                case JCS_JoystickButton.LEFT_TRIGGER:              // this need to be invert.
                case JCS_JoystickButton.RIGHT_TRIGGER:
                    return(JCS_AxisChannel.CHANNEL_03);
                }
            }
            break;
            }

            // default.
            return(JCS_AxisChannel.X_Axis);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Get Unity's controller naming convention.
        /// </summary>
        /// <param name="label"> label we target to get the naming. </param>
        /// <returns> Naming convention by Unity's InputManager, for getting
        /// the right device driver id. </returns>
        public static string GetPositiveNameByLabel(JCS_JoystickButton label)
        {
#if (UNITY_EDITOR)
            if (instance == null)
            {
                JCSUnity_EditorWindow jcsunity_ew = JCSUnity_EditorWindow.instance;

                switch (jcsunity_ew.SelectGamepadType)
                {
                case 0:      /* ==> Select Platform <== */
                    return("");

                /* Sony Play Station */
                case 1:      /* ==> PS <== */
                    return("");

                case 2:      /* ==> PS2 <== */
                    return("");

                case 3:      /* ==> PS3 <== */
                    return("");

                case 4:      /* ==> PS4 <== */
                    return(GetPositiveNameByLabel_PS4(label));

                /* Microsoft XBox */
                case 5:      /* ==> XBox <== */
                    return("");

                case 6:      /* ==> XBox 360 <== */
                    return(GetPositiveNameByLabel_XBox360(label));

                case 7:      /* ==> XBox One <== */
                    return("");
                }
            }
            else
            {
#endif
            switch (instance.TargetGamePad)
            {
            case JCS_GamePadType.ALL:
                return("");

            /* Sony Play Station */
            case JCS_GamePadType.PS:
                return("");

            case JCS_GamePadType.PS2:
                return("");

            case JCS_GamePadType.PS3:
                return("");

            case JCS_GamePadType.PS4:
                return(GetPositiveNameByLabel_PS4(label));

            /* Microsoft XBox */
            case JCS_GamePadType.XBOX:
                return("");

            case JCS_GamePadType.XBOX_360:
                return(GetPositiveNameByLabel_XBox360(label));

            case JCS_GamePadType.XBOX_ONE:
                return("");
            }
#if (UNITY_EDITOR)
        }
#endif

            return("");
        }
Ejemplo n.º 7
0
        private bool mToolFoldout = false;  // Utitlies

        /* Setter & Getter */

        /* Functions */

        private void OnEnable()
        {
            instance = this;
        }
Ejemplo n.º 8
0
        private static void JCSUnityEditor()
        {
            JCSUnity_EditorWindow window = GetWindow <JCSUnity_EditorWindow>(false, NAME, true);

            window.Show();
        }