private void pollForButtonClicks(ButtonAssignment ba)
 {
     if (ba != null && ba.buttonIndex != -1)
     {
         if (ba.joystick != null)
         {
             try
             {
                 if (ba.joystick != null)
                 {
                     JoystickState state = ba.joystick.GetCurrentState();
                     if (state != null)
                     {
                         Boolean click = state.Buttons[ba.buttonIndex];
                         if (click)
                         {
                             ba.hasUnprocessedClick = true;
                         }
                     }
                 }
             }
             catch (Exception)
             {
             }
         }
         else if (ba.controller.guid == UDP_NETWORK_CONTROLLER_GUID)
         {
             if (PCarsUDPreader.getButtonState(ba.buttonIndex))
             {
                 ba.hasUnprocessedClick = true;
             }
         }
     }
 }
Пример #2
0
        public Boolean isChannelOpen()
        {
            ButtonAssignment ba = buttonAssignments[buttonAssignmentIndexes[CHANNEL_OPEN_FUNCTION]];

            if (ba != null && ba.buttonIndex != -1)
            {
                if (ba.joystick != null)
                {
                    try
                    {
                        return(ba.joystick.GetCurrentState().Buttons[ba.buttonIndex]);
                    }
                    catch (Exception)
                    {
                        // ignore this exception
                    }
                }
                else if (ba.controller.guid == UDP_NETWORK_CONTROLLER_GUID && CrewChief.gameDefinition.gameEnum == GameEnum.PCARS_NETWORK)
                {
                    return(PCarsUDPreader.getButtonState(ba.buttonIndex));
                }
                else if (ba.controller.guid == UDP_NETWORK_CONTROLLER_GUID && CrewChief.gameDefinition.gameEnum == GameEnum.PCARS2_NETWORK)
                {
                    return(PCars2UDPreader.getButtonState(ba.buttonIndex));
                }
            }
            return(false);
        }