示例#1
0
  private void closeGame(boolean isServerRestart) {
    try {
      if (!isServerRestart) {
        clientState.cleanup();
        setupNetwork();
      }

      playersContainer.clear();
      syncState.cleanup();

      teamsContainer.clear();

      bulletAppState.setEnabled(false);
      physicsWrapper.cleanup(ingameState.getRootNode());

      ingameState.cleanup();

      initInput();
      stateManager.detach(hudState);
      stateManager.detach(spawnMenuState);
      stateManager.detach(scoreBoardState);

      ingameState.setEnabled(false);
      loadingState.setEnabled(false);
      syncState.setEnabled(false);

      localPlayer = null;

      if (endState != null) {
        stateManager.detach(endState);
        endState = null;
      }

      menuState.setEnabled(!isServerRestart);
    } catch (IllegalAccessException e) {
      // TODO
      e.printStackTrace();
    }
  }
示例#2
0
 private void stopClient() {
   clientState.disconnectFromServer();
   stopApp();
 }
示例#3
0
 private void setupNetwork() {
   clientState.addMessageListener(clientMessageListener);
   clientState.addMessageListener(
       syncState, SyncMessageFactory.class, PhysicsSyncMessage.class, WeaponFireSyncMessage.class);
 }