update PastGirlListPanel.prefab
This commit is contained in:
@@ -27,6 +27,7 @@ import { TipsPanel } from "./TipsPanel";
|
||||
import ResManager from "../../../Main/Manager/ResManager";
|
||||
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
|
||||
import { logger } from "db://assets/Scripts/Main/Common/Logger";
|
||||
import { GirlDetailPanel } from "./GirlDetailPanel";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -41,7 +42,7 @@ export class GirlListPopupPanel extends li_BaseView {
|
||||
private girlTag: Label;
|
||||
private balanceCount: Label;
|
||||
|
||||
base: GirlListItem;
|
||||
base: GirlDetailPanel;
|
||||
img: Sprite;
|
||||
uitransform: UITransform;
|
||||
openUIDataCT(data) {
|
||||
@@ -119,7 +120,7 @@ export class GirlListPopupPanel extends li_BaseView {
|
||||
walletData.balance = Number(resData.balance);
|
||||
walletData.vipExpire = Number(resData.vipExpire);
|
||||
// 刷新界面
|
||||
this.base.refreshBuy(true);
|
||||
this.base.refresh();
|
||||
this.close();
|
||||
TipsPanel.show("Buy Succeed");
|
||||
} else {
|
||||
|
||||
@@ -68,17 +68,21 @@ export class PastGirlListPanel extends li_BaseView {
|
||||
item.reset();
|
||||
}
|
||||
}
|
||||
|
||||
protected onEnable(): void {
|
||||
this.refresh();
|
||||
}
|
||||
// TODO: 实现获取已解锁女孩列表的逻辑
|
||||
// 这个方法需要遍历所有分类,找出 isRelease === true 的女孩
|
||||
private getUnlockedGirls(): number[] {
|
||||
private async getUnlockedGirls(): Promise<number[]> {
|
||||
await this.reqCanChatGirlData();
|
||||
|
||||
const GirlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
const allids = GirlData.getAllReleaseGirlIds();
|
||||
const allids = GirlData.getAllCanChatGirlIds();
|
||||
logger.log(allids);
|
||||
return allids;
|
||||
}
|
||||
|
||||
refresh() {
|
||||
async refresh() {
|
||||
// 回收当前显示的节点到缓存池
|
||||
if (this.cache) {
|
||||
for (let i = this.cache.length - 1; i >= 0; i--) {
|
||||
@@ -89,24 +93,12 @@ export class PastGirlListPanel extends li_BaseView {
|
||||
}
|
||||
|
||||
// 获取已解锁女孩列表
|
||||
const ids = this.getUnlockedGirls();
|
||||
|
||||
// 创建带时间戳的数组用于排序
|
||||
const girlsWithTime: { id: number; lastTime: number }[] = [];
|
||||
|
||||
// 收集每个女孩的最后聊天时间
|
||||
for (let id of ids) {
|
||||
const lastTime = ChatHistoryManager.Instance.getLastChatTime(id) || 0;
|
||||
girlsWithTime.push({ id, lastTime });
|
||||
}
|
||||
|
||||
// 按最后聊天时间降序排序(最近的在前)
|
||||
girlsWithTime.sort((a, b) => b.lastTime - a.lastTime);
|
||||
const ids = await this.getUnlockedGirls();
|
||||
|
||||
// 根据排序后的数据刷新界面
|
||||
for (let girlData of girlsWithTime) {
|
||||
for (let id of ids) {
|
||||
let item = this.getItemFromPool();
|
||||
item.refreshData(girlData.id, this.node);
|
||||
item.refreshData(id, this.node);
|
||||
item.node.active = true;
|
||||
this.cache.push(item);
|
||||
|
||||
@@ -142,7 +134,7 @@ export class PastGirlListPanel extends li_BaseView {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
girlData.setCanChatGirlData(resData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
// 清理缓存池,销毁所有缓存的节点
|
||||
|
||||
Reference in New Issue
Block a user