Search in sources :

Example 1 with IUserActionDelegate

use of games.strategy.triplea.delegate.remote.IUserActionDelegate in project triplea by triplea-game.

the class TripleAPlayer method userActions.

private void userActions(final boolean firstRun) {
    if (getPlayerBridge().isGameOver()) {
        return;
    }
    final IUserActionDelegate userActionDelegate;
    try {
        userActionDelegate = (IUserActionDelegate) getPlayerBridge().getRemoteDelegate();
    } catch (final ClassCastException e) {
        final String errorContext = "PlayerBridge step name: " + getPlayerBridge().getStepName() + ", Remote class name: " + getPlayerBridge().getRemoteDelegate().getClass();
        // for some reason the client is not seeing or getting these errors, so print to err too
        System.err.println(errorContext);
        ClientLogger.logQuietly(errorContext, e);
        throw new IllegalStateException(errorContext, e);
    }
    final UserActionAttachment actionChoice = ui.getUserActionChoice(getPlayerId(), firstRun, userActionDelegate);
    if (actionChoice != null) {
        userActionDelegate.attemptAction(actionChoice);
        userActions(false);
    }
}
Also used : IUserActionDelegate(games.strategy.triplea.delegate.remote.IUserActionDelegate) UserActionAttachment(games.strategy.triplea.attachments.UserActionAttachment)

Aggregations

UserActionAttachment (games.strategy.triplea.attachments.UserActionAttachment)1 IUserActionDelegate (games.strategy.triplea.delegate.remote.IUserActionDelegate)1