public void keyPressed(KeyEvent e) { int l_keyCode = e.getKeyCode(); char l_keyChar = e.getKeyChar(); // System.out.println(e.paramString()); if (m_ac.isGameInProgress() && m_inputControls.isWeaponEvent(l_keyChar)) { Weapon l_weapon = null; int l_weaponSlot = Character.digit(l_keyChar, 10); l_weapon = (Weapon) m_inventory.getAndRemoveItemAt(l_weaponSlot); if (null != l_weapon) { m_ac.useWeapon(l_weapon); } } else { Integer l_btEvent = m_inputControls.getEventForKey(l_keyCode); // System.out.println("BTEvent="+l_btEvent); if (null != l_btEvent) { int l_btEventInt = l_btEvent.intValue(); switch (l_btEventInt) { case BattleTrisKeyEvents.MOVE_LEFT: m_pc.moveLeft(); break; case BattleTrisKeyEvents.MOVE_RIGHT: m_pc.moveRight(); break; case BattleTrisKeyEvents.DROP: m_pc.drop(); break; case BattleTrisKeyEvents.ROTATE_CCW: // Disallow this until we can fix rotation // m_pc.rotateCCW(); break; case BattleTrisKeyEvents.ROTATE_CW: m_pc.rotateCW(); break; case BattleTrisKeyEvents.PAUSE: // TODO: Put pause back as a synchronized event // only when both players have it enabled // m_ac.pauseGame(); break; } } } }
public void update(int lines, int points, int funds) throws NetworkException { m_info.m_score += points; m_info.m_money += funds; m_info.m_lines += lines; m_ac.playerUpdate(lines, points, funds, this.getPlayerInfo()); }
public void receivedPlayerUpdate(int lines, int points, int funds, PlayerInfo playerInfo) throws NetworkException { // Do not do anything if somehow we got called with ourself if (!playerInfo.equals(this)) { m_ac.playerUpdate(lines, points, funds, playerInfo); } }
public void receivedBoardUpdate(BoardImageData data) { m_ac.receivedBoardUpdate(data); }
public void updateBazaarLines(int lines) { m_ac.updateBazaarLines(lines); }
/** * A weapon is being applied to this player, who, in turn, will pass it on to the AppControllable * to delegate to appropriate objects */ public void applyWeapon(Weapon weapon) { m_ac.weaponUsed(weapon); }
public void gameEnded() { m_ac.gameEnded(); }
public void newGameCanceled() { m_ac.newGameCanceled(); }
public void newGameRejected() { m_ac.newGameRejected(); }
/** * Called to alert this client that requestee has accepted new game request. This method should * tell the UI to start a new game with the opponent specified. */ public void newGameAccepted(PlayerInfo opponent) { m_ac.newGameAccepted(opponent); }
/** * Called to alert this client that requestor is requesting a new game. This method should tell * the UI to show the user that a new game request has come in. */ public void requestForNewGame(PlayerInfo requestor) { m_ac.showNewGameRequestDialog(requestor); }