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(); } }
private void stopClient() { clientState.disconnectFromServer(); stopApp(); }
private void setupNetwork() { clientState.addMessageListener(clientMessageListener); clientState.addMessageListener( syncState, SyncMessageFactory.class, PhysicsSyncMessage.class, WeaponFireSyncMessage.class); }