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
@@ -69,21 +69,17 @@ export class DetailImageItem extends Component {
},
};
if (this.url) {
ViewManager.I.openBundlesView("ShowPanel", data);
NavigationManager.Instance.openPopupPanel("ShowPanel", data);
this.base.setVideEnable(false);
}
} else {
NavigationManager.Instance.openSubPanel(
"PopupGirlDetailPanel",
this.base.node,
{
category: this.category,
resId: this.resId,
girlId: this.girlId,
base: this,
type: this.type,
}
);
NavigationManager.Instance.openPopupPanel("PopupGirlDetailPanel", {
category: this.category,
resId: this.resId,
girlId: this.girlId,
base: this,
type: this.type,
});
// ViewManager.I.openBundlesView("PopupGirlDetailPanel", {
// category: this.category,
@@ -216,16 +216,11 @@ export class GirlListItem extends Component {
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
} else {
//未解锁
NavigationManager.Instance.openSubPanel("GirlListPopupPanel", this.baseNode, {
NavigationManager.Instance.openPopupPanel("GirlListPopupPanel", {
base: this,
category: this.category,
id: this.id,
});
// ViewManager.I.openBundlesPopupView("GirlListPopupPanel", {
// base: this,
// category: this.category,
// id: this.id,
// });
}
}
}
@@ -8,6 +8,7 @@ import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData";
import { EnvData } from "../data/EnvData";
import { ChatHistoryManager } from "../manager/ChatHistoryManager";
const { ccclass, property } = _decorator;
@@ -63,11 +64,11 @@ export class PastGirlListItem extends Component {
);
}
refreshData( girlId: number, baseNode: Node) {
refreshData(girlId: number, baseNode: Node) {
if (!this.stars) {
this.stars = this.starParent.getComponentsInChildren(Sprite);
}
this.baseNode = baseNode;
this.id = girlId;
@@ -120,21 +121,13 @@ export class PastGirlListItem extends Component {
this.updateLastChatTime();
}
// TODO: 实现获取最近聊天时间的逻辑
// 需要从聊天记录中获取最后一条消息的时间戳
private getLastChatTime(category: number, id: number): number | null {
// TODO: 实现获取最近聊天时间的逻辑
// 需要实现的逻辑:
// 1. 获取该女孩的聊天记录
// 2. 找到最后一条消息的时间戳
// 3. 返回时间戳或null(如果没有聊天记录)
console.log("TODO: 实现获取最近聊天时间逻辑");
return null;
private getLastChatTime(id: number): number | null {
return ChatHistoryManager.Instance.getLastChatTime(id);
}
// 更新最近聊天时间显示
private updateLastChatTime() {
const lastTime = this.getLastChatTime(this.category, this.id);
const lastTime = this.getLastChatTime(this.id);
this.lastChatTime.string = Utils.formatChatTime(lastTime);
}
@@ -170,12 +163,17 @@ export class PastGirlListItem extends Component {
}
}
onClickDetail() {
// 由于都是已解锁的女孩,直接跳转到角色详情
onClickGirl() {
// 由于都是已解锁的女孩,直接打开聊天面板作为子面板
// 先设置选中的角色ID
NavigationManager.Instance.setSelectedGirlId(this.id);
// 通过switchToPanel切换到角色详情面板,保持动画和状态同步
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
// 通过openSubPanel打开ChatPanel作为子面板
const chatData = { girlId: this.id };
NavigationManager.Instance.openSubPanel(
"ChatPanel",
this.baseNode,
chatData
);
}
}
+5 -5
View File
@@ -34,7 +34,7 @@ export class ThemeItem extends Component {
private isLocked: boolean;
private parentPanel: any;
private baseNode: any;
key: string;
protected onLoad(): void {
@@ -62,9 +62,9 @@ export class ThemeItem extends Component {
}, 0);
}
refresh(themeId: number, parentPanel?: any) {
refresh(themeId: number, parentPanel?: Node) {
if (this.loading) this.loading.active = true;
this.parentPanel = parentPanel;
this.baseNode = parentPanel;
// 主题数据
const themeData = DataManager.I.getDataById<ThemeData>(DataId.Theme);
this.lockImg.node.active = this.lockCover.node.active =
@@ -95,7 +95,7 @@ export class ThemeItem extends Component {
"[ThemeItem] Opening GirlListPanel for category:",
this.category
);
// 不使用过渡动画,直接打开
NavigationManager.Instance.navigateToGirlList(this.category);
NavigationManager.Instance.setSelectedCategoryId(this.category);
NavigationManager.Instance.openSubPanel("GirlListPanel", this.baseNode);
}
}