use of games.strategy.engine.random.PbemDiceRoller in project triplea by triplea-game.
the class DiceServerEditor method setupListeners.
/**
* Configures the listeners for the gui components.
*/
private void setupListeners() {
testDiceyButton.addActionListener(e -> {
final PbemDiceRoller random = new PbemDiceRoller(getDiceServer(), null);
random.test();
});
final DocumentListener docListener = new EditorChangedFiringDocumentListener();
toAddress.getDocument().addDocumentListener(docListener);
ccAddress.getDocument().addDocumentListener(docListener);
}
use of games.strategy.engine.random.PbemDiceRoller 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