多语言配置化

This commit is contained in:
2025-08-12 20:22:54 +08:00
parent 707946304e
commit dfa3179094
19 changed files with 3490 additions and 205 deletions
@@ -1,9 +0,0 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "35555c27-2be1-4310-9685-8944c2895a50",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -1,58 +0,0 @@
import { _decorator, Component, Node,Sprite ,UITransform} from 'cc';
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
import Utils from "db://assets/Scripts/Main/Common/Utils";
import {ViewManager} from "db://assets/Scripts/Main/Manager/ViewManager";
import {GButton} from "db://assets/Scripts/Main/Common/GButton";
const { ccclass, property } = _decorator;
interface ShowPanelData
{
url: string;
closeFunc:Function;
}
@ccclass('ShowPanel')
export class ShowPanel extends li_BaseView {
@property(Sprite)
image:Sprite;
@property(Sprite)
splash:Sprite;
url:string;
func:Function;
openUIDataCT(data:ShowPanelData) {
super.openUIDataCT(data);
this.url = data.url;
this.func = data.closeFunc;
}
onLoadCT() {
this.show(this.url);
}
start()
{
//this.splash.node.on(Node.EventType.TOUCH_START,this.onclickback);
GButton.BandClick(this.splash.node,this.onClose,this);
}
protected onClose() {
if(this.func)
{
this.func();
}
super.onClose();
}
show(path:string)
{
ResManager.I.changeBundleSpriteFrame(this.image,path,"Chat18x",()=>{
Utils.adjustBgPixelRatio(this.image.node,3);
});
}
}
@@ -1,9 +0,0 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "b7645da0-3b81-454b-8956-068491ce4706",
"files": [],
"subMetas": {},
"userData": {}
}
+17 -3
View File
@@ -16,6 +16,8 @@ import { NavigationManager } from "../../manager/NavigationManager";
import { GirlListItem } from "./GirlListItem";
import ConfigManager from "../../manager/ConfigManager";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { ViewManager } from "../../../Main/Manager/ViewManager";
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
const { ccclass, property } = _decorator;
@@ -48,6 +50,7 @@ export class ThemePanel extends li_BaseView {
this.Show();
}
rectNameKey: string;
Show() {
//some temp data
this.coinNum.string = (50.0).toString();
@@ -68,10 +71,11 @@ export class ThemePanel extends li_BaseView {
this.cache.push(item);
this.content.addChild(newNode);
}
const rectInfo = cfgs[0];
this.recId = rectInfo.id;
this.recName.string = rectInfo.name;
this.rectNameKey = rectInfo.key;
//this.recName.string = LanguageUtils.getText(this.rectNameKey);
ResManager.I.changeBundleSpriteFrame(
this.recSprite,
rectInfo.path,
@@ -92,6 +96,10 @@ export class ThemePanel extends li_BaseView {
GButton.BandClick(this._nodeTab.msgBoxBtn, this.openMsgBox, this);
GButton.BandClick(this._nodeTab.ChatWithRecBtn, this.chatWithRec, this);
Utils.addInnerEL(InnerMsgCode.LanguageChange, this, () => {
this.recName.string = LanguageUtils.getText(this.rectNameKey);
});
}
chatWithRec() {
@@ -99,10 +107,16 @@ export class ThemePanel extends li_BaseView {
}
openSetting() {
console.log("Setting");
ViewManager.I.openBundlesView("LanguagePanel");
}
openMsgBox() {
console.log("打开信箱");
}
onDestroy(): void {
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, () => {
this.recName.string = LanguageUtils.getText(this.rectNameKey);
});
}
}