/// <summary> /// Handle moves in this menu /// </summary> /// <param name="gameTime"></param> public void Update(GameTime gameTime) { frameCount += 1; if (Actions.GetInstance()[Inputs.Action.Left].IsPressed()) { selectedIndexCharCursor = TetrisMath.mod(selectedIndexCharCursor - 1, selectedIndexChar.Length); } if (Actions.GetInstance()[Inputs.Action.Right].IsPressed()) { selectedIndexCharCursor = TetrisMath.mod(selectedIndexCharCursor + 1, selectedIndexChar.Length); } if (Actions.GetInstance()[Inputs.Action.Up].IsPressed()) { selectedIndexChar[selectedIndexCharCursor] = TetrisMath.mod(selectedIndexChar[selectedIndexCharCursor] + 1, POSSIBLE_CHARS.Length); } if (Actions.GetInstance()[Inputs.Action.Down].IsPressed()) { selectedIndexChar[selectedIndexCharCursor] = TetrisMath.mod(selectedIndexChar[selectedIndexCharCursor] - 1, POSSIBLE_CHARS.Length); } if (Actions.GetInstance()[Inputs.Action.Start].IsPressed()) { ScoreEntry scoreEntry = new ScoreEntry(IndicesToString(), score, level); Scores.Instance.AddScore(scoreEntry); tetris.ChangeMenu(nextMenu); } }
/// <summary> /// Handle controls for the menu selection /// </summary> /// <param name="gameTime"></param> public void Update(GameTime gameTime) { frameCount += 1; if (Actions.GetInstance()[Inputs.Action.Start].IsPressed()) { //set level tetris.ChangeMenu(new GameMenu(tetris, level, GameType.TypeA)); } if (Actions.GetInstance()[Inputs.Action.Select].IsPressed()) { tetris.ChangeMenu(new GameTypeMenu(tetris)); } if (Actions.GetInstance()[Inputs.Action.Down].IsPressed()) { if (level < maxmenu / 2) { level += maxmenu / 2; } } if (Actions.GetInstance()[Inputs.Action.Up].IsPressed()) { if (level >= maxmenu / 2) { level -= maxmenu / 2; } } if (Actions.GetInstance()[Inputs.Action.Right].IsPressed()) { level += 1; level %= maxmenu; } if (Actions.GetInstance()[Inputs.Action.Left].IsPressed()) { level -= 1; level = TetrisMath.mod(level, maxmenu); } }
/// <summary> /// Handle controls /// </summary> /// <param name="gameTime"></param> public void Update(GameTime gameTime) { frameCount += 1; if (Actions.GetInstance()[Inputs.Action.Start].IsPressed()) { if (currentGameType == GameType.TypeA) { tetris.ChangeMenu(new TypeAMenu(tetris, 0)); } if (currentGameType == GameType.TypeB) { //tetris.ChangeMenu(new TypeBMenu(tetris, currentMusicType)); } } if (Actions.GetInstance()[Inputs.Action.Select].IsPressed()) { tetris.ChangeMenu(new PressStartMenu(tetris)); } if (Actions.GetInstance()[Inputs.Action.Down].IsPressed()) { SelectMusic((MusicType)TetrisMath.mod((int)currentMusicType + 1, Enum.GetNames(typeof(MusicType)).Length)); } if (Actions.GetInstance()[Inputs.Action.Up].IsPressed()) { SelectMusic((MusicType)TetrisMath.mod((int)currentMusicType - 1, Enum.GetNames(typeof(MusicType)).Length)); } if (Actions.GetInstance()[Inputs.Action.Right].IsPressed()) { currentGameType = (GameType)TetrisMath.mod((int)currentGameType + 1, Enum.GetNames(typeof(GameType)).Length); } if (Actions.GetInstance()[Inputs.Action.Left].IsPressed()) { currentGameType = (GameType)TetrisMath.mod((int)currentGameType - 1, Enum.GetNames(typeof(GameType)).Length); } }