コード例 #1
0
        static void UpdateDPadButton(int gamepad, GenericGamepadProfile profile)
        {
            int   jOffset = gamepad * InputBinding.MAX_JOYSTICK_AXES;
            float x       = Input.GetAxis(m_axisNameLookupTable[jOffset + profile.DPadXAxis]);
            float y       = Input.GetAxis(m_axisNameLookupTable[jOffset + profile.DPadYAxis]);

            m_dpadState[gamepad].UpdateButtonStates(y >= dpadThreshold, y <= negDpadThreshold, x <= negDpadThreshold, x >= dpadThreshold);
        }
コード例 #2
0
 static bool CheckForGamepadProfile(int gamepad, out GenericGamepadProfile profile)
 {
     // profile = null;
     // if (!IndexInRange(gamepad)) return false;
     profile = gamepadProfilesPerGamepad[gamepad];
     if (profile == null)
     {
         Debug.LogError("No Gamepad Profile supplied For Input Manager...");
         return(false);
     }
     return(true);
 }
コード例 #3
0
 public static bool GamepadAvailable(int gamepad, out GenericGamepadProfile profile)
 {
     profile = null;
     if (!GamepadConnected(gamepad))
     {
         return(false);
     }
     if (!CheckForGamepadProfile(gamepad, out profile))
     {
         return(false);
     }
     return(true);
 }
コード例 #4
0
 static GenericGamepadProfile GetProfileForJoystickName(string joystickName, GenericGamepadProfile[] allProfiles)
 {
     for (int i = 0; i < allProfiles.Length; i++)
     {
         GenericGamepadProfile p = allProfiles[i];
         if (CurrentPlatformInGamepadPlatforms(ToList(p.platforms)))
         {
             for (int n = 0; n < p.unityJoystickNames.Length; n++)
             {
                 if (joystickName.Contains(p.unityJoystickNames[n]))
                 {
                     return(p);
                 }
             }
         }
     }
     Debug.LogError("Cant Find Profile for joystick: " + joystickName);
     return(null);
 }
コード例 #5
0
 static GenericGamepadProfile GetProfileForJoystickName(string joystickName, List <GenericGamepadProfile> allProfiles) // GenericGamepadProfile[] allProfiles) {
 {
     for (int i = 0; i < allProfiles.Count; i++)
     {
         GenericGamepadProfile p = allProfiles[i];
         if (CurrentPlatformInGamepadPlatforms(ToList <GamePadPossiblePlatform>(p.platforms)))
         {
             for (int n = 0; n < p.joystickAliases.Length; n++)
             {
                 if (joystickName.Contains(p.joystickAliases[n]))
                 {
                     return(p);
                 }
             }
         }
     }
     Debug.LogError("Cant Find Profile for joystick: " + joystickName);
     return(null);
 }