Added new choose dialog (creature types and etc):

* added incremental search;
 * added keyboard hotkeys (up/down for select, enter for choose);
 * added choose by mouse double click;
 * added source card name;
 * fixed cancel button on required choice (#4230);
 * fixed text sizes form messages (now it's auto size);
This commit is contained in:
Oleg Agafonov 2017-12-25 08:12:02 +04:00
parent 1efb51a22c
commit 749ca59ad6
7 changed files with 597 additions and 247 deletions

View file

@ -33,6 +33,7 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.choices.Choice;
import mage.choices.ChoiceCreatureType;
import mage.choices.ChoiceImpl;
import mage.constants.Outcome;
import mage.constants.SubType;
@ -63,9 +64,7 @@ public class ChooseCreatureTypeEffect extends OneShotEffect {
mageObject = game.getObject(source.getSourceId());
}
if (controller != null && mageObject != null) {
Choice typeChoice = new ChoiceImpl(true);
typeChoice.setMessage("Choose creature type");
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toCollection(LinkedHashSet::new)));
Choice typeChoice = new ChoiceCreatureType(mageObject);
while (!controller.choose(outcome, typeChoice, game)) {
if (!controller.canRespond()) {
return false;