Ejemplo n.º 1
0
  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;
        }
      }
    }
  }
Ejemplo n.º 2
0
  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());
  }
Ejemplo n.º 3
0
 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);
   }
 }
Ejemplo n.º 4
0
 public void receivedBoardUpdate(BoardImageData data) {
   m_ac.receivedBoardUpdate(data);
 }
Ejemplo n.º 5
0
 public void updateBazaarLines(int lines) {
   m_ac.updateBazaarLines(lines);
 }
Ejemplo n.º 6
0
 /**
  * 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);
 }
Ejemplo n.º 7
0
 public void gameEnded() {
   m_ac.gameEnded();
 }
Ejemplo n.º 8
0
 public void newGameCanceled() {
   m_ac.newGameCanceled();
 }
Ejemplo n.º 9
0
 public void newGameRejected() {
   m_ac.newGameRejected();
 }
Ejemplo n.º 10
0
 /**
  * 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);
 }
Ejemplo n.º 11
0
 /**
  * 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);
 }