예제 #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);
 }