use of games.strategy.engine.lobby.client.LobbyClient in project triplea by triplea-game.
the class MetaSetupPanel method connectToLobby.
private void connectToLobby() {
final LobbyServerProperties lobbyServerProperties = new LobbyServerPropertiesFetcher().fetchLobbyServerProperties();
final LobbyLogin login = new LobbyLogin(JOptionPane.getFrameForComponent(this), lobbyServerProperties);
final LobbyClient client = login.login();
if (client == null) {
return;
}
final LobbyFrame lobbyFrame = new LobbyFrame(client, lobbyServerProperties);
GameRunner.hideMainFrame();
lobbyFrame.setVisible(true);
}
use of games.strategy.engine.lobby.client.LobbyClient in project triplea by triplea-game.
the class LobbyLogin method login.
@Nullable
private LobbyClient login(final LoginPanel panel) {
try {
final IMessenger messenger = GameRunner.newBackgroundTaskRunner().runInBackgroundAndReturn("Connecting to lobby...", () -> login(panel.getUserName(), panel.getPassword(), panel.isAnonymousLogin()), IOException.class);
panel.getLobbyLoginPreferences().save();
return new LobbyClient(messenger, panel.isAnonymousLogin());
} catch (final CouldNotLogInException e) {
showError("Login Failed", e.getMessage() + "\n" + playerMacIdString());
// NB: potential stack overflow due to recursive call
return loginToServer();
} catch (final IOException e) {
showError("Could Not Connect", "Could not connect to lobby: " + e.getMessage());
return null;
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
return null;
}
}
use of games.strategy.engine.lobby.client.LobbyClient in project triplea by triplea-game.
the class LobbyLogin method createAccount.
@Nullable
private LobbyClient createAccount(final CreateUpdateAccountPanel panel) {
try {
final IMessenger messenger = GameRunner.newBackgroundTaskRunner().runInBackgroundAndReturn("Connecting to lobby...", () -> createAccount(panel.getUserName(), panel.getPassword(), panel.getEmail()), IOException.class);
panel.getLobbyLoginPreferences().save();
return new LobbyClient(messenger, false);
} catch (final CouldNotLogInException e) {
showError("Account Creation Failed", e.getMessage());
// NB: potential stack overflow due to recursive call
return createAccount();
} catch (final IOException e) {
showError("Could Not Connect", "Could not connect to lobby: " + e.getMessage());
return null;
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
return null;
}
}
Aggregations