use of games.strategy.engine.framework.startup.launcher.LocalLauncher in project triplea by triplea-game.
the class PbemSetupPanel method getLauncher.
/**
* Called when the user hits play.
*/
@Override
public Optional<ILauncher> getLauncher() {
// update local cache and write to disk before game starts
final IForumPoster poster = (IForumPoster) forumPosterEditor.getBean();
if (poster != null) {
LocalBeanCache.INSTANCE.storeSerializable(poster.getClass().getCanonicalName(), poster);
}
final IEmailSender sender = (IEmailSender) emailSenderEditor.getBean();
if (sender != null) {
LocalBeanCache.INSTANCE.storeSerializable(sender.getClass().getCanonicalName(), sender);
}
final IRemoteDiceServer server = (IRemoteDiceServer) diceServerEditor.getBean();
LocalBeanCache.INSTANCE.storeSerializable(server.getDisplayName(), server);
LocalBeanCache.INSTANCE.writeToDisk();
// create local launcher
final String gameUuid = (String) gameSelectorModel.getGameData().getProperties().get(GameData.GAME_UUID);
final PbemDiceRoller randomSource = new PbemDiceRoller((IRemoteDiceServer) diceServerEditor.getBean(), gameUuid);
final Map<String, String> playerTypes = new HashMap<>();
final Map<String, Boolean> playersEnabled = new HashMap<>();
for (final PlayerSelectorRow player : this.playerTypes) {
playerTypes.put(player.getPlayerName(), player.getPlayerType());
playersEnabled.put(player.getPlayerName(), player.isPlayerEnabled());
}
// we don't need the playerToNode list, the
// disable-able players, or the alliances
// list, for a local game
final PlayerListing pl = new PlayerListing(null, playersEnabled, playerTypes, gameSelectorModel.getGameData().getGameVersion(), gameSelectorModel.getGameName(), gameSelectorModel.getGameRound(), null, null);
return Optional.of(new LocalLauncher(gameSelectorModel, randomSource, pl));
}
Aggregations