ui模块优化 全部navigationmanager管理

实现pastgirllistpanel逻辑
完善图集
This commit is contained in:
2025-09-21 12:05:34 +08:00
parent 8e82ebf724
commit 7722ccf694
65 changed files with 773 additions and 2280 deletions
@@ -17,6 +17,7 @@ import { GirlData } from "../../data/GirlData";
import { EnvData } from "../../data/EnvData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import { GButton } from "../../../Main/Common/GButton";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@ccclass("ImagePopup")
@@ -105,9 +106,9 @@ export class ImagePopup extends Component {
url: girlData.getGrilPhotoPic(this.categoryId, this.girlId, this.resId),
isImg: true,
};
ViewManager.I.openBundlesView("ShowPanel", data);
NavigationManager.Instance.openPopupPanel("ShowPanel", data);
} else {
ViewManager.I.openBundlesView("PopupGirlDetailPanel", {
NavigationManager.Instance.openPopupPanel("PopupGirlDetailPanel", {
category: this.categoryId,
resId: this.resId,
girlId: this.girlId,
@@ -168,7 +168,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
);
if (!isFree && !isRelease) {
//未解锁
ViewManager.I.openBundlesPopupView("GirlListPopupPanel", {
NavigationManager.Instance.openPopupPanel("GirlListPopupPanel", {
base: this,
category: this.categoryId,
id: this.id,
@@ -507,7 +507,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
}
onClickRecord() {
ViewManager.I.openBundlesView("RecordPanel", this.id);
NavigationManager.Instance.openPopupPanel("RecordPanel", this.id);
}
/**
@@ -15,7 +15,7 @@ export class NavigationPanel extends li_BaseView {
private themeBtn: NavigationBtn;
private girlDetailBtn: NavigationBtn;
private chatBtn: NavigationBtn;
private pastGirlListBtn: NavigationBtn;
private settingBtn: NavigationBtn;
private loadingView: Node;
@@ -26,7 +26,7 @@ export class NavigationPanel extends li_BaseView {
this.themeBtn = this._nodeTab.themeBtn.getComponent(NavigationBtn);
this.girlDetailBtn =
this._nodeTab.girlDetailBtn.getComponent(NavigationBtn);
this.chatBtn = this._nodeTab.chatBtn.getComponent(NavigationBtn);
this.pastGirlListBtn = this._nodeTab.chatBtn.getComponent(NavigationBtn);
this.settingBtn = this._nodeTab.settingBtn.getComponent(NavigationBtn);
this.loadingView = this._nodeTab.loadingView;
@@ -36,7 +36,7 @@ export class NavigationPanel extends li_BaseView {
NavigationManager.Instance.registerNavigationPanel(this);
this.registerListener();
this.updateButtonStates(PanelType.THEME);
this.updateButtonStates(PanelType.PAST_GIRL_LIST);
// 初次打开时通过NavigationManager切换到主题面板
this.initializeFirstPanel();
@@ -57,8 +57,8 @@ export class NavigationPanel extends li_BaseView {
this
);
GButton.BandClick(
this.chatBtn.node,
() => NavigationManager.Instance.switchToPanel(PanelType.CHAT),
this.pastGirlListBtn.node,
() => NavigationManager.Instance.switchToPanel(PanelType.PAST_GIRL_LIST),
this
);
GButton.BandClick(
@@ -101,13 +101,13 @@ export class NavigationPanel extends li_BaseView {
this.girlDetailBtn.setFocus(
this.currentActivePanel === PanelType.GIRL_DETAIL
);
this.chatBtn.setFocus(this.currentActivePanel === PanelType.CHAT);
this.pastGirlListBtn.setFocus(this.currentActivePanel === PanelType.PAST_GIRL_LIST);
this.settingBtn.setFocus(this.currentActivePanel === PanelType.PERSONAL);
}
private initializeFirstPanel() {
// 初次打开时通过NavigationManager切换到主题面板
NavigationManager.Instance.switchToPanel(PanelType.THEME, true);
// 初次打开时通过NavigationManager切换到历史女孩列表面板
NavigationManager.Instance.switchToPanel(PanelType.PAST_GIRL_LIST, true);
}
public showPanel() {
@@ -294,6 +294,6 @@ export class RecordPanel extends li_BaseView {
*/
returnBtn() {
this.onClose();
ViewManager.I.closeView(this.node);
this.close(); // 使用li_BaseView的close方法
}
}
+2 -44
View File
@@ -53,7 +53,6 @@ export class ThemePanel extends li_BaseView {
cache: ThemeItem[] = [];
// 子页面管理
private listPanel: GirlListPanel = null;
// 加载状态保护
private isLoading: boolean = false;
@@ -209,7 +208,7 @@ export class ThemePanel extends li_BaseView {
for (let id of themeIds) {
let newNode = instantiate(this.itemInst.node);
let item = newNode.getComponent(ThemeItem);
item.refresh(id, this);
item.refresh(id, this.node);
newNode.active = true;
this.cache.push(item);
this.content.addChild(newNode);
@@ -320,17 +319,11 @@ export class ThemePanel extends li_BaseView {
} else {
//未解锁
NavigationManager.Instance.openSubPanel("GirlListPopupPanel", this.node, {
NavigationManager.Instance.openPopupPanel("GirlListPopupPanel", {
base: this,
category: girlData.getGrilCategoryById(this.recId),
id: this.recId,
});
// ViewManager.I.openBundlesPopupView("GirlListPopupPanel", {
// base: this,
// category: girlData.getGrilCategoryById(this.recId),
// id: this.recId,
// });
}
}
@@ -394,43 +387,11 @@ export class ThemePanel extends li_BaseView {
}
}
public getChildPanel(): GirlListPanel {
if (this.listPanel) return this.listPanel;
return null;
}
public setChildPanel(panel: GirlListPanel) {
this.listPanel = panel;
}
/**
* 隐藏子页面
*/
public hideChildPanel(): void {
if (this.listPanel) {
console.log("[ThemePanel] Closing child panel");
if (this.listPanel.hide) {
this.listPanel.hide();
}
}
}
/**
* 关闭子页面
*/
public clostChildPanel(): void {
if (this.listPanel) {
console.log("[ThemePanel] Closing child panel");
if (this.listPanel.close) {
this.listPanel.close();
}
this.listPanel = null;
}
}
/**
* 页面被隐藏时调用
*/
public onHide(): void {
console.log("[ThemePanel] onHide called");
this.hideChildPanel();
this.cancelCurrentOperation();
}
@@ -451,9 +412,6 @@ export class ThemePanel extends li_BaseView {
// 取消当前操作
this.cancelCurrentOperation();
// 关闭子页面
this.clostChildPanel();
// 清理缓存
this.clearCache();