Created
February 23, 2011 21:32
-
-
Save brantz/841226 to your computer and use it in GitHub Desktop.
updateloop.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void tradeAcceptUpdateLoop() { | |
if (model.getTradingOfferStatus() == 2) { | |
log.log(Level.INFO, model.getPlayerColor() | |
+ "'s trade offer was accepted."); | |
killTimer(); | |
Window.alert("Your trade offer was accepted"); | |
} else if (model.getTradingOfferStatus() == 0) { | |
log.log(Level.INFO, model.getPlayerColor() | |
+ "'s trade offer was declined."); | |
killTimer(); | |
Window.alert("Your trade offer was declined."); | |
} else { | |
timer = new Timer() { | |
@Override | |
public void run() { | |
try { | |
log.log(Level.INFO, model.getPlayerColor() | |
+ " waiting for answer to trade offer"); | |
communicationService.getTradingOfferStatus(); | |
tradeAcceptUpdateLoop(); | |
} catch (Exception e) { | |
log.log(Level.SEVERE, model.getPlayerColor() | |
+ " exception while waiting for trade answer: " | |
+ e.getMessage()); | |
} | |
} | |
}; | |
if (model.getTradingOfferStatus() == 1) { | |
timer.schedule(5000); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment