forked from External/mage
Added a game end dialog, that shows the result of the finished game.
This commit is contained in:
parent
19726268ff
commit
ae44981cfa
19 changed files with 922 additions and 4 deletions
|
|
@ -57,6 +57,7 @@ import mage.cards.repository.CardRepository;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.GameException;
|
||||
import mage.game.Table;
|
||||
import mage.game.events.Listener;
|
||||
import mage.game.events.PlayerQueryEvent;
|
||||
import mage.game.events.TableEvent;
|
||||
|
|
@ -141,6 +142,9 @@ public class GameController implements GameCallback {
|
|||
case ERROR:
|
||||
error(event.getMessage(), event.getException());
|
||||
break;
|
||||
case END_GAME_INFO:
|
||||
endGameInfo();
|
||||
break;
|
||||
case INIT_TIMER:
|
||||
final UUID initPlayerId = event.getPlayerId();
|
||||
if (initPlayerId == null) {
|
||||
|
|
@ -475,6 +479,21 @@ public class GameController implements GameCallback {
|
|||
}
|
||||
}
|
||||
|
||||
private synchronized void endGameInfo() {
|
||||
Table table = TableManager.getInstance().getTable(tableId);
|
||||
if (table != null) {
|
||||
if (table.getMatch() != null) {
|
||||
for (final GameSession gameSession: gameSessions.values()) {
|
||||
gameSession.endGameInfo(table.getMatch());
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: inform watchers
|
||||
// for (final GameWatcher gameWatcher: watchers.values()) {
|
||||
// gameWatcher.update();
|
||||
// }
|
||||
}
|
||||
|
||||
private synchronized void ask(UUID playerId, final String question) throws MageException {
|
||||
perform(playerId, new Command() {
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue