support choose localization card name

This commit is contained in:
CCTV-1
2020-01-28 09:17:23 +08:00
parent 8a0ba4f27a
commit 2f1bdc5767
2 changed files with 35 additions and 13 deletions

View File

@@ -1561,12 +1561,12 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
CardFaceView cardFaceView;
List<CardFaceView> choices = new ArrayList<>();
for (ICardFace cardFace : cards) {
cardFaceView = new CardFaceView(cardFace.getName());
cardFaceView = new CardFaceView(CardTranslation.getTranslatedName(cardFace.getName()), cardFace.getName());
choices.add(cardFaceView);
}
Collections.sort(choices);
cardFaceView = getGui().one(message, choices);
return StaticData.instance().getCommonCards().getFaceByName(cardFaceView.getName());
return StaticData.instance().getCommonCards().getFaceByName(cardFaceView.getOracleName());
}
@Override
@@ -1960,7 +1960,7 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
}
public class DevModeCheats implements IDevModeCheats {
private ICardFace lastAdded;
private CardFaceView lastAdded;
private ZoneType lastAddedZone;
private Player lastAddedPlayer;
private SpellAbility lastAddedSA;
@@ -2363,15 +2363,21 @@ public class PlayerControllerHuman extends PlayerController implements IGameCont
final CardDb carddb = FModel.getMagicDb().getCommonCards();
final List<ICardFace> faces = Lists.newArrayList(carddb.getAllFaces());
Collections.sort(faces);
List<CardFaceView> choices = new ArrayList<>();
CardFaceView cardFaceView;
for (ICardFace cardFace : faces) {
cardFaceView = new CardFaceView(CardTranslation.getTranslatedName(cardFace.getName()), cardFace.getName());
choices.add(cardFaceView);
}
Collections.sort(choices);
// use standard forge's list selection dialog
final ICardFace f = repeatLast ? lastAdded : getGui().oneOrNone(localizer.getMessage("lblNameTheCard"), faces);
final CardFaceView f = repeatLast ? lastAdded : getGui().oneOrNone(localizer.getMessage("lblNameTheCard"), choices);
if (f == null) {
return;
}
final PaperCard c = carddb.getUniqueByName(f.getName());
final PaperCard c = carddb.getUniqueByName(f.getOracleName());
final Card forgeCard = Card.fromPaperCard(c, p);
game.getAction().invoke(new Runnable() {