mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
* GUI: added card popup info in choose dialog (example: choose dungeon, #8012);
* GUI: added texts popup info in choose dialog (example: choose from any list);
This commit is contained in:
parent
b73f10a0ab
commit
d587cc9151
12 changed files with 322 additions and 36 deletions
|
|
@ -39,6 +39,8 @@ public interface Choice extends Serializable, Copyable<Choice> {
|
|||
|
||||
String getSpecialHint();
|
||||
|
||||
ChoiceHintType getHintType();
|
||||
|
||||
// string choice
|
||||
void setChoices(Set<String> choices);
|
||||
|
||||
|
|
|
|||
13
Mage/src/main/java/mage/choices/ChoiceHintType.java
Normal file
13
Mage/src/main/java/mage/choices/ChoiceHintType.java
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package mage.choices;
|
||||
|
||||
/**
|
||||
* For GUI: popup hint in choose dialog
|
||||
*
|
||||
* @author JayDi85
|
||||
*/
|
||||
public enum ChoiceHintType {
|
||||
|
||||
TEXT,
|
||||
CARD,
|
||||
CARD_DUNGEON
|
||||
}
|
||||
|
|
@ -21,6 +21,7 @@ public class ChoiceImpl implements Choice {
|
|||
protected String subMessage;
|
||||
protected boolean searchEnabled = true; // enable for all windows by default
|
||||
protected String searchText;
|
||||
protected ChoiceHintType hintType;
|
||||
|
||||
// special button with #-answer
|
||||
// warning, only for human's GUI, not AI
|
||||
|
|
@ -34,7 +35,12 @@ public class ChoiceImpl implements Choice {
|
|||
}
|
||||
|
||||
public ChoiceImpl(boolean required) {
|
||||
this(required, ChoiceHintType.TEXT);
|
||||
}
|
||||
|
||||
public ChoiceImpl(boolean required, ChoiceHintType hintType) {
|
||||
this.required = required;
|
||||
this.hintType = hintType;
|
||||
}
|
||||
|
||||
public ChoiceImpl(final ChoiceImpl choice) {
|
||||
|
|
@ -46,6 +52,7 @@ public class ChoiceImpl implements Choice {
|
|||
this.subMessage = choice.subMessage;
|
||||
this.searchEnabled = choice.searchEnabled;
|
||||
this.searchText = choice.searchText;
|
||||
this.hintType = choice.hintType;
|
||||
this.choices.addAll(choice.choices);
|
||||
this.choiceKey = choice.choiceKey;
|
||||
this.keyChoices = choice.keyChoices; // list should never change for the same object so copy by reference TODO: check errors with that, it that ok? Color list is static
|
||||
|
|
@ -302,4 +309,9 @@ public class ChoiceImpl implements Choice {
|
|||
public String getSpecialHint() {
|
||||
return this.specialHint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChoiceHintType getHintType() {
|
||||
return this.hintType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.text.TextPart;
|
||||
import mage.cards.FrameStyle;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceHintType;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
|
|
@ -130,11 +131,15 @@ public class Dungeon implements CommandObject {
|
|||
|
||||
public static Dungeon selectDungeon(UUID playerId, Game game) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
Choice choice = new ChoiceImpl(true, ChoiceHintType.CARD_DUNGEON);
|
||||
choice.setMessage("Choose a dungeon to venture into");
|
||||
choice.setChoices(dungeonNames);
|
||||
player.choose(Outcome.Neutral, choice, game);
|
||||
switch (choice.getChoice()) {
|
||||
return createDungeon(choice.getChoice());
|
||||
}
|
||||
|
||||
public static Dungeon createDungeon(String name) {
|
||||
switch (name) {
|
||||
case "Tomb of Annihilation":
|
||||
return new TombOfAnnihilation();
|
||||
case "Lost Mine of Phandelver":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue