* 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

@ -1,55 +1,92 @@
package mage.choices;
import mage.util.Copyable;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
*
* @author BetaSteward_at_googlemail.com, JayDi85
*/
public interface Choice {
public interface Choice extends Serializable, Copyable<Choice> {
String getMessage();
void setMessage(String message);
String getSubMessage();
void setSubMessage(String subMessage);
void clearChoice();
boolean isChosen();
boolean isChosenSpecial();
boolean isRequired();
Choice copy();
// special mode for all choices
void setSpecial(boolean enabled, boolean canBeEmpty, String text, String hint);
boolean isSpecialEnabled();
boolean isSpecialCanBeEmpty();
String getSpecialText();
String getSpecialHint();
// string choice
void setChoices(Set<String> choices);
Set<String> getChoices();
void setChoice(String choice);
void setChoice(String choice, boolean isSpecial);
String getChoice();
default void setChoice(String choice) {
setChoice(choice, false);
}
// key-value choice
boolean isKeyChoice();
void setKeyChoices(Map<String, String> choices);
Map<String,String> getKeyChoices();
void setChoiceByKey(String choiceKey);
Map<String, String> getKeyChoices();
void setChoiceByKey(String choiceKey, boolean isSpecial);
String getChoiceKey();
String getChoiceValue();
default void setChoiceByKey(String choiceKey) {
setChoiceByKey(choiceKey, false);
}
// search
boolean isSearchEnabled();
void setSearchEnabled(boolean isEnabled);
void setSearchText(String searchText);
String getSearchText();
// sorting
boolean isSortEnabled();
void setSortData(Map<String, Integer> sortData);
Map<String, Integer> getSortData();
// random choice
// random choice (for AI usage)
void setRandomChoice();
boolean setChoiceByAnswers(List<String> answers, boolean removeSelectAnswerFromList);
}