update
This commit is contained in:
@@ -30,25 +30,13 @@ export class GirlListPanel extends li_BaseView {
|
||||
category: number;
|
||||
private parentPanelName: string = null;
|
||||
|
||||
openUIDataCT(data) {
|
||||
console.log("[GirlListPanel] openUIDataCT called with data:", data);
|
||||
|
||||
// 支持新的数据格式:既可以是单纯的数字,也可以是包含主题ID和父页面信息的对象
|
||||
if (typeof data === "object") {
|
||||
this.category = data.themeId;
|
||||
this.parentPanelName = data.parentPanel;
|
||||
console.log("[GirlListPanel] Set parent panel:", this.parentPanelName);
|
||||
} else {
|
||||
this.category = data;
|
||||
}
|
||||
}
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
this.registerListener();
|
||||
this.itemInst = this._nodeTab.BubbleItem.getComponent(GirlListItem);
|
||||
this.itemInst.node.active = false;
|
||||
this.content = this._nodeTab.content;
|
||||
this.refresh(this.category);
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
cacheCategory: number = -1;
|
||||
@@ -68,7 +56,7 @@ export class GirlListPanel extends li_BaseView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 没有可复用的节点,创建新节点
|
||||
let newNode = instantiate(this.itemInst.node);
|
||||
let item = newNode.getComponent(GirlListItem);
|
||||
@@ -88,7 +76,8 @@ export class GirlListPanel extends li_BaseView {
|
||||
}
|
||||
}
|
||||
|
||||
async refresh(category: number) {
|
||||
async refresh() {
|
||||
const category = NavigationManager.Instance.getSelectedCategoryId();
|
||||
if (category == this.cacheCategory) return;
|
||||
this.cacheCategory = category;
|
||||
|
||||
@@ -119,7 +108,7 @@ export class GirlListPanel extends li_BaseView {
|
||||
item.refreshData(category, id, this.node);
|
||||
item.node.active = true;
|
||||
this.cache.push(item);
|
||||
|
||||
|
||||
// 确保节点在 content 中(可能已经在了)
|
||||
if (item.node.parent !== this.content) {
|
||||
this.content.addChild(item.node);
|
||||
@@ -156,7 +145,7 @@ export class GirlListPanel extends li_BaseView {
|
||||
}
|
||||
}
|
||||
this.cache = [];
|
||||
|
||||
|
||||
// 清理 content 中所有的 GirlListItem 节点
|
||||
for (let i = this.content.children.length - 1; i >= 0; i--) {
|
||||
let child = this.content.children[i];
|
||||
|
||||
Reference in New Issue
Block a user