Ejemplo n.º 1
0
 /// <summary>
 /// [ボタン]の情報を一括取得
 /// </summary>
 public static XBStateButton GetStateButton(XBKeyCode.UserCode id)
 {
     XBStateButton sts = new XBStateButton();
     sts.A = XBGamePad.IsPressed(XBKeyCode.Button.A, id);
     sts.B = XBGamePad.IsPressed(XBKeyCode.Button.B, id);
     sts.X = XBGamePad.IsPressed(XBKeyCode.Button.X, id);
     sts.Y = XBGamePad.IsPressed(XBKeyCode.Button.Y, id);
     sts.start = XBGamePad.IsPressed(XBKeyCode.Button.Start, id);
     sts.back = XBGamePad.IsPressed(XBKeyCode.Button.Back, id);
     return sts;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// すべての入力情報を一括取得
        /// </summary>
        /// <param name="raw">未加工の値にするか?</param>
        public static XBState GetState(XBKeyCode.UserCode id, bool raw = false)
        {
            XBState sts = new XBState();

            sts.button = XBGamePad.GetStateButton(id);
            sts.shoulders = XBGamePad.GetStateShoulder(id, raw);
            sts.axisL = XBGamePad.GetStateAxisL(id, raw);
            sts.axisR = XBGamePad.GetStateAxisR(id, raw);
            sts.dpad = XBGamePad.GetStateDPad(id, raw);

            return sts;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// [右スティック]の情報を一括取得
        /// </summary>
        /// <param name="raw">未加工の値にするか?</param>
        public static XBStateAxis GetStateAxisR(XBKeyCode.UserCode id, bool raw = false)
        {
            XBStateAxis sts = new XBStateAxis();

            sts.stickPressed = XBGamePad.IsPressed(XBKeyCode.Button.RightStick, id);
            if (raw)
            {
                sts.axis = XBGamePad.GetAxisRaw(XBKeyCode.Axis.RightStick, id);
            }
            else
            {
                sts.axis = XBGamePad.GetAxis(XBKeyCode.Axis.RightStick, id);
            }

            return sts;
        }
Ejemplo n.º 4
0
 public XVInputController(UserID id)
 {
     switch (id)
     {
         case UserID.User1:
             m_userCode = XBKeyCode.UserCode.User1;
             break;
         case UserID.User2:
             m_userCode = XBKeyCode.UserCode.User2;
             break;
         case UserID.User3:
             m_userCode = XBKeyCode.UserCode.User3;
             break;
         case UserID.User4:
             m_userCode = XBKeyCode.UserCode.User4;
             break;
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// [Trigger]の取得
        /// </summary>
        public static float GetTrigger(XBKeyCode.Trigger axis, XBKeyCode.UserCode id)
        {
            string val = ((int)id).ToString();
            switch (axis)
            {
                case XBKeyCode.Trigger.LeftTrigger:
                    float fl = GetTriggerInternal(
                        XVInputConstants.LTrigger + val);
                    fl = (fl > 0.0f ? fl : 0.0f);
                    return fl;

                case XBKeyCode.Trigger.RightTrigger:
                    float fr = GetTriggerInternal(
                        XVInputConstants.RTrigger + val);
                    fr = (fr < 0.0f ? -fr : 0.0f);
                    return fr;
            }

            return 0.0f;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// [十字キー]の情報を一括取得
        /// </summary>
        /// <param name="raw">未加工の値にするか?</param>
        public static XBStateDPad GetStateDPad(XBKeyCode.UserCode id, bool raw = false)
        {
            XBStateDPad sts = new XBStateDPad();

            if (raw)
            {
                sts.axis = XBGamePad.GetAxisRaw(XBKeyCode.Axis.Dpad, id);
            }
            else
            {
                sts.axis = XBGamePad.GetAxis(XBKeyCode.Axis.Dpad, id);
            }

            sts.left = (sts.axis.x < 0);
            sts.right = (sts.axis.x > 0);
            sts.up = (sts.axis.y > 0);
            sts.down = (sts.axis.y < 0);

            return sts;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// [Shoulder & Trigger]の情報を一括取得
        /// </summary>
        /// <param name="raw">未加工の値にするか?</param>
        public static XBStateShoulder GetStateShoulder(XBKeyCode.UserCode id, bool raw = false)
        {
            XBStateShoulder sts = new XBStateShoulder();

            sts.shoulderL = XBGamePad.IsPressed(XBKeyCode.Button.LeftShoulder, id);
            sts.shoulderR = XBGamePad.IsPressed(XBKeyCode.Button.RightShoulder, id);

            if (raw)
            {
                sts.triggerL = XBGamePad.GetTriggerRaw(XBKeyCode.Trigger.LeftTrigger, id);
                sts.triggerR = XBGamePad.GetTriggerRaw(XBKeyCode.Trigger.RightTrigger, id);
            }
            else
            {
                sts.triggerL = XBGamePad.GetTrigger(XBKeyCode.Trigger.LeftTrigger, id);
                sts.triggerR = XBGamePad.GetTrigger(XBKeyCode.Trigger.RightTrigger, id);
            }

            return sts;
        }
Ejemplo n.º 8
0
    /// <summary>
    /// Inputのラッパー
    /// </summary>
    private bool IsInputEvent(XBKeyCode.UserCode code)
    {
#if ENABLE_DEBUG_INPUT
        switch (code)
        {
        case XBKeyCode.UserCode.User1:
            return(Input.GetKeyDown(KeyCode.Alpha1) || XBGamePad.IsTriggered(m_submitKey, code));

        case XBKeyCode.UserCode.User2:
            return(Input.GetKeyDown(KeyCode.Alpha2) || XBGamePad.IsTriggered(m_submitKey, code));

        case XBKeyCode.UserCode.User3:
            return(Input.GetKeyDown(KeyCode.Alpha3) || XBGamePad.IsTriggered(m_submitKey, code));

        case XBKeyCode.UserCode.User4:
            return(Input.GetKeyDown(KeyCode.Alpha4) || XBGamePad.IsTriggered(m_submitKey, code));
        }
        return(false);
#else
        return(XBGamePad.IsTriggered(m_submitKey, code));
#endif
    }
Ejemplo n.º 9
0
        /// <summary>
        /// [Axis]の取得(未加工の値)
        /// </summary>
        public static Vector2 GetAxisRaw(XBKeyCode.Axis axis, XBKeyCode.UserCode id)
        {
            string val = ((int)id).ToString();
            switch (axis)
            {
                case XBKeyCode.Axis.LeftStick:
                    return GetAxisRawInternal(
                        XVInputConstants.LAxisX + val,
                        XVInputConstants.LAxisY + val);

                case XBKeyCode.Axis.RightStick:
                    return GetAxisRawInternal(
                        XVInputConstants.RAxisX + val,
                        XVInputConstants.RAxisY + val);

                case XBKeyCode.Axis.Dpad:
                    return GetAxisRawInternal(
                        XVInputConstants.DPadAxisX + val,
                        XVInputConstants.DPadAxisY + val);
            }

            return Vector2.zero;
        }
Ejemplo n.º 10
0
 public XVInputController()
 {
     AkiVACO.XLogger.LogWarning("Create XBox Controller: UserCode = Any");
     m_userCode = XBKeyCode.UserCode.Any;
 }
Ejemplo n.º 11
0
 public XVInputController(XBKeyCode.UserCode id)
 {
     m_userCode = id;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// [Button]を今放したか?
 /// </summary>
 public static bool IsReleased(XBKeyCode.Button button, XBKeyCode.UserCode id)
 {
     return Input.GetKeyUp(XBKeyCode.GetKeycode(button, id));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// [Button]を今押したか?
 /// </summary>
 public static bool IsTriggered(XBKeyCode.Button button, XBKeyCode.UserCode id)
 {
     return Input.GetKeyDown(XBKeyCode.GetKeycode(button, id));
 }