模拟主题数据

This commit is contained in:
chen wei bo
2025-09-02 11:33:55 +08:00
parent 9396e70700
commit aacd18ee21
5 changed files with 69 additions and 29 deletions
+17 -7
View File
@@ -18,6 +18,9 @@ import { ConfigManager } from "../../manager/ConfigManager";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { ViewManager } from "../../../Main/Manager/ViewManager";
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
import { ThemeService } from "db://assets/Scripts/chat18x/network/services/ThemeService";
import { DataManager, DataId } from "../../data/DataManager";
import { ThemeData } from "../../data/ThemeData";
const { ccclass, property } = _decorator;
@@ -51,7 +54,7 @@ export class ThemePanel extends li_BaseView {
}
rectNameKey: string;
Show() {
async Show() {
//some temp data
this.coinNum.string = (50.0).toString();
this.recId = 1;
@@ -60,16 +63,23 @@ export class ThemePanel extends li_BaseView {
this.cache[i].node.destroy();
}
}
const cfgs = ConfigManager.tables.TbThemes.getDataList();
for (let i = 0; i < cfgs.length; i++) {
const cfg = cfgs[i];
if (!cfg) return;
// 请求主题数据
const reqData = {
};
let res = await ThemeService.I.reqHallTheme(reqData);
// 保存数据
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
themeData.themes = res.data;
// 根据数据,构建界面显示
const themeIds = themeData.themeIds;
for (let id of themeIds) {
let newNode = instantiate(this.itemInst.node);
let item = newNode.getComponent(ThemeItem);
item.refresh(cfg);
item.refresh(id);
newNode.active = true;
this.cache.push(item);
this.content.addChild(newNode);
this.content.addChild(newNode);
}
const rectInfo = ConfigManager.tables.TbGirls.get(10001);
this.recId = rectInfo.id;