use of games.strategy.engine.framework.startup.ui.ClientOptions in project triplea by triplea-game.
the class ClientModel method getProps.
private static ClientProps getProps(final Component ui) {
if (System.getProperty(TRIPLEA_CLIENT, "false").equals("true") && System.getProperty(TRIPLEA_STARTED, "").isEmpty()) {
final ClientProps props = new ClientProps();
props.setHost(System.getProperty(TRIPLEA_HOST));
props.setName(System.getProperty(TRIPLEA_NAME));
props.setPort(Integer.parseInt(System.getProperty(TRIPLEA_PORT)));
System.setProperty(TRIPLEA_STARTED, "true");
return props;
}
// load in the saved name!
final String playername = ClientSetting.PLAYER_NAME.value();
final ClientOptions options = new ClientOptions(ui, playername, GameRunner.PORT, "127.0.0.1");
options.setLocationRelativeTo(ui);
options.setVisible(true);
options.dispose();
if (!options.getOkPressed()) {
return null;
}
final ClientProps props = new ClientProps();
props.setHost(options.getAddress());
props.setName(options.getName());
props.setPort(options.getPort());
return props;
}
Aggregations