示例#1
0
 public static bool Accept(bool doMouse = true, bool doKeyBoard = true, bool doGamePad = true)
 {
     if (Core.GameInstance.IsActive)
     {
         if (doKeyBoard)
         {
             if (KeyBoardHandler.KeyPressed(Core.KeyBindings.Enter1) || KeyBoardHandler.KeyPressed(Core.KeyBindings.Enter2))
             {
                 return(true);
             }
         }
         if (doMouse)
         {
             if (MouseHandler.ButtonPressed(MouseHandler.MouseButtons.LeftButton))
             {
                 return(true);
             }
         }
         if (doGamePad)
         {
             if (ControllerHandler.ButtonPressed(Buttons.A))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#2
0
 public static bool Dismiss(bool doMouse = true, bool doKeyBoard = true, bool doGamePad = true)
 {
     if (Core.GameInstance.IsActive)
     {
         if (doKeyBoard)
         {
             if (KeyBoardHandler.KeyPressed(Core.KeyBindings.Back1) || KeyBoardHandler.KeyPressed(Core.KeyBindings.Back2))
             {
                 return(true);
             }
         }
         if (doMouse)
         {
             if (MouseHandler.ButtonPressed(MouseHandler.MouseButtons.RightButton))
             {
                 return(true);
             }
         }
         if (doGamePad)
         {
             if (ControllerHandler.ButtonPressed(Buttons.B))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#3
0
 public static bool ShiftPressed(string pressedFlag = "LR", bool triggerButtons = true)
 {
     if (pressedFlag.Contains("L") && KeyBoardHandler.KeyPressed(Keys.LeftShift))
     {
         return(true);
     }
     if (pressedFlag.Contains("L") && ControllerHandler.ButtonPressed(Buttons.LeftTrigger) && triggerButtons)
     {
         return(true);
     }
     if (pressedFlag.Contains("R") && KeyBoardHandler.KeyPressed(Keys.RightShift))
     {
         return(true);
     }
     if (pressedFlag.Contains("R") && ControllerHandler.ButtonPressed(Buttons.RightTrigger) && triggerButtons)
     {
         return(true);
     }
     return(false);
 }
示例#4
0
        private static bool CheckDirectionalPress(PressDirections direction, Keys wasdKey, Keys directionalKey, Buttons thumbStickDirection, Buttons dPadDirecion, bool arrowKeys, bool wasd, bool thumbStick, bool dPad)
        {
            bool command = false;

            if (wasd)
            {
                if (KeyBoardHandler.KeyDown(wasdKey))
                {
                    command = true;
                    if (HoldDownPress(direction))
                    {
                        return(true);
                    }
                    if (KeyBoardHandler.KeyPressed(wasdKey))
                    {
                        ChangeDirectionPressed(direction);
                        return(true);
                    }
                }
            }
            if (arrowKeys)
            {
                if (KeyBoardHandler.KeyDown(directionalKey))
                {
                    command = true;
                    if (HoldDownPress(direction))
                    {
                        return(true);
                    }
                    if (KeyBoardHandler.KeyPressed(directionalKey))
                    {
                        ChangeDirectionPressed(direction);
                        return(true);
                    }
                }
            }
            if (thumbStick)
            {
                if (ControllerHandler.ButtonDown(thumbStickDirection))
                {
                    command = true;
                    if (HoldDownPress(direction))
                    {
                        return(true);
                    }
                    if (ControllerHandler.ButtonPressed(thumbStickDirection))
                    {
                        ChangeDirectionPressed(direction);
                        return(true);
                    }
                }
            }
            if (dPad)
            {
                if (ControllerHandler.ButtonDown(dPadDirecion))
                {
                    command = true;
                    if (HoldDownPress(direction))
                    {
                        return(true);
                    }
                    if (ControllerHandler.ButtonPressed(dPadDirecion))
                    {
                        ChangeDirectionPressed(direction);
                        return(true);
                    }
                }
            }

            if (command == false)
            {
                ResetDirectionPressed(direction);
            }

            return(false);
        }