Skip to content

Commit

Permalink
menu update zhcn
Browse files Browse the repository at this point in the history
menu and cn
  • Loading branch information
Rei1mu committed May 20, 2024
1 parent c12c480 commit 631ccee
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 44 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<head>
<meta charset="UTF-8" />
<title>PokeRogue.cn_中文非官方服务器</title>
<title>PokeRogue.cn_非官方中文服务器,群号468390221</title>
<meta name="description" content="一个A Pokémon fangame heavily inspired by the roguelite genre. Battle endlessly while gathering stacking items, exploring many different biomes, and reaching Pokémon stats you never thought possible." />
<meta name="theme-color" content="#da3838" />
<meta property="og:title" content="PokeRogue.cn_中文非官方服务器" />
Expand Down
29 changes: 26 additions & 3 deletions src/locales/en/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,30 @@ export const menu: SimpleTranslationEntries = {
"noRankings": "No Rankings",
"loading": "Loading…",
"playersOnline": "Players Online",
"empty":"Empty",
"yes":"Yes",
"no":"No",
"empty": "Empty",
"yes": "Yes",
"no": "No",
"Game_Speed": "Game Speed",
"Master_Volume": "Master Volume",
"BGM_Volume": "BGM Volume",
"SE_Volume": "SE Volume",
"Language": "Language",
"Damage_Numbers": "Damage Numbers",
"UI_Theme": "UI Theme",
"Window_Type": "Window Type",
"Tutorials": "Tutorials",
"Enable_Retries": "Enable Retries",
"Sprite_Set": "Sprite Set",
"Move_Animations": "Move Animations",
"Show_Stats_on_Level_Up": "Show Stats on Level Up",
"EXP_Gains_Speed": "EXP Gains Speed",
"EXP_Party_Display": "EXP Party Display",
"HP_Bar_Speed": "HP Bar Speed",
"Fusion_Palette_Swaps": "Fusion Palette Swaps",
"Player_Gender": "Player Gender",
"Gamepad_Support": "Gamepad Support",
"Swap_A_and_B": "Swap A and B",
"Touch_Controls": "Touch Controls",
"Requires_Reload":" (Requires Reload)",
"Vibration": "Vibration"
} as const;
23 changes: 23 additions & 0 deletions src/locales/zh_CN/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,27 @@ export const menu: SimpleTranslationEntries = {
"empty": "空",
"yes": "是",
"no": "否",
"Game_Speed": "游戏速度",
"Master_Volume": "主音量",
"BGM_Volume": "BGM音量",
"SE_Volume": "音效音量",
"Language": "语言",
"Damage_Numbers": "伤害数字",
"UI_Theme": "UI 风格",
"Window_Type": "窗口类型",
"Tutorials": "引导",
"Enable_Retries": "启用战斗重试",
"Sprite_Set": "精灵设置",
"Move_Animations": "招式动画",
"Show_Stats_on_Level_Up": "升级时显示属性",
"EXP_Gains_Speed": "经验获取速度",
"EXP_Party_Display": "团队经验显示",
"HP_Bar_Speed": "HP Bar 速度",
"Fusion_Palette_Swaps": "Fusion Palette Swaps",
"Player_Gender": "玩家性别",
"Gamepad_Support": "Gamepad Support",
"Swap_A_and_B": "交换A和B",
"Touch_Controls": "触控",
"Requires_Reload":" (将重载)",
"Vibration": "震动"
} as const;
2 changes: 1 addition & 1 deletion src/locales/zh_CN/modifier-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const modifierType: ModifierTypeTranslationEntries = {
},
"TmModifierType": {
name: "招式学习器 {{moveId}} - {{moveName}}",
description: "教会一只宝可梦{{moveName}}",
description: "使一只宝可梦学习招式:\n{{moveName}}",
},
"EvolutionItemModifierType": {
description: "使某些宝可梦进化",
Expand Down
4 changes: 2 additions & 2 deletions src/locales/zh_CN/party-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SimpleTranslationEntries } from "#app/plugins/i18n";
* i18next.t(`partyUiHandler:too_many_item`, { pokemon_name: pokemon.name });
*/
export const partyUiHandler: SimpleTranslationEntries = {
"Do_what_with": "让这个宝可梦做什么?",
"Do_what_with": "选择这个宝可梦吗?",
"Select_a_move": "选择一个招式",
"Select_a_held_item_to_transfer": "选择将一个持有的道具转移",
"Select_another_Pokémon_to_splice": "选择别的宝可梦去拼接(splice)",
Expand Down Expand Up @@ -35,7 +35,7 @@ export const partyUiHandler: SimpleTranslationEntries = {
"Send_Out": "上场",
"Summary": "详细",
"Release": "放生",
"Apply": "支持",
"Apply": "应用",
"Teach": "教",
"Transfer": "转移",
"Cancel": "取消",
Expand Down
16 changes: 11 additions & 5 deletions src/phases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,8 @@ export class SummonPhase extends PartyMemberPokemonPhase {
this.scene.time.delayedCall(750, () => this.summon());
} else {
this.scene.pbTrayEnemy.hide();
this.scene.ui.showText(`${this.scene.currentBattle.trainer.getName(!(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER)} sent out\n${this.getPokemon().name}!`, null, () => this.summon());
// zh-cn this.scene.ui.showText(`${this.scene.currentBattle.trainer.getName(!(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER)} sent out\n${this.getPokemon().name}!`, null, () => this.summon());
this.scene.ui.showText(`${this.scene.currentBattle.trainer.getName(!(this.fieldIndex % 2) ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER)} 丢出了\n${this.getPokemon().name}!`, null, () => this.summon());
}
}

Expand Down Expand Up @@ -3512,7 +3513,8 @@ export class MoneyRewardPhase extends BattlePhase {

this.scene.addMoney(moneyAmount.value);

this.scene.ui.showText(`You got ₽${moneyAmount.value.toLocaleString('en-US')}\nfor winning!`, null, () => this.end(), null, true);
// this.scene.ui.showText(`You got ₽${moneyAmount.value.toLocaleString('en-US')}\nfor winning!`, null, () => this.end(), null, true);
this.scene.ui.showText(`你获得了 ₽${moneyAmount.value.toLocaleString('en-US')}!`, null, () => this.end(), null, true);
}
}

Expand Down Expand Up @@ -3603,7 +3605,8 @@ export class GameOverPhase extends BattlePhase {
if (this.victory || !this.scene.enableRetries)
this.handleGameOver();
else {
this.scene.ui.showText(`Would you like to retry from the start of the battle?`, null, () => {
this.scene.ui.showText(`是否要重新战斗,再试一次?`, null, () => {
// this.scene.ui.showText(`Would you like to retry from the start of the battle?`, null, () => {
this.scene.ui.setMode(Mode.CONFIRM, () => {
this.scene.ui.fadeOut(1250).then(() => {
this.scene.reset();
Expand Down Expand Up @@ -4191,7 +4194,8 @@ export class PokemonHealPhase extends CommonAnimPhase {
pokemon.resetStatus();
pokemon.updateInfo().then(() => super.end());
} else if (this.showFullHpMessage)
this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);
// this.message = getPokemonMessage(pokemon, `'s\nHP is full!`);
this.message = getPokemonMessage(pokemon, `的\nHP 满了!`);

if (this.message)
this.scene.queueMessage(this.message);
Expand Down Expand Up @@ -4418,7 +4422,9 @@ export class AttemptCapturePhase extends PokemonPhase {
Promise.all([ pokemon.hideInfo(), this.scene.gameData.setPokemonCaught(pokemon) ]).then(() => {
if (this.scene.getParty().length === 6) {
const promptRelease = () => {
this.scene.ui.showText(`Your party is full.\nRelease a Pokémon to make room for ${pokemon.name}?`, null, () => {
//zh-cn this.scene.ui.showText(`Your party is full.\nRelease a Pokémon to make room for ${pokemon.name}?`, null, () => {

this.scene.ui.showText(`你的队伍满了\n是否放生一只为了 ${pokemon.name}?`, null, () => {
this.scene.ui.setMode(Mode.CONFIRM, () => {
this.scene.ui.setMode(Mode.PARTY, PartyUiMode.RELEASE, this.fieldIndex, (slotIndex: integer, _option: PartyOption) => {
this.scene.ui.setMode(Mode.MESSAGE).then(() => {
Expand Down
11 changes: 7 additions & 4 deletions src/plugins/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ export function initI18n(): void {
isInitialized = true;
let lang = '';

if (localStorage.getItem('prLang'))
if (localStorage.getItem('prLang')) {
lang = localStorage.getItem('prLang');
} else {
lang = "zh_CN"
}



Expand Down Expand Up @@ -100,6 +103,9 @@ export function initI18n(): void {
escapeValue: false,
},
resources: {
zh_CN: {
...zhCnConfig
},
en: {
...enConfig
},
Expand All @@ -117,9 +123,6 @@ export function initI18n(): void {
},
pt_BR: {
...ptBrConfig
},
zh_CN: {
...zhCnConfig
}
},
});
Expand Down
3 changes: 2 additions & 1 deletion src/system/game-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,8 @@ export class GameData {

if (newCatch && speciesStarters.hasOwnProperty(species.speciesId)) {
this.scene.playSound('level_up_fanfare');
this.scene.ui.showText(`${species.name} has been\nadded as a starter!`, null, () => checkPrevolution(), null, true);
// this.scene.ui.showText(`${species.name} has been\nadded as a starter!`, null, () => checkPrevolution(), null, true);
this.scene.ui.showText(`${species.name} 已加入队伍!`, null, () => checkPrevolution(), null, true);
} else
checkPrevolution();
});
Expand Down
8 changes: 4 additions & 4 deletions src/system/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
label: 'English',
handler: () => changeLocaleHandler('en')
},
{
label: '简体中文',
handler: () => changeLocaleHandler('zh_CN')
},
{
label: 'Español',
handler: () => changeLocaleHandler('es')
Expand All @@ -216,10 +220,6 @@ export function setSetting(scene: BattleScene, setting: Setting, value: integer)
label: 'Português (BR)',
handler: () => changeLocaleHandler('pt_BR')
},
{
label: '简体中文',
handler: () => changeLocaleHandler('zh_CN')
},
{
label: 'Cancel',
handler: () => cancelHandler()
Expand Down
12 changes: 8 additions & 4 deletions src/ui/party-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -970,13 +970,16 @@ class PartySlot extends Phaser.GameObjects.Container {
let slotTmText: string;
switch (true) {
case (this.pokemon.compatibleTms.indexOf(tmMoveId) === -1):
slotTmText = 'Not Able';
// zh-cn slotTmText = 'Not Able';
slotTmText = '不可用';
break;
case (this.pokemon.getMoveset().filter(m => m?.moveId === tmMoveId).length > 0):
slotTmText = 'Learned';
// zh-cn slotTmText = 'Learned';
slotTmText = '已学习';
break;
default:
slotTmText = 'Able';
// zh-cn slotTmText = 'Able';
slotTmText = '可用';
break;
}

Expand Down Expand Up @@ -1048,7 +1051,8 @@ class PartyCancelButton extends Phaser.GameObjects.Container {

this.partyCancelPb = partyCancelPb;

const partyCancelText = addTextObject(this.scene, -7, -6, 'Cancel', TextStyle.PARTY);
// zh-cn const partyCancelText = addTextObject(this.scene, -7, -6, 'Cancel', TextStyle.PARTY);
const partyCancelText = addTextObject(this.scene, -7, -6, '取消', TextStyle.PARTY);
this.add(partyCancelText);
}

Expand Down
39 changes: 21 additions & 18 deletions src/ui/settings-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { TextStyle, addTextObject } from "./text";
import { Mode } from "./ui";
import UiHandler from "./ui-handler";
import { addWindow } from "./ui-theme";
import {Button} from "../enums/buttons";
import { Button } from "../enums/buttons";
import i18next from "i18next";

export default class SettingsUiHandler extends UiHandler {
private settingsContainer: Phaser.GameObjects.Container;
Expand Down Expand Up @@ -34,7 +35,7 @@ export default class SettingsUiHandler extends UiHandler {

setup() {
const ui = this.getUi();

this.settingsContainer = this.scene.add.container(1, -(this.scene.game.canvas.height / 6) + 1);

this.settingsContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, this.scene.game.canvas.width / 6, this.scene.game.canvas.height / 6), Phaser.Geom.Rectangle.Contains);
Expand All @@ -56,8 +57,10 @@ export default class SettingsUiHandler extends UiHandler {

Object.keys(Setting).forEach((setting, s) => {
let settingName = setting.replace(/\_/g, ' ');
settingName = i18next.t(`menu:${settingName.replace(/\ /g, '_')}`)
if (reloadSettings.includes(Setting[setting]))
settingName += ' (Requires Reload)';
// settingName += ' (Requires Reload)';
settingName += i18next.t('menu:Requires_Reload');

this.settingLabels[s] = addTextObject(this.scene, 8, 28 + s * 16, settingName, TextStyle.SETTINGS_LABEL);
this.settingLabels[s].setOrigin(0, 0);
Expand All @@ -75,7 +78,7 @@ export default class SettingsUiHandler extends UiHandler {

const totalWidth = this.optionValueLabels[s].map(o => o.width).reduce((total, width) => total += width, 0);

const labelWidth = Math.max(78, this.settingLabels[s].displayWidth + 8);
const labelWidth = Math.max(78, this.settingLabels[s].displayWidth + 8);

const totalSpace = (300 - labelWidth) - totalWidth / 6;
const optionSpacing = Math.floor(totalSpace / (this.optionValueLabels[s].length - 1));
Expand Down Expand Up @@ -105,7 +108,7 @@ export default class SettingsUiHandler extends UiHandler {

show(args: any[]): boolean {
super.show(args);

const settings: object = localStorage.hasOwnProperty('settings') ? JSON.parse(localStorage.getItem('settings')) : {};

Object.keys(settingDefaults).forEach((setting, s) => this.setOptionCursor(s, settings.hasOwnProperty(setting) ? settings[setting] : settingDefaults[setting]));
Expand Down Expand Up @@ -150,12 +153,12 @@ export default class SettingsUiHandler extends UiHandler {
else
success = this.setScrollCursor(this.scrollCursor - 1);
} else {
// When at the top of the menu and pressing UP, move to the bottommost item.
// First, set the cursor to the last visible element, preparing for the scroll to the end.
const successA = this.setCursor(rowsToDisplay - 1);
// Then, adjust the scroll to display the bottommost elements of the menu.
const successB = this.setScrollCursor(this.optionValueLabels.length - rowsToDisplay);
success = successA && successB; // success is just there to play the little validation sound effect
// When at the top of the menu and pressing UP, move to the bottommost item.
// First, set the cursor to the last visible element, preparing for the scroll to the end.
const successA = this.setCursor(rowsToDisplay - 1);
// Then, adjust the scroll to display the bottommost elements of the menu.
const successB = this.setScrollCursor(this.optionValueLabels.length - rowsToDisplay);
success = successA && successB; // success is just there to play the little validation sound effect
}
break;
case Button.DOWN:
Expand All @@ -165,12 +168,12 @@ export default class SettingsUiHandler extends UiHandler {
else if (this.scrollCursor < this.optionValueLabels.length - rowsToDisplay)
success = this.setScrollCursor(this.scrollCursor + 1);
} else {
// When at the bottom of the menu and pressing DOWN, move to the topmost item.
// First, set the cursor to the first visible element, resetting the scroll to the top.
const successA = this.setCursor(0);
// Then, reset the scroll to start from the first element of the menu.
const successB = this.setScrollCursor(0);
success = successA && successB; // Indicates a successful cursor and scroll adjustment.
// When at the bottom of the menu and pressing DOWN, move to the topmost item.
// First, set the cursor to the first visible element, resetting the scroll to the top.
const successA = this.setCursor(0);
// Then, reset the scroll to start from the first element of the menu.
const successB = this.setScrollCursor(0);
success = successA && successB; // Indicates a successful cursor and scroll adjustment.
}
break;
case Button.LEFT:
Expand Down Expand Up @@ -269,7 +272,7 @@ export default class SettingsUiHandler extends UiHandler {
if (this.reloadRequired) {
this.reloadRequired = false;
this.scene.reset(true, false, true);
}
}
}

eraseCursor() {
Expand Down
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ export function executeIf<T>(condition: boolean, promiseFunc: () => Promise<T>):

export const sessionIdKey = 'pokerogue_sessionId';
export const isLocal = window.location.hostname === 'localhost' || window.location.hostname === '';
// export const isLocal =true
export const serverUrl = isLocal ? 'http://localhost:8001' : '';
export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net';
export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.cn';

export function setCookie(cName: string, cValue: string): void {
const expiration = new Date();
Expand Down

0 comments on commit 631ccee

Please sign in to comment.