* GUI: added auto-choose for replacement effects (remember answer in dialog + reset answer in popup menu + new option in preferences; #4360, #328, #4219, #6676, #7914);

This commit is contained in:
Oleg Agafonov 2021-08-09 11:25:51 +04:00
parent c081d3fa33
commit c9ab896d24
11 changed files with 311 additions and 77 deletions

View file

@ -108,7 +108,7 @@ public final class GamePanel extends javax.swing.JPanel {
private boolean initComponents;
private Timer resizeTimer; // can't be final
private final Timer resizeTimer; // can't be final
private enum PopUpMenuType {
TRIGGER_ORDER
@ -128,6 +128,7 @@ public final class GamePanel extends javax.swing.JPanel {
Map<String, Serializable> options;
Set<UUID> targets;
}
private final LastGameData lastGameData = new LastGameData();
@ -1746,18 +1747,22 @@ public final class GamePanel extends javax.swing.JPanel {
// TODO: remember last choices and search incremental for same events?
PickChoiceDialog pickChoice = new PickChoiceDialog();
pickChoice.showDialog(choice, objectId, choiceWindowState);
// special mode adds # to the answer (server side code must process that prefix, see replacementEffectChoice)
String specialPrefix = choice.isChosenSpecial() ? "#" : "";
String valueToSend;
if (choice.isKeyChoice()) {
SessionHandler.sendPlayerString(gameId, choice.getChoiceKey());
/* // old code, auto complete was for auto scripting?
if (pickChoice.isAutoSelect()) {
SessionHandler.sendPlayerString(gameId, '#' + choice.getChoiceKey());
} else {
SessionHandler.sendPlayerString(gameId, choice.getChoiceKey());
}*/
valueToSend = choice.getChoiceKey();
} else {
valueToSend = choice.getChoice();
SessionHandler.sendPlayerString(gameId, choice.getChoice());
}
SessionHandler.sendPlayerString(gameId, valueToSend == null ? null : specialPrefix + valueToSend);
// keep dialog position
choiceWindowState = new MageDialogState(pickChoice);
pickChoice.removeDialog();
}