ui模块优化 全部navigationmanager管理
实现pastgirllistpanel逻辑 完善图集
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user