public override void HandleInput(InputState input) { if (input.IsNewButtonPress(Buttons.Back)) Back(); if (input.IsNewButtonTick(Buttons.DPadLeft)) LeftClick(); if (input.IsNewButtonTick(Buttons.DPadRight)) RightClick(); if (input.IsNewButtonTick(Buttons.DPadUp)) UpClick(); if (input.IsNewButtonTick(Buttons.DPadDown)) DownClick(); if (input.IsNewButtonRelease(Buttons.A)) ClickItem(); }
/// <summary> /// Input helper method provided by GameScreen. Packages up the various input /// values for ease of use. /// </summary> /// <param name="input">The state of the gamepads</param> public override void HandleInput(InputState input) { if (input.IsNewButtonPress(Buttons.Back)) Back(); if (Movable) { #region DPAD CONTROLS if (input.IsNewButtonTick(Buttons.DPadUp)) { if (faceSelected) { selected.row = Height - 1; faceSelected = false; } else if (selected.row == 0) faceSelected = true; else selected.row--; } if (input.IsNewButtonTick(Buttons.DPadDown)) { if (faceSelected) { selected.row = 0; faceSelected = false; } else if (selected.row < Height - 1) selected.row++; else faceSelected = true; } if (input.IsNewButtonTick(Buttons.DPadLeft) && !faceSelected) { if (selected.col == 0) selected.col = Width - 1; else selected.col--; } if (input.IsNewButtonTick(Buttons.DPadRight) && !faceSelected) { if (selected.col < Width - 1) selected.col++; else selected.col = 0; } #endregion if (!faceSelected) if ((Game.options.FlagWithPlay && input.IsButtonPressed(Buttons.A)) || (!Game.options.FlagWithPlay && input.IsButtonPressed(Buttons.B))) faceValue = Face.Scared; if (faceValue == Face.Scared) if ((Game.options.FlagWithPlay && !input.IsButtonPressed(Buttons.A)) || (!Game.options.FlagWithPlay && !input.IsButtonPressed(Buttons.B))) faceValue = Face.Happy; if (input.IsNewButtonRelease(Buttons.A)) { if (faceSelected) SetGame(Height, Width, Mines); else if (Game.options.FlagWithPlay) Click(); else TileFlag(); } if (input.IsNewButtonRelease(Buttons.B) && !faceSelected) { if (Game.options.FlagWithPlay) TileFlag(); else Click(); } } else if (input.IsNewButtonRelease(Buttons.A)) SetGame(Height, Width, Mines); }