mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
translate desktop sideboard dialog message
This commit is contained in:
@@ -241,9 +241,8 @@ public class Match {
|
||||
person = sideboardProxy;
|
||||
}
|
||||
|
||||
String forPlayer = " for " + player.getName();
|
||||
Deck toChange = psc.getDeck();
|
||||
List<PaperCard> newMain = person.sideboard(toChange, rules.getGameType(), forPlayer);
|
||||
List<PaperCard> newMain = person.sideboard(toChange, rules.getGameType(), player.getName());
|
||||
if (null != newMain) {
|
||||
CardPool allCards = new CardPool();
|
||||
allCards.addAll(toChange.get(DeckSection.Main));
|
||||
|
||||
@@ -30,6 +30,7 @@ import forge.model.FModel;
|
||||
import forge.screens.match.CMatchUI;
|
||||
import forge.toolbox.FOptionPane;
|
||||
import forge.view.arcane.ListCardArea;
|
||||
import forge.util.Localizer;
|
||||
|
||||
public class GuiChoose {
|
||||
|
||||
@@ -83,6 +84,7 @@ public class GuiChoose {
|
||||
return GuiChoose.oneOrNone(message, choices);
|
||||
}
|
||||
public static Integer getInteger(final String message, final int min, final int max, final int cutoff) {
|
||||
final Localizer localizer = Localizer.getInstance();
|
||||
if (max <= min || cutoff < min) { return min; } //just return min if max <= min or cutoff < min
|
||||
|
||||
if (cutoff >= max) { //fallback to regular integer prompt if cutoff at or after max
|
||||
@@ -93,7 +95,7 @@ public class GuiChoose {
|
||||
for (int i = min; i <= cutoff; i++) {
|
||||
choices.add(Integer.valueOf(i));
|
||||
}
|
||||
choices.add("Other...");
|
||||
choices.add(Localizer.getInstance().getMessage("lblOtherInteger"));
|
||||
|
||||
final Object choice = GuiChoose.oneOrNone(message, choices);
|
||||
if (choice instanceof Integer || choice == null) {
|
||||
@@ -101,19 +103,18 @@ public class GuiChoose {
|
||||
}
|
||||
|
||||
//if Other option picked, prompt for number input
|
||||
String prompt = "Enter a number";
|
||||
String prompt = "";
|
||||
if (min != Integer.MIN_VALUE) {
|
||||
if (max != Integer.MAX_VALUE) {
|
||||
prompt += " between " + min + " and " + max;
|
||||
prompt = localizer.getMessage("lblEnterNumberBetweenMinAndMax", String.valueOf(min), String.valueOf(max));
|
||||
}
|
||||
else {
|
||||
prompt += " greater than or equal to " + min;
|
||||
prompt = localizer.getMessage("lblEnterNumberGreaterThanOrEqualsToMin", String.valueOf(min));
|
||||
}
|
||||
}
|
||||
else if (max != Integer.MAX_VALUE) {
|
||||
prompt += " less than or equal to " + max;
|
||||
prompt = localizer.getMessage("lblEnterNumberLessThanOrEqualsToMax", String.valueOf(max));
|
||||
}
|
||||
prompt += ":";
|
||||
|
||||
while (true) {
|
||||
final String str = FOptionPane.showInputDialog(prompt, message);
|
||||
@@ -237,7 +238,7 @@ public class GuiChoose {
|
||||
public static <T extends Comparable<? super T>> List<T> sideboard(final CMatchUI matchUI, final List<T> sideboard, final List<T> deck, final String message) {
|
||||
Collections.sort(deck);
|
||||
Collections.sort(sideboard);
|
||||
return order("Sideboard" + message, "Main Deck", -1, -1, sideboard, deck, null, true, matchUI);
|
||||
return order(Localizer.getInstance().getMessage("lblSideboardForPlayer", message), Localizer.getInstance().getMessage("ttMain"), -1, -1, sideboard, deck, null, true, matchUI);
|
||||
}
|
||||
|
||||
public static <T> List<T> order(final String title, final String top, final int remainingObjectsMin, final int remainingObjectsMax,
|
||||
@@ -303,8 +304,8 @@ public class GuiChoose {
|
||||
FThreads.invokeInEdtAndWait(ft);
|
||||
gui.clearSelectables();
|
||||
try {
|
||||
List<CardView> result = ft.get();
|
||||
return result;
|
||||
List<CardView> result = ft.get();
|
||||
return result;
|
||||
} catch (final Exception e) { // we have waited enough
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -569,7 +569,7 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
for (int i = min; i <= cutoff; i++) {
|
||||
choices.add(Integer.valueOf(i));
|
||||
}
|
||||
choices.add("...");
|
||||
choices.add(Localizer.getInstance().getMessage("lblOtherInteger"));
|
||||
|
||||
final Object choice = oneOrNone(message, choices.build());
|
||||
if (choice instanceof Integer || choice == null) {
|
||||
@@ -581,12 +581,12 @@ public abstract class AbstractGuiGame implements IGuiGame, IMayViewCards {
|
||||
String prompt = "";
|
||||
if (min != Integer.MIN_VALUE) {
|
||||
if (max != Integer.MAX_VALUE) {
|
||||
prompt = localizer.getMessage("lblEnterNumberBetweenMinAndMax").replace("%min", String.valueOf(min)).replace("%max", String.valueOf(max));
|
||||
prompt = localizer.getMessage("lblEnterNumberBetweenMinAndMax", String.valueOf(min), String.valueOf(max));
|
||||
} else {
|
||||
prompt = localizer.getMessage("lblEnterNumberGreaterThanOrEqualsToMin").replace("%min", String.valueOf(min));
|
||||
prompt = localizer.getMessage("lblEnterNumberGreaterThanOrEqualsToMin", String.valueOf(min));
|
||||
}
|
||||
} else if (max != Integer.MAX_VALUE) {
|
||||
prompt = localizer.getMessage("lblEnterNumberLessThanOrEqualsToMax").replace("%max", String.valueOf(max));
|
||||
prompt = localizer.getMessage("lblEnterNumberLessThanOrEqualsToMax", String.valueOf(max));
|
||||
}
|
||||
|
||||
while (true) {
|
||||
|
||||
Reference in New Issue
Block a user