コード例 #1
0
ファイル: PreGameController.java プロジェクト: amrecio/mymom
  /** Starts the game. */
  public void startGame() {
    ResourceMapping gameMapping = new ResourceMapping();
    for (Player player : freeColClient.getGame().getPlayers()) {
      addPlayerResources(player.getNationID(), gameMapping);
    }
    // Unknown nation is not in getPlayers() list.
    addPlayerResources(Nation.UNKNOWN_NATION_ID, gameMapping);
    ResourceManager.addGameMapping(gameMapping);

    Player myPlayer = freeColClient.getMyPlayer();
    if (!freeColClient.isHeadless()) {
      gui.closeMainPanel();
      gui.closeMenus();
      gui.closeStatusPanel();
      gui.playSound(null); // Stop the long introduction sound
      gui.playSound("sound.intro." + myPlayer.getNationID());
    }
    freeColClient.askServer().registerMessageHandler(freeColClient.getInGameInputHandler());

    if (!freeColClient.isHeadless()) {
      freeColClient.setInGame(true);
      gui.setupInGameMenuBar();
    }

    InGameController igc = freeColClient.getInGameController();
    gui.setSelectedTile((Tile) myPlayer.getEntryLocation(), false);
    if (freeColClient.currentPlayerIsMyPlayer()) {
      igc.nextActiveUnit();
    }

    gui.setUpMouseListenersForCanvas();

    if (FreeColDebugger.isInDebugMode() && FreeColDebugger.getDebugRunTurns() > 0) {
      freeColClient.skipTurns(FreeColDebugger.getDebugRunTurns());
    } else if (freeColClient.getGame().getTurn().getNumber() == 1) {
      ModelMessage message =
          new ModelMessage(ModelMessage.MessageType.TUTORIAL, "tutorial.startGame", myPlayer);
      String direction = myPlayer.getNation().startsOnEastCoast() ? "west" : "east";
      message.add("%direction%", direction);
      myPlayer.addModelMessage(message);
      // force view of tutorial message
      igc.nextModelMessage();
    }
  }
コード例 #2
0
ファイル: PreGameController.java プロジェクト: amrecio/mymom
  /**
   * Sets this client's player's nation type.
   *
   * @param nationType Which nation type this player wishes to set.
   */
  public void setNationType(NationType nationType) {
    freeColClient.getMyPlayer().setNationType(nationType);

    freeColClient.askServer().setNationType(nationType);
  }
コード例 #3
0
ファイル: PreGameController.java プロジェクト: amrecio/mymom
  /**
   * Sets this client's player's nation.
   *
   * @param nation Which <code>Nation</code> this player wishes to set.
   */
  public void setNation(Nation nation) {
    freeColClient.getMyPlayer().setNation(nation);

    freeColClient.askServer().setNation(nation);
  }
コード例 #4
0
ファイル: PreGameController.java プロジェクト: amrecio/mymom
  /**
   * Sets this client to be (or not be) ready to start the game.
   *
   * @param ready Indicates whether or not this client is ready to start the game.
   */
  public void setReady(boolean ready) {
    freeColClient.getMyPlayer().setReady(ready);

    freeColClient.askServer().setReady(ready);
  }
コード例 #5
0
ファイル: PreGameController.java プロジェクト: amrecio/mymom
 /**
  * Sends a chat message.
  *
  * @param message The text of the message.
  */
 public void chat(String message) {
   freeColClient.askServer().chat(freeColClient.getMyPlayer(), message);
 }