From 650b34d8dfe8b6aa9a6b7f3bcf0c46abf5336c86 Mon Sep 17 00:00:00 2001 From: xlj <543978819@qq.com> Date: Mon, 22 Sep 2025 19:50:34 +0800 Subject: [PATCH] update --- .../chat18x/manager/NavigationManager.ts | 69 +------------------ .../chat18x/ui/panels/PastGirlListPanel.ts | 23 +++++-- 2 files changed, 19 insertions(+), 73 deletions(-) diff --git a/assets/Scripts/chat18x/manager/NavigationManager.ts b/assets/Scripts/chat18x/manager/NavigationManager.ts index 191bba16..341a8e48 100644 --- a/assets/Scripts/chat18x/manager/NavigationManager.ts +++ b/assets/Scripts/chat18x/manager/NavigationManager.ts @@ -366,74 +366,6 @@ export class NavigationManager { ViewManager.I.openBundlesView(panelName, data, callback); } - /** - * 支持自定义动画方向的面板切换方法 - * @param panelType 目标面板类型 - * @param transitionConfig 过渡动画配置 - * @param force 是否强制切换 - */ - public switchToPanelWithTransition( - panelType: PanelType, - transitionConfig: PageTransitionConfig, - force: boolean = false - ): Node { - if (!panelType) { - logger.error( - "[NavigationManager] switchToPanelWithTransition: panelType is invalid" - ); - return null; - } - - if (this.currentActivePanelType === panelType && !force) { - logger.log( - `[NavigationManager] Already on ${panelType}, skipping switch` - ); - return this.currentActivePanel; - } - - if (!this.navigationPanel) { - logger.warn( - "[NavigationManager] NavigationPanel not registered, fallback to direct ViewManager call" - ); - return null; - } - - // 切换面板前先关闭所有弹窗 - this.closeAllPopups(); - - // 通知NavigationPanel显示加载状态 - this.navigationPanel.showLoading?.(); - - // 获取动画方向 - const hideDirection = this.getDirectionFromTransitionType( - transitionConfig.outgoingTransition - ); - const showDirection = this.getDirectionFromTransitionType( - transitionConfig.incomingTransition - ); - - // 隐藏当前面板(包括子页面) - if (this.currentActivePanel && this.currentActivePanel.isValid) { - this.hidePanelWithAnimation(this.currentActivePanel, hideDirection); - } - - // 加载并显示目标面板 - this.loadOrGetPanel(panelType, (panel: Node) => { - this.currentActivePanelType = panelType; - - // 更新NavigationPanel按钮状态 - this.navigationPanel.updateButtonStates?.(panelType); - - // 显示面板 - this.showPanelWithAnimation(panel, showDirection, () => { - this.currentActivePanel = panel; - this.navigationPanel.hideLoading?.(); - }); - }); - - return null; - } - /** * 将过渡类型转换为方向字符串 */ @@ -877,6 +809,7 @@ export class NavigationManager { } panel.active = true; + panel.getComponent(li_BaseView) switch (direction) { case "left": diff --git a/assets/Scripts/chat18x/ui/panels/PastGirlListPanel.ts b/assets/Scripts/chat18x/ui/panels/PastGirlListPanel.ts index abab4942..b92ff1c3 100644 --- a/assets/Scripts/chat18x/ui/panels/PastGirlListPanel.ts +++ b/assets/Scripts/chat18x/ui/panels/PastGirlListPanel.ts @@ -68,11 +68,11 @@ export class PastGirlListPanel extends li_BaseView { item.reset(); } } + protected onEnable(): void { this.refresh(); } - // TODO: 实现获取已解锁女孩列表的逻辑 - // 这个方法需要遍历所有分类,找出 isRelease === true 的女孩 + private async getUnlockedGirls(): Promise { await this.reqCanChatGirlData(); @@ -82,7 +82,23 @@ export class PastGirlListPanel extends li_BaseView { return allids; } + cacheIds: number[]; async refresh() { + // 获取已解锁女孩列表 + const ids = await this.getUnlockedGirls(); + + if (this.cacheIds && ids && this.cacheIds.length == ids.length) { + let isSame = true; + for (let i = 0; i < ids.length; i++) { + const element = ids[i]; + if (this.cacheIds[i] != element) { + isSame = false; + break; + } + } + if (isSame) return; + } + // 回收当前显示的节点到缓存池 if (this.cache) { for (let i = this.cache.length - 1; i >= 0; i--) { @@ -92,9 +108,6 @@ export class PastGirlListPanel extends li_BaseView { this.cache = []; } - // 获取已解锁女孩列表 - const ids = await this.getUnlockedGirls(); - // 根据排序后的数据刷新界面 for (let id of ids) { let item = this.getItemFromPool();