public override void HandleInput(InputMenuState input) { if (input.IsMenuUp(ControllingPlayer)) { selectedEntry--; if (selectedEntry < 0) { selectedEntry = menuEntries.Count - 1; } } if (input.IsMenuDown(ControllingPlayer)) { selectedEntry++; if (selectedEntry >= menuEntries.Count) { selectedEntry = 0; } } PlayerIndex playerIndex; if (input.IsMenuSelect(ControllingPlayer, out playerIndex)) { OnSelectEntry(selectedEntry, playerIndex); } else if (input.IsMenuCancel(ControllingPlayer, out playerIndex)) { OnCancel(playerIndex); } }
private void TimeScrolling(InputMenuState input) { if (input.IsMenuDown(ControllingPlayer) == true) { if (currentPage == maxPages) { return; } else { currentPage += 1; } } if (input.IsMenuUp(ControllingPlayer) == true) { if (currentPage == 1) { return; } else { currentPage -= 1; } } }
public override void HandleInput(InputMenuState input) { if (input.IsMenuDown(ControllingPlayer) == true) { characterScroll--; if (characterScroll < 0) { characterScroll = characters.Length - 1; } if (characterScroll > characters.Length - 1) { characterScroll = 0; } } if (input.IsMenuUp(ControllingPlayer) == true) { characterScroll++; if (characterScroll < 0) { characterScroll = characters.Length - 1; } if (characterScroll > characters.Length - 1) { characterScroll = 0; } } if (input.IsButtonAPressed(ControllingPlayer) == true) { if (playerName.Length < maxNameLength) { if (characterScroll >= 0) { playerName += characters[characterScroll]; } } } if (input.CurrentKeyboardStates[0].IsKeyDown(Keys.Tab) == true) { if (input.LastKeyboardStates[0].IsKeyUp(Keys.Tab) == true) { if (playerName.Length < maxNameLength) { if (characterScroll >= 0) { playerName += characters[characterScroll]; } } } } if (input.IsButtonBPressed(ControllingPlayer) == true) { int removeLetter = playerName.Length - 1; if (removeLetter >= 0) { playerName = playerName.Remove(removeLetter); } } if (input.CurrentKeyboardStates[0].IsKeyDown(Keys.Delete) == true) { if (input.LastKeyboardStates[0].IsKeyUp(Keys.Delete) == true) { int removeLetter = playerName.Length - 1; if (removeLetter >= 0) { playerName = playerName.Remove(removeLetter); } } } if (input.CurrentKeyboardStates[0].IsKeyDown(Keys.Back) == true) { if (input.LastKeyboardStates[0].IsKeyUp(Keys.Back) == true) { int removeLetter = playerName.Length - 1; if (removeLetter >= 0) { playerName = playerName.Remove(removeLetter); } } } if (input.IsPauseGame(ControllingPlayer) == true || input.CurrentKeyboardStates[0].IsKeyDown(Keys.Enter) == true) { playerData.PlayerName = playerName; HighTime.SaveData(levelName, playerData); ScreenManager.AddScreen(new TimeScreen(levelName, currentZone, currentLevel), ControllingPlayer); } }