Beispiel #1
0
    public static bool GetKutiButtonDown(EKutiButton button)
    {
        bool returnValue = false;

        // USB Controller + Android Version Bug - Unfortunately we have to use axis input for 2 buttons (P1 MID = V+, P2 MID = H+)
        if (GetButtonMapping(button) == player2MiddleButtonMapping)
        {
            if (Input.GetAxisRaw("Vertical") > 0 && lastP2MidButtonValue == 0)
            {
                lastP2MidButtonValue = 1f;
                returnValue          = true;
            }
        }
        else if (GetButtonMapping(button) != player2MiddleButtonMapping && GetButtonMapping(button) != menuButtonMapping)
        {
            return(Input.GetButtonDown(GetButtonMapping(button)));
        }

        if (GetButtonMapping(button) == menuButtonMapping && Input.GetAxisRaw("Vertical") == -1)
        {
            returnValue = true;
        }

        GetKutiButtonUp(button);
        return(returnValue);
    }
Beispiel #2
0
 private void ListenForKeyChanges()
 {
     if (!isInitialized)
     {
         Initialize();
     }
     foreach (EKutiButton button in EKutiButton.GetValues(typeof(EKutiButton)))
     {
         bool input = false;
         try
         {
             input = ReadStream(fileStreams[button]) == 48;
         }
         catch
         {
         }
         if (input != currentInputs[button])
         {
             currentInputs[button] = input;
             if (input == true)
             {
                 currentButtonDown[button] = true;
             }
             else if (input == false)
             {
                 currentButtonUp[button] = true;
             }
         }
     }
 }
Beispiel #3
0
 private void ResetUpDownDictionarys()
 {
     foreach (EKutiButton button in EKutiButton.GetValues(typeof(EKutiButton)))
     {
         currentButtonDown[button] = false;
         currentButtonUp[button]   = false;
     }
 }
Beispiel #4
0
 public bool GetButton(EKutiButton button)
 {
     try
     {
         return(ReadStream(fileStreams[button]) == 48);
     }
     catch (Exception e)
     {
         Debug.Log(e);
     }
     return(false);
 }
Beispiel #5
0
    public static bool GetKutiButtonUp(EKutiButton button)
    {
        if (AndroidInput.isInitialized)
        {
            return(AndroidInput.GetKutiButtonUp(button));
        }

#if !ANDROID
        if (Input.GetKeyUp(GetButtonMapping(button)))
        {
            return(true);
        }
#endif
        return(false);
    }
Beispiel #6
0
//	public enum KUTI_KEYCODE
//	{
//		PLAYER_1_LEFT = 0,
//		PLAYER_1_UP = 1,
//		PLAYER_1_RIGHT = 2,
//		MENU = 3,
//		PLAYER_2_LEFT= 4,
//		PLAYER_2_UP = 5,
//		PLAYER_2_RIGHT = 6
//	}

    private static string GetButtonMapping(EKutiButton button)
    {
        string returnValue;

        switch (button)
        {
        case EKutiButton.P1_LEFT:
            returnValue = player1LeftButtonMapping;
            break;

        case EKutiButton.P1_MID:
            returnValue = player1MiddleButtonMapping;
            break;

        case EKutiButton.P1_RIGHT:
            returnValue = player1RightButtonMapping;
            break;

        case EKutiButton.P2_LEFT:
            returnValue = player2LeftButtonMapping;
            break;

        case EKutiButton.P2_MID:
            returnValue = player2MiddleButtonMapping;
            break;

        case EKutiButton.P2_RIGHT:
            returnValue = player2RightButtonMapping;
            break;

        case EKutiButton.MENU:
            returnValue = menuButtonMapping;
            break;

        default:
            returnValue = "noInputMappingFound";
            break;
        }

        return(returnValue);
    }
Beispiel #7
0
 public static bool GetKutiButton(EKutiButton button)
 {
     return(currentInputs[button]);
 }
Beispiel #8
0
 public static bool GetKutiButtonUp(EKutiButton button)
 {
     return(currentButtonUp[button]);
 }
Beispiel #9
0
 public static bool GetKutiButtonDown(EKutiButton button)
 {
     return(currentButtonDown[button]);
 }
Beispiel #10
0
    public bool GetButtonDown(EKutiButton button)
    {
        bool input = false;

        try
        {
            input = ReadStream(fileStreams[button]) == 48;
        }
        catch (Exception e)
        {
            Debug.Log(e);
        }
        switch (button)
        {
        case EKutiButton.Menu:
            if (input != menuDown)
            {
                menuDown = input;
                if (menuDown)
                {
                    return(menuDown);
                }
            }
            break;

        case EKutiButton.P1Left:
            if (input != p1LeftDown)
            {
                p1LeftDown = input;
                if (p1LeftDown)
                {
                    return(p1LeftDown);
                }
            }
            break;

        case EKutiButton.P1Right:
            if (input != p1RightDown)
            {
                p1RightDown = input;
                if (p1RightDown)
                {
                    return(p1RightDown);
                }
            }
            break;

        case EKutiButton.P1Up:
            if (input != p1UpDown)
            {
                p1UpDown = input;
                if (p1UpDown)
                {
                    return(p1UpDown);
                }
            }
            break;

        case EKutiButton.P2Right:
            if (input != p2RightDown)
            {
                p2RightDown = input;
                if (p2RightDown)
                {
                    return(p2RightDown);
                }
            }
            break;

        case EKutiButton.P2Left:
            if (input != p2LeftDown)
            {
                p2LeftDown = input;
                if (p2LeftDown)
                {
                    return(p2LeftDown);
                }
            }
            break;

        case EKutiButton.P2Up:
            if (input != p2UpDown)
            {
                p2UpDown = input;
                if (p2UpDown)
                {
                    return(p2UpDown);
                }
            }
            break;
        }
        return(false);
    }