update NewGameScene translations

This commit is contained in:
Anthony Calosa
2023-02-24 10:48:09 +08:00
parent d500bc32a4
commit 1bc9f77cdb
14 changed files with 166 additions and 49 deletions

View File

@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Json;
import forge.Forge;
import forge.adventure.util.Config;
import forge.adventure.util.Paths;
@@ -67,7 +68,7 @@ public class HeroListData {
instance = read();
Array<String> ret = new Array<>();
for (HeroData hero : instance.heroes) {
ret.add(hero.name);
ret.add(Forge.getLocalizer().getMessageorUseDefault("lbl"+hero.name, hero.name));
}
return ret;
}

View File

@@ -1,9 +1,11 @@
package forge.adventure.scene;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.badlogic.gdx.utils.Array;
import com.github.tommyettinger.textra.TextraLabel;
@@ -45,7 +47,8 @@ public class NewGameScene extends UIScene {
private final Array<String> custom;
private final TextraLabel colorLabel;
private final Array<AdventureModes> modes=new Array<>();
private final Array<AdventureModes> modes = new Array<>();
private NewGameScene() {
super(Forge.isLandscapeMode() ? "ui/new_game.json" : "ui/new_game_portrait.json");
@@ -71,21 +74,18 @@ public class NewGameScene extends UIScene {
for (DifficultyData diff : Config.instance().getConfigData().difficulties)//check first difficulty if exists
{
if(diff.starterDecks!=null)
{
if (diff.starterDecks != null) {
modes.add(AdventureModes.Standard);
AdventureModes.Standard.setSelectionName(colorIdLabel);
AdventureModes.Standard.setModes(colorNames);
}
if(diff.constructedStarterDecks!=null)
{
if (diff.constructedStarterDecks != null) {
modes.add(AdventureModes.Constructed);
AdventureModes.Constructed.setSelectionName(colorIdLabel);
AdventureModes.Constructed.setModes(colorNames);
}
if(diff.pileDecks!=null)
{
if (diff.pileDecks != null) {
modes.add(AdventureModes.Pile);
AdventureModes.Pile.setSelectionName(colorIdLabel);
AdventureModes.Pile.setModes(colorNames);
@@ -106,28 +106,36 @@ public class NewGameScene extends UIScene {
starterEdition.setTextList(editionNames);
modes.add(AdventureModes.Chaos);
AdventureModes.Chaos.setSelectionName("[BLACK]"+Forge.getLocalizer().getMessage("lblDeck")+":");
AdventureModes.Chaos.setSelectionName("[BLACK]" + Forge.getLocalizer().getMessage("lblDeck") + ":");
AdventureModes.Chaos.setModes(new Array<>(new String[]{Forge.getLocalizer().getMessage("lblRandomDeck")}));
for (DeckProxy deckProxy : DeckProxy.getAllCustomStarterDecks())
custom.add(deckProxy.getName());
if(!custom.isEmpty())
{
if (!custom.isEmpty()) {
modes.add(AdventureModes.Custom);
AdventureModes.Custom.setSelectionName("[BLACK]"+Forge.getLocalizer().getMessage("lblDeck")+":");
AdventureModes.Custom.setSelectionName("[BLACK]" + Forge.getLocalizer().getMessage("lblDeck") + ":");
AdventureModes.Custom.setModes(custom);
}
String[] modeNames=new String[modes.size];
for(int i=0;i<modes.size;i++)
modeNames[i]=modes.get(i).getName();
String[] modeNames = new String[modes.size];
for (int i = 0; i < modes.size; i++)
modeNames[i] = modes.get(i).getName();
mode.setTextList(modeNames);
gender.setTextList(new String[]{"Male", "Female"});
gender.setTextList(new String[]{Forge.getLocalizer().getInstance().getMessage("lblMale"), Forge.getLocalizer().getInstance().getMessage("lblFemale")});
gender.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
//gender should be either Male or Female
String val = gender.getCurrentIndex() > 0 ? "Female" : "Male";
selectedName.setText(NameGenerator.getRandomName(val, "Any", ""));
super.clicked(event, x, y);
}
});
gender.addListener(event -> NewGameScene.this.updateAvatar());
mode.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent changeEvent, Actor actor) {
AdventureModes smode=modes.get(mode.getCurrentIndex());
AdventureModes smode = modes.get(mode.getCurrentIndex());
colorLabel.setText(smode.getSelectionName());
colorId.setTextList(smode.getModes());
starterEdition.setVisible(smode == AdventureModes.Standard);
@@ -145,7 +153,7 @@ public class NewGameScene extends UIScene {
for (DifficultyData diff : Config.instance().getConfigData().difficulties) {
if (diff.startingDifficulty)
startingDifficulty = i;
diffList.add(diff.name);
diffList.add(Forge.getLocalizer().getInstance().getMessageorUseDefault("lbl" + diff.name, diff.name));
i++;
}
difficulty.setTextList(diffList);
@@ -166,17 +174,22 @@ public class NewGameScene extends UIScene {
private static NewGameScene object;
public static NewGameScene instance() {
if(object==null)
object=new NewGameScene();
if (object == null)
object = new NewGameScene();
return object;
}
boolean started = false;
public boolean start() {
if (started)
return true;
started = true;
if (selectedName.getText().isEmpty()) {
selectedName.setText(NameGenerator.getRandomName("Any", "Any", ""));
}
Runnable runnable = () -> {
started = false;
FModel.getPreferences().setPref(ForgePreferences.FPref.UI_ENABLE_MUSIC, false);
WorldSave.generateNewWorld(selectedName.getText(),
gender.getCurrentIndex() == 0,
@@ -229,7 +242,7 @@ public class NewGameScene extends UIScene {
colorIds[colorId.getCurrentIndex()],
Config.instance().getConfigData().difficulties[difficulty.getCurrentIndex()],
modes.get(mode.getCurrentIndex()), colorId.getCurrentIndex(),
editionIds[starterEdition.getCurrentIndex()],0);
editionIds[starterEdition.getCurrentIndex()], 0);
GamePlayerUtil.getGuiPlayer().setName(selectedName.getText());
Forge.switchScene(GameScene.instance());
}

View File

@@ -62,7 +62,7 @@ public class SaveLoadScene extends UIScene {
int c = 0;
String[] diffList = new String[Config.instance().getConfigData().difficulties.length];
for (DifficultyData diff : Config.instance().getConfigData().difficulties) {
diffList[c] = diff.name;
diffList[c] = Forge.getLocalizer().getMessageorUseDefault("lbl" + diff.name, diff.name);
c++;
}
@@ -75,7 +75,7 @@ public class SaveLoadScene extends UIScene {
playerLocation = Controls.newTextraLabel("");
playerLocation.setText("");
playerLocation.setX(previewImage.getX());
playerLocation.setY(previewImage.getY()+5);
playerLocation.setY(previewImage.getY() + 5);
ui.addActor(playerLocation);
header = Controls.newTextraLabel(Forge.getLocalizer().getMessage("lblSave"));
header.setAlignment(Align.center);
@@ -98,33 +98,31 @@ public class SaveLoadScene extends UIScene {
difficulty.setSelectedIndex(1);
difficulty.setAlignment(Align.center);
difficulty.getStyle().fontColor = Color.GOLD;
difficulty.setX(scrollPane.getWidth()-difficulty.getWidth()+5);
difficulty.setY(scrollPane.getTop()-difficulty.getHeight()-5);
difficulty.setX(scrollPane.getWidth() - difficulty.getWidth() + 5);
difficulty.setY(scrollPane.getTop() - difficulty.getHeight() - 5);
}
private static SaveLoadScene object;
public static SaveLoadScene instance() {
if(object==null)
object=new SaveLoadScene();
if (object == null)
object = new SaveLoadScene();
return object;
}
public class SaveSlot extends Selectable<TextraButton>
{
public class SaveSlot extends Selectable<TextraButton> {
private int slotNumber;
public SaveSlot( int slotNumber) {
public SaveSlot(int slotNumber) {
super(Controls.newTextButton("..."));
this.slotNumber = slotNumber;
SaveSlot self=this;
SaveSlot self = this;
actor.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
try {
if (!actor.isDisabled())
{
if (!actor.isDisabled()) {
selectActor(self);
}
} catch (Exception e) {
@@ -133,9 +131,9 @@ public class SaveLoadScene extends UIScene {
}
});
}
@Override
public void onSelect(UIScene scene)
{
public void onSelect(UIScene scene) {
super.onSelect(scene);
updateSlot(slotNumber);
}
@@ -145,17 +143,17 @@ public class SaveLoadScene extends UIScene {
private Selectable<TextraButton> addSaveSlot(String name, int i) {
layout.add(Controls.newLabel(name)).align(Align.left).pad(2, 5, 2, 10);
SaveSlot button = new SaveSlot(i);
layout.add(button.actor).fill(true,false).expand(true,false).align(Align.left).expandX();
layout.add(button.actor).fill(true, false).expand(true, false).align(Align.left).expandX();
buttons.put(i, button);
layout.row();
addToSelectable(button) ;
addToSelectable(button);
return button;
}
public boolean select(int slot) {
if(!buttons.containsKey(slot))
if (!buttons.containsKey(slot))
return false;
selectActor(buttons.get(slot));
return updateSlot(slot);
@@ -175,7 +173,7 @@ public class SaveLoadScene extends UIScene {
previewImage.setVisible(true);
previewDate.setVisible(true);
if (header.saveDate != null)
previewDate.setText("[%98]"+DateFormat.getDateInstance().format(header.saveDate) + " " + DateFormat.getTimeInstance(DateFormat.SHORT).format(header.saveDate));
previewDate.setText("[%98]" + DateFormat.getDateInstance().format(header.saveDate) + " " + DateFormat.getTimeInstance(DateFormat.SHORT).format(header.saveDate));
else
previewDate.setText("");
if (header.name.contains(Character.toString(ASCII_179))) {
@@ -206,7 +204,7 @@ public class SaveLoadScene extends UIScene {
//prevent NPE, allowed saveslot is 1 to 10..
textInput.setText(buttons.get(currentSlot).actor.getText().toString());
Dialog dialog=prepareDialog(Forge.getLocalizer().getMessage("lblSave"),ButtonOk|ButtonAbort,() -> SaveLoadScene.this.save());
Dialog dialog = prepareDialog(Forge.getLocalizer().getMessage("lblSave"), ButtonOk | ButtonAbort, () -> SaveLoadScene.this.save());
dialog.getContentTable().add(Controls.newLabel(Forge.getLocalizer().getMessage("lblNameYourSaveFile"))).colspan(2).pad(2, 15, 2, 15);
dialog.getContentTable().row();
@@ -255,7 +253,7 @@ public class SaveLoadScene extends UIScene {
public void save() {
if (WorldSave.getCurrentSave().save(textInput.getText()+ASCII_179+GameScene.instance().getAdventurePlayerLocation(true), currentSlot)) {
if (WorldSave.getCurrentSave().save(textInput.getText() + ASCII_179 + GameScene.instance().getAdventurePlayerLocation(true), currentSlot)) {
updateFiles();
//ensure the dialog is hidden before switching

View File

@@ -1,13 +1,14 @@
package forge.adventure.util;
import com.badlogic.gdx.utils.Array;
import forge.Forge;
public enum AdventureModes {
Standard("Standard"),
Constructed("Constructed"),
Chaos("[GOLD]Chaos"),
Pile("Pile"),
Custom("Custom");
Standard(Forge.getLocalizer().getMessage("lblStandard")),
Constructed(Forge.getLocalizer().getMessage("lblConstructed")),
Chaos("[GOLD]"+Forge.getLocalizer().getMessage("lblChaos")),
Pile(Forge.getLocalizer().getMessage("lblPile")),
Custom(Forge.getLocalizer().getMessage("lblCustom"));
private final String name;
private String selectionName;

View File

@@ -85,7 +85,7 @@
{
"type": "Label",
"name" : "starterEditionL",
"text": "[BLACK]Starter Edition",
"text": "[BLACK]tr(lblStarterEdition):",
"width": 128,
"height": 16,
"x": 75,

View File

@@ -85,7 +85,7 @@
{
"type": "Label",
"name" : "starterEditionL",
"text": "[BLACK]Starter Edition:",
"text": "[BLACK]tr(lblStarterEdition):",
"width": 128,
"height": 24,
"x": 16,

View File

@@ -2929,6 +2929,19 @@ lblTempHitPoints=Temporäre Trefferpunkte
lblChosenColors=Gewählte Farben:
lblLoyalty=Loyaltät
#Achievement.java
lblStandard=Standard
lblChaos=Chaos
lblPile=Haufen
lblCustom=Brauch
lblStarterEdition=Beginner-Ausgabe
lblElf=Elf
lblMetathran=Metathran
lblUndead=Untoten
lblViashino=Viendino
lblDwarf=Zwerg
lblDevil=Teufel
lblKor=Kor
lblInsane=Verrückt
lblCommon=Gewöhnlich
lblUncommon=Ungewöhnlich
lblRare=Selten

View File

@@ -2939,6 +2939,19 @@ lblTempHitPoints=Temporary Hit Points
lblChosenColors=Chosen colors:
lblLoyalty=Loyalty
#Achievement.java
lblStandard=Standard
lblChaos=Chaos
lblPile=Pile
lblCustom=Custom
lblStarterEdition=Starter Edition
lblElf=Elf
lblMetathran=Metathran
lblUndead=Undead
lblViashino=Viashino
lblDwarf=Dwarf
lblDevil=Devil
lblKor=Kor
lblInsane=Insane
lblMythic=Mythic
lblAchievementEarned=Achievement Earned
lblZoom=Zoom

View File

@@ -2935,6 +2935,19 @@ lblTempHitPoints=Puntos de golpe temporales
lblChosenColors=Colores elegidos:
lblLoyalty=Lealtad
#Achievement.java
lblStandard=Estándar
lblChaos=Caos
lblPile=Montón
lblCustom=Costumbre
lblStarterEdition=Edición inicial
lblElf=Duende
lblMetathran=Metathran
lblUndead=No muerto
lblViashino=Paseos
lblDwarf=Enano
lblDevil=Demonio
lblKor=Kor
lblInsane=Loco
lblMythic=Mítico
lblAchievementEarned=Logro ganado
lblZoom=Zoom

View File

@@ -2937,6 +2937,19 @@ lblTempHitPoints=Points de vie temporaires
lblChosenColors=Couleurs choisies :
lblLoyalty=Loyauté
#Achievement.java
lblStandard=Standard
lblChaos=Chaos
lblPile=Pile
lblCustom=Coutume
lblStarterEdition=Édition de démarrage
lblElf=Elfe
lblMetathran=Metathran
lblUndead=Mort-vivant
lblViashino=Viahino
lblDwarf=Nain
lblDevil=Diable
lblKor=Core
lblInsane=Fou
lblMythic=Mythique
lblAchievementEarned=Succès obtenu
lblZoom=Zoom

View File

@@ -2045,7 +2045,7 @@ lblPlayerRolledResult={0} ha ottenuto {1} col dado
lblDoYouWantPayEcho=Vuoi pagare Eco
lblPayEcho=Paga Eco
lblDoYouWantSacrifice=Vuoi sacrificare?
lblDoYouWantSacrifice=Vuoi sacrificare {0}?
lblDoYouWantSacrificeThis=Vuoi sacrificare {0}?
#SetStateEffect.java
lblFaceDownCardCantTurnFaceUp=La carta a faccia in giù non può essere girata a faccia in su
#ShuffleEffect.java
@@ -2938,6 +2938,19 @@ lblTempHitPoints=Punti ferita temporanei
lblChosenColors=Colori scelti:
lblLoyalty=Lealtà
#Achievement.java
lblStandard=Standard
lblChaos=Caos
lblPile=Mucchio
lblCustom=Costume
lblStarterEdition=Starter Edition
lblElf=Elfo
lblMetathran=Metathran
lblUndead=Non morti
lblViashino=Viashino
lblDwarf=Nano
lblDevil=Diavolo
lblKor=Kor
lblInsane=Pazzo
lblMythic=Mitico
lblAchievementEarned=Achievement Earned
lblZoom=Ingrandisci

View File

@@ -2934,6 +2934,19 @@ lblTempHitPoints=一時的なヒットポイント
lblChosenColors=選ばれた色:
lblLoyalty=忠誠心
#Achievement.java
lblStandard=標準
lblChaos=混沌
lblPile=パイル
lblCustom=カスタム
lblStarterEdition=スターター版
lblElf=妖精
lblMetathran=メタラン
lblUndead=アンデッド
lblViashino=ビアシノ
lblDwarf=小人
lblDevil=悪魔
lblKor=コル
lblInsane=非常識
lblMythic=神話
lblAchievementEarned=獲得した達成
lblZoom=ズーム

View File

@@ -3024,6 +3024,19 @@ lblTempHitPoints=Pontos de vida temporários
lblChosenColors=Cores escolhidas:
lblLoyalty=Lealdade
#Achievement.java
lblStandard=Padrão
lblChaos=Caos
lblPile=Pilha
lblCustom=Personalizado
lblStarterEdition=Edição inicial
lblElf=Duende
lblMetathran=Metathran
lblUndead=Morto-vivo
lblViashino=ViaShino
lblDwarf=Anão
lblDevil=Diabo
lblKor=Kor
lblInsane=Insano
lblMythic=Mythic
lblAchievementEarned=Achievement Earned
lblZoom=Ampliação

View File

@@ -2917,6 +2917,19 @@ lblTempHitPoints=临时生命值
lblChosenColors=选择的颜色:
lblLoyalty=忠诚指示物
#Achievement.java
lblStandard=标准
lblChaos=混乱
lblPile=
lblCustom=风俗
lblStarterEdition=首发版
lblElf=精灵
lblMetathran=甲菊酯
lblUndead=亡灵
lblViashino=凡尔西诺
lblDwarf=矮人
lblDevil=魔鬼
lblKor=
lblInsane=疯狂的
lblMythic=秘稀
lblAchievementEarned=获得的成就
lblZoom=飞涨