Skip to content

Update Lang.ts #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resource/skins/multiCustomRoom/McrJoinMapListPanel.exml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</GameUi:UiButton>
<GameUi:UiLabel id="_labelName" text="地图名称" x="10" size="16" verticalCenter="0"
textColor.down="0x00ff00" maxTextWidth="150" />
<GameUi:UiLabel id="_labelPassword" text="密码" x="5" size="10" y="0" textColor="0xff0000" />
<GameUi:UiLabel id="_labelIfPrivateRoom" text="私人房间" x="5" size="10" y="0" textColor="0xff0000" />
<GameUi:UiButton id="_btnNext" label="&gt;&gt;" x="160" verticalCenter="0" visible.up="false">
<e:skinName>
<e:Skin states="up,down,disabled">
Expand Down
12 changes: 6 additions & 6 deletions resource/skins/multiCustomRoom/McrJoinPasswordPanel.exml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<e:Skin width="960" height="540" xmlns:e="http://ns.egret.com/eui" xmlns:GameUi="TinyWars.GameUi.*"
xmlns:w="http://ns.egret.com/wing">
<e:Group width="360" height="200" horizontalCenter="0" verticalCenter="0">
<e:Group width="400" height="200" horizontalCenter="0" verticalCenter="0">
<GameUi:UiImage source="c04_t01_s02_f01" scale9Grid="9,9,2,2" anchorOffsetX="0" anchorOffsetY="0"
alpha="0.8" left="0" right="0" top="0" bottom="0" />
<GameUi:UiLabel text="请输入房间密码" textColor="0xffffff" y="12" horizontalCenter="0" size="24" />
<GameUi:UiLabel text="房间:" textColor="0xFFFFFF" y="60" size="20" x="60" />
<GameUi:UiLabel text="密码:" textColor="0xFFFFFF" y="110" size="20" x="60" />
<GameUi:UiLabel id="_labelWarName" text="房间名称" textColor="0xFFFFFF" y="60" size="20" x="120" />
<GameUi:UiTextInput id="_inputWarPassword" width="140" x="120" y="105" anchorOffsetX="0" anchorOffsetY="0"
<GameUi:UiLabel id="_labelTitle" text="请输入房间密码" textColor="0xffffff" y="12" horizontalCenter="0" size="24" />
<GameUi:UiLabel id="_labelWarNameTitle" text="房间名称:" textColor="0xFFFFFF" y="60" size="20" textAlign="right" maxTextWidth="120" left="60"/>
<GameUi:UiLabel id="_inputWarPasswordTitle" text="房间密码:" textColor="0xFFFFFF" y="110" size="20" textAlign="right" maxTextWidth="120" left="60"/>
<GameUi:UiLabel id="_labelWarName" text="房间名称" textColor="0xFFFFFF" y="60" size="20" x="160" />
<GameUi:UiTextInput id="_inputWarPassword" width="140" x="160" y="105" anchorOffsetX="0" anchorOffsetY="0"
restrict="0-9" maxChars="4">
<GameUi:skinName>
<e:Skin width="100" height="30">
Expand Down
11 changes: 6 additions & 5 deletions src/modules/multiCustomRoom/view/McrJoinMapListPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ namespace TinyWars.MultiCustomRoom {
}

class WarRenderer extends eui.ItemRenderer {
private _btnChoose : GameUi.UiButton;
private _btnNext : GameUi.UiButton;
private _labelName : GameUi.UiLabel;
private _labelPassword : GameUi.UiLabel;
private _btnChoose : GameUi.UiButton;
private _btnNext : GameUi.UiButton;
private _labelName : GameUi.UiLabel;
private _labelIfPrivateRoom : GameUi.UiLabel;

protected childrenCreated(): void {
super.childrenCreated();
Expand All @@ -260,7 +260,8 @@ namespace TinyWars.MultiCustomRoom {
const data = this.data as DataForWarRenderer;
const warInfo = data.warInfo;
this.currentState = data.index === data.panel.getSelectedIndex() ? Types.UiState.Down : Types.UiState.Up;
this._labelPassword.visible = (warInfo.warPassword != null) && (warInfo.warPassword.length > 0);
this._labelIfPrivateRoom.visible = (warInfo.warPassword != null) && (warInfo.warPassword.length > 0);
this._labelIfPrivateRoom.text = Lang.getText(Lang.Type.B0406);
if (warInfo.warName) {
this._labelName.text = warInfo.warName;
} else {
Expand Down
35 changes: 30 additions & 5 deletions src/modules/multiCustomRoom/view/McrJoinPasswordPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ namespace TinyWars.MultiCustomRoom {

private static _instance: McrJoinPasswordPanel;

private _inputWarPassword : GameUi.UiLabel;
private _labelWarName : GameUi.UiLabel;
private _btnConfirm : GameUi.UiButton;
private _btnCancel : GameUi.UiButton;
private _inputWarPasswordTitle : GameUi.UiLabel;
private _inputWarPassword : GameUi.UiLabel;
private _labelWarNameTitle : GameUi.UiLabel;
private _labelWarName : GameUi.UiLabel;
private _btnConfirm : GameUi.UiButton;
private _btnCancel : GameUi.UiButton;

private _openData: ProtoTypes.IMcrWaitingInfo;

Expand All @@ -44,6 +46,9 @@ namespace TinyWars.MultiCustomRoom {
}

protected _onFirstOpened(): void {
this._notifyListeners = [
{ type: Notify.Type.LanguageChanged, callback: this._onNotifyLanguageChanged },
];
this._uiListeners = [
{ ui: this._btnCancel, callback: this._onTouchedBtnCancel },
{ ui: this._btnConfirm, callback: this._onTouchedBtnConfirm },
Expand All @@ -52,8 +57,12 @@ namespace TinyWars.MultiCustomRoom {

protected _onOpened(): void {
this._updateView();
this._updateComponentsForLanguage();
}

////////////////////////////////////////////////////////////////////////////////
// Callbacks.
////////////////////////////////////////////////////////////////////////////////
private _onTouchedBtnHelpFog(e: egret.TouchEvent): void {
HelpPanel.show({
title : Lang.getText(Lang.Type.B0020),
Expand All @@ -72,6 +81,10 @@ namespace TinyWars.MultiCustomRoom {
McrJoinPasswordPanel.hide();
}

private _onNotifyLanguageChanged(e: egret.Event): void {
this._updateComponentsForLanguage();
}

private async _onTouchedBtnConfirm(e: egret.TouchEvent): Promise<void> {
if (this._inputWarPassword.text !== this._openData.warPassword) {
FloatText.show(Lang.getText(Lang.Type.A0017));
Expand All @@ -83,7 +96,18 @@ namespace TinyWars.MultiCustomRoom {
McrJoinSettingsPanel.show();
}
}


////////////////////////////////////////////////////////////////////////////////
// Private functions.
////////////////////////////////////////////////////////////////////////////////
private _updateComponentsForLanguage(): void {
this._labelTitle.text = Lang.getText(Lang.Type.A0131);
this._inputWarPasswordTitle.text = Lang.getText(Lang.Type.B0186);
this._labelWarNameTitle.text = Lang.getText(Lang.Type.B0185);
this._btnConfirm.text = `${Lang.getText(Lang.Type.B0026)}:`;
this._btnCancel.text = `${Lang.getText(Lang.Type.B0154)}:`;
}

private _updateView(): void {
const info = this._openData;
this._inputWarPassword.text = "";
Expand All @@ -93,5 +117,6 @@ namespace TinyWars.MultiCustomRoom {
WarMapModel.getMapNameInLanguage(info.mapFileName).then(v => this._labelWarName.text = v);
}
}

}
}
8 changes: 8 additions & 0 deletions src/utility/Lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,10 @@ namespace TinyWars.Utility.Lang {
`您确定要切换该部队的下潜状态吗?`,
`Are you sure to switch the unit's diving state?`,
],
[Type.A0131]: [
`请输入房间密码`,
`Please enter the password`,
],

////////////////////////////////////////////////////////////////////////////////////////////////////
// Short strings.
Expand Down Expand Up @@ -2106,6 +2110,10 @@ namespace TinyWars.Utility.Lang {
`公共(中文)`,
`Public(CN)`,
],
[Type.B0406]: [
`私人房间`,
`Private Room`,
],

////////////////////////////////////////////////////////////////////////////////////////////////////
[Type.B1000]: [
Expand Down