* UI: improved choose number dialog (fixed enter key, added more info colorized info for mana distribute dialog);

This commit is contained in:
Oleg Agafonov 2018-03-15 00:14:04 +04:00
parent 9647083f60
commit 83a3de9a93
4 changed files with 134 additions and 55 deletions

View file

@ -94,10 +94,12 @@ public class AddManaInAnyCombinationEffect extends ManaEffect {
if (player != null) {
Mana mana = new Mana();
int amountOfManaLeft = amount.calculate(game, source, this);
int maxAmount = amountOfManaLeft;
while (amountOfManaLeft > 0 && player.canRespond()) {
for (ColoredManaSymbol coloredManaSymbol : manaSymbols) {
int number = player.getAmount(0, amountOfManaLeft, "How many " + coloredManaSymbol.getColorName() + " mana?", game);
int number = player.getAmount(0, amountOfManaLeft, "Distribute mana by color (done " + mana.count()
+ " of " + maxAmount + "). How many mana add to <b>" + coloredManaSymbol.getColorHtmlName() + "</b> (enter 0 for pass to next color)?", game);
if (number > 0) {
for (int i = 0; i < number; i++) {
mana.add(new Mana(coloredManaSymbol));

View file

@ -2,22 +2,26 @@ package mage.constants;
/**
*
* @author North
* @author North, JayDi85
*/
public enum ColoredManaSymbol {
W("W","white"), U("U","blue"), B("B","black"), R("R","red"), G("G","green"),
O("O","gold");
W("W", "white", "<font color='gray'>white</font>"), // white can't be white on white background, need gray
U("U", "blue", "<font color='blue'>blue</font>"),
B("B", "black", "<font color='black'>black</font>"),
R("R", "red", "<font color='red'>red</font>"),
G("G", "green", "<font color='green'>green</font>"),
O("O", "gold", "<font color='gold'>gold</font>");
private final String text;
private final String colorName;
private final String colorHtmlName;
ColoredManaSymbol(String text, String colorName) {
ColoredManaSymbol(String text, String colorName, String colorHtmlName) {
this.text = text;
this.colorName = colorName;
this.colorHtmlName = colorHtmlName;
}
@Override
public String toString() {
return text;
@ -27,6 +31,9 @@ public enum ColoredManaSymbol {
return colorName;
}
public String getColorHtmlName() {
return colorHtmlName;
}
public static ColoredManaSymbol lookup(char c) {
switch (c) {