mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Added logic to auto select replacement effects. Some changes to counter size and font size handling.
This commit is contained in:
parent
ab9c0ae893
commit
df71237f46
28 changed files with 445 additions and 140 deletions
|
|
@ -65,6 +65,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
import mage.choices.Choice;
|
||||
import mage.constants.PlayerAction;
|
||||
|
||||
/**
|
||||
|
|
@ -215,8 +216,8 @@ public class GameController implements GameCallback {
|
|||
case CHOOSE_MODE:
|
||||
chooseMode(event.getPlayerId(), event.getModes());
|
||||
break;
|
||||
case CHOOSE:
|
||||
choose(event.getPlayerId(), event.getMessage(), event.getChoices());
|
||||
case CHOOSE_CHOICE:
|
||||
chooseChoice(event.getPlayerId(), event.getChoice());
|
||||
break;
|
||||
case AMOUNT:
|
||||
amount(event.getPlayerId(), event.getMessage(), event.getMin(), event.getMax());
|
||||
|
|
@ -582,11 +583,11 @@ public class GameController implements GameCallback {
|
|||
});
|
||||
}
|
||||
|
||||
private synchronized void choose(UUID playerId, final String message, final Set<String> choices) throws MageException {
|
||||
private synchronized void chooseChoice(UUID playerId, final Choice choice) throws MageException {
|
||||
perform(playerId, new Command() {
|
||||
@Override
|
||||
public void execute(UUID playerId) {
|
||||
getGameSession(playerId).choose(message, choices);
|
||||
getGameSession(playerId).chooseChoice(choice);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mage.choices.Choice;
|
||||
import mage.game.Table;
|
||||
|
||||
/**
|
||||
|
|
@ -123,12 +124,12 @@ public class GameSession extends GameWatcher {
|
|||
}
|
||||
}
|
||||
|
||||
public void choose(final String message, final Set<String> choices) {
|
||||
public void chooseChoice(final Choice choice) {
|
||||
if (!killed) {
|
||||
setupTimeout();
|
||||
User user = UserManager.getInstance().getUser(userId);
|
||||
if (user != null) {
|
||||
user.fireCallback(new ClientCallback("gameChoose", game.getId(), new GameClientMessage(choices.toArray(new String[choices.size()]), message)));
|
||||
user.fireCallback(new ClientCallback("gameChooseChoice", game.getId(), new GameClientMessage(choice)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue