Replace Yes/No text with Mulligan/Keep text on mulligan answer buttons to make options more clear.

This commit is contained in:
Quercitron 2016-07-31 15:57:45 +03:00
parent 94e59e5ee7
commit c04bd6d64a
5 changed files with 29 additions and 5 deletions

View file

@ -203,9 +203,15 @@ public class FeedbackPanel extends javax.swing.JPanel {
private void handleOptions(Map<String, Serializable> options) {
if (options != null) {
if (options.containsKey("UI.left.btn.text")) {
String text = (String) options.get("UI.left.btn.text");
this.btnLeft.setText(text);
this.helper.setLeft(text, true);
}
if (options.containsKey("UI.right.btn.text")) {
this.btnRight.setText((String) options.get("UI.right.btn.text"));
this.helper.setRight((String) options.get("UI.right.btn.text"), true);
String text = (String) options.get("UI.right.btn.text");
this.btnRight.setText(text);
this.helper.setRight(text, true);
}
if (options.containsKey("dialog")) {
connectedDialog = (MageDialog) options.get("dialog");

View file

@ -323,6 +323,13 @@ public class HelperPanel extends JPanel {
this.btnUndo.setVisible(enabled);
}
public void setLeft(String text, boolean visible) {
this.btnLeft.setVisible(visible);
if (!text.isEmpty()) {
this.btnLeft.setText(text);
}
}
public void setRight(String txtRight, boolean rightVisible) {
this.btnRight.setVisible(rightVisible);
if (!txtRight.isEmpty()) {

View file

@ -160,9 +160,13 @@ public class HumanPlayer extends PlayerImpl {
updateGameStatePriority("chooseMulligan", game);
int nextHandSize = game.mulliganDownTo(playerId);
do {
game.fireAskPlayerEvent(playerId, new MessageToClient("Mulligan "
String message = "Mulligan "
+ (getHand().size() > nextHandSize ? "down to " : "for free, draw ")
+ nextHandSize + (nextHandSize == 1 ? " card?" : " cards?")), null);
+ nextHandSize + (nextHandSize == 1 ? " card?" : " cards?");
Map<String, Serializable> options = new HashMap<>();
options.put("UI.left.btn.text", "Mulligan");
options.put("UI.right.btn.text", "Keep");
game.fireAskPlayerEvent(playerId, new MessageToClient(message), null, options);
waitForResponse(game);
} while (response.getBoolean() == null && !abort);
if (!abort) {

View file

@ -237,6 +237,8 @@ public interface Game extends MageItem, Serializable {
void fireAskPlayerEvent(UUID playerId, MessageToClient message, Ability source);
void fireAskPlayerEvent(UUID playerId, MessageToClient message, Ability source, Map<String, Serializable> options);
void fireChooseChoiceEvent(UUID playerId, Choice choice);
void fireSelectTargetEvent(UUID playerId, MessageToClient message, Set<UUID> targets, boolean required, Map<String, Serializable> options);

View file

@ -2018,10 +2018,15 @@ public abstract class GameImpl implements Game, Serializable {
@Override
public void fireAskPlayerEvent(UUID playerId, MessageToClient message, Ability source) {
fireAskPlayerEvent(playerId, message, source, null);
}
@Override
public void fireAskPlayerEvent(UUID playerId, MessageToClient message, Ability source, Map<String, Serializable> options) {
if (simulation) {
return;
}
playerQueryEventSource.ask(playerId, message.getMessage(), source, addMessageToOptions(message, null));
playerQueryEventSource.ask(playerId, message.getMessage(), source, addMessageToOptions(message, options));
}
@Override