This commit is contained in:
2025-09-22 19:50:34 +08:00
parent 556194f24a
commit 650b34d8df
2 changed files with 19 additions and 73 deletions
@@ -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":
@@ -68,11 +68,11 @@ export class PastGirlListPanel extends li_BaseView {
item.reset();
}
}
protected onEnable(): void {
this.refresh();
}
// TODO: 实现获取已解锁女孩列表的逻辑
// 这个方法需要遍历所有分类,找出 isRelease === true 的女孩
private async getUnlockedGirls(): Promise<number[]> {
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();