コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="act"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static bool GetKeyByAction(JCS_KeyActionType act, KeyCode key, bool ignorePause = false)
        {
            switch (act)
            {
            case JCS_KeyActionType.KEY:
                return(GetKey(key, ignorePause));

            case JCS_KeyActionType.KEY_DOWN:
                return(GetKeyDown(key, ignorePause));

            case JCS_KeyActionType.KEY_UP:
                return(GetKeyUp(key, ignorePause));
            }

            JCS_Debug.LogError("This cannot happed, because all states applied.");
            return(false);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="act"></param>
        /// <param name="button"></param>
        /// <returns></returns>
        public static bool GetMouseByAction(JCS_KeyActionType act, int button, bool ignorePause = false)
        {
            switch (act)
            {
            case JCS_KeyActionType.KEY:
                return(GetMouseButton(button, ignorePause));

            case JCS_KeyActionType.KEY_DOWN:
                return(GetMouseButtonDown(button, ignorePause));

            case JCS_KeyActionType.KEY_UP:
                return(GetMouseButtonUp(button, ignorePause));
            }

            JCS_Debug.LogError("This cannot happed.");
            return(false);
        }
コード例 #3
0
        /// <summary>
        /// Get the boolean check depends on the button status.
        ///
        /// Button status are list here:
        /// 1) Button Down
        /// 2) Button Hold
        /// 3) Button Up
        /// </summary>
        /// <param name="act"> button down, button up, or button pressed. </param>
        /// <param name="buttonName"> name of the button. </param>
        /// <returns>
        /// Is either pressed, down, up. or not pressed, down, up.
        /// </returns>
        public static bool GetButtonByAction(JCS_KeyActionType act, string buttonName, bool ignorePause = false)
        {
            switch (act)
            {
            case JCS_KeyActionType.KEY:
                return(GetButton(buttonName, ignorePause));

            case JCS_KeyActionType.KEY_DOWN:
                return(GetButtonDown(buttonName, ignorePause));

            case JCS_KeyActionType.KEY_UP:
                return(GetButtonUp(buttonName, ignorePause));
            }


            JCS_Debug.LogError("This cannot happed.");

            // this cannot happens
            return(false);
        }
コード例 #4
0
        public static bool GetJoystickKeyByAction(
            JCS_KeyActionType act,
            JCS_JoystickIndex id,
            JCS_JoystickButton key,
            bool ignorePause = false)
        {
            switch (act)
            {
            case JCS_KeyActionType.KEY:
                return(GetJoystickKey(id, key, ignorePause));

            case JCS_KeyActionType.KEY_DOWN:
                return(GetJoystickKeyDown(id, key, ignorePause));

            case JCS_KeyActionType.KEY_UP:
                return(GetJoystickKeyUp(id, key, ignorePause));
            }

            JCS_Debug.LogError("This cannot happed.");
            return(false);
        }
コード例 #5
0
        /// <summary>
        /// Loop through the key and key what key is pressed.
        /// </summary>
        /// <param name="type"> type of the key pressed option. </param>
        /// <returns> key u pressed. </returns>
        public static KeyCode GetAnyKeyByAction(JCS_KeyActionType type, bool ignorePause = false)
        {
            if (!ignorePause)
            {
                if (JCS_GameManager.instance.GAME_PAUSE)
                {
                    return(KeyCode.None);
                }
            }

            // loop through the key code list
            foreach (KeyCode val in JCS_Utility.GetValues <KeyCode>())
            {
                // if the key is pressed, return it.
                if (GetKeyByAction(type, val))
                {
                    return(val);
                }
            }

            // default return.
            return(KeyCode.None);
        }
コード例 #6
0
        /// <summary>
        /// Check if any key is pressed.
        /// </summary>
        /// <param name="type"> action u want to check. </param>
        /// <returns>
        /// true: key buffer in
        /// false: no key buffer in
        /// </returns>
        public static bool IsAnyKeyBuffer(JCS_KeyActionType type, bool ignorePause = false)
        {
            KeyCode code = GetAnyKeyByAction(type, ignorePause);

            return(code != KeyCode.None);
        }
コード例 #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="act"></param>
 /// <param name="button"></param>
 /// <returns></returns>
 public static bool GetMouseByAction(JCS_KeyActionType act, JCS_MouseButton button, bool ignorePause = false)
 {
     return(GetMouseByAction(act, (int)button, ignorePause));
 }