多语言模块

This commit is contained in:
2025-08-12 19:49:50 +08:00
parent 83370bd0ef
commit 707946304e
43 changed files with 1977 additions and 1305 deletions
+17 -2
View File
@@ -4,6 +4,8 @@ import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
import Utils from "db://assets/Scripts/Main/Common/Utils";
import { NavigationManager } from "../../manager/NavigationManager";
import { TbThemes, Theme } from "../../../schema/schema";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
const { ccclass, property } = _decorator;
@ccclass("ThemeItem")
@@ -19,11 +21,24 @@ export class ThemeItem extends Component {
private category: number;
private isLocked: boolean;
start() {}
key: string;
protected onLoad(): void {
Utils.addInnerEL(InnerMsgCode.LanguageChange, this, () => {
this.titleName.string = LanguageUtils.getText(this.key);
});
}
protected onDestroy(): void {
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, () => {
this.titleName.string = LanguageUtils.getText(this.key);
});
}
refresh(themeData: Theme) {
this.lockImg.node.active = !themeData.isRelease;
this.isLocked = !themeData.isRelease;
this.titleName.string = themeData.name;
this.key = themeData.key;
this.titleName.string = LanguageUtils.getText(themeData.key);
this.category = themeData.category;
ResManager.I.changeBundleSpriteFrame(
this.img,