调整布局、新增导航栏,调整页面跳转逻辑
This commit is contained in:
@@ -30,7 +30,7 @@ import { PayToTalkSubpanel } from "./PayToTalkSubpanel";
|
||||
import { DataId, DataManager } from "../../data/DataManager";
|
||||
import { GirlData } from "../../data/GirlData";
|
||||
import { SceneBgVideoLayer } from "../../../Sub/UI/SceneBgVideoLayer";
|
||||
import { NavigationManager } from "../../manager/NavigationManager";
|
||||
import { NavigationManager, PanelType } from "../../manager/NavigationManager";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("ChatPanel")
|
||||
@@ -79,22 +79,79 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||
};
|
||||
|
||||
openUIDataCT(data) {
|
||||
const newRoleId =
|
||||
typeof data === "object" && data.roleId !== undefined
|
||||
? data.roleId
|
||||
: data;
|
||||
targetSize;
|
||||
videoAreaPos;
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
|
||||
// 获取 videoArea 的尺寸和位置
|
||||
this.targetSize = this.videoArea.contentSize;
|
||||
this.videoAreaPos = new Vec3(540, 1170, 0);
|
||||
|
||||
this.register();
|
||||
//this.refresh();
|
||||
this.payToTalkPanel.node.active = false;
|
||||
|
||||
// 检查 SceneBgVideoLayer 是否可用
|
||||
if (!this.videoLayer) {
|
||||
console.error("ChatPanel: SceneBgVideoLayer.handle 未初始化");
|
||||
} else {
|
||||
console.log("ChatPanel: 成功获取 SceneBgVideoLayer 实例");
|
||||
}
|
||||
}
|
||||
|
||||
register() {
|
||||
Utils.addInnerEL(
|
||||
InnerMsgCode.LanguageChange,
|
||||
this,
|
||||
this.onLanguageChangeCallback
|
||||
);
|
||||
|
||||
Utils.addInnerEL(
|
||||
InnerMsgCode.Chat_EmotionInitialized,
|
||||
this,
|
||||
this.onEmotionInitialized
|
||||
);
|
||||
|
||||
Utils.addInnerEL(
|
||||
InnerMsgCode.ChatTotalCountChange,
|
||||
this,
|
||||
this.onChatCountChange
|
||||
);
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
Utils.removeInnerEL(
|
||||
InnerMsgCode.LanguageChange,
|
||||
this,
|
||||
this.onLanguageChangeCallback
|
||||
);
|
||||
Utils.removeInnerEL(
|
||||
InnerMsgCode.ChatTotalCountChange,
|
||||
this,
|
||||
this.onChatCountChange
|
||||
);
|
||||
Utils.removeInnerEL(
|
||||
InnerMsgCode.Chat_EmotionInitialized,
|
||||
this,
|
||||
this.onEmotionInitialized
|
||||
);
|
||||
|
||||
// 解绑ChatController(不销毁,因为它是单例)
|
||||
if (this.chatController) {
|
||||
this.chatController.unbindView();
|
||||
this.chatController = null;
|
||||
}
|
||||
}
|
||||
refresh() {
|
||||
const newRoleId = NavigationManager.Instance.getSelectedGirlId();
|
||||
|
||||
// 检查是否是切换角色
|
||||
const isRoleSwitch = this.id && this.id !== newRoleId;
|
||||
|
||||
this.id = newRoleId;
|
||||
this.categoryId = data.categoryId;
|
||||
// 如果标记了需要滑入动画,则执行动画
|
||||
// 延迟一帧执行动画,确保节点已正确加载到场景中
|
||||
this.scheduleOnce(() => {
|
||||
UITransitionHelper.slideInFromRight(this.node, 0.3);
|
||||
}, 0);
|
||||
this.categoryId =
|
||||
NavigationManager.Instance.getSelectedThemeId().toString();
|
||||
|
||||
// 获取ChatController单例并绑定当前Panel
|
||||
this.chatController = ChatController.Instance;
|
||||
@@ -119,83 +176,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
||||
this.chatController.initialize(this.categoryId, this.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
targetSize;
|
||||
videoAreaPos;
|
||||
onLoadCT() {
|
||||
Utils.parseNode(this.node, this._nodeTab);
|
||||
|
||||
// 获取 videoArea 的尺寸和位置
|
||||
this.targetSize = this.videoArea.contentSize;
|
||||
this.videoAreaPos = new Vec3(540, 1170, 0);
|
||||
|
||||
this.register();
|
||||
this.refresh();
|
||||
this.payToTalkPanel.node.active = false;
|
||||
|
||||
// 检查 SceneBgVideoLayer 是否可用
|
||||
if (!this.videoLayer) {
|
||||
console.error("ChatPanel: SceneBgVideoLayer.handle 未初始化");
|
||||
} else {
|
||||
console.log("ChatPanel: 成功获取 SceneBgVideoLayer 实例");
|
||||
}
|
||||
}
|
||||
|
||||
register() {
|
||||
Utils.addInnerEL(
|
||||
InnerMsgCode.Chat_DialogRefresh,
|
||||
this,
|
||||
this.onDialogUpdate
|
||||
);
|
||||
|
||||
Utils.addInnerEL(
|
||||
InnerMsgCode.LanguageChange,
|
||||
this,
|
||||
this.onLanguageChangeCallback
|
||||
);
|
||||
|
||||
Utils.addInnerEL(
|
||||
InnerMsgCode.Chat_EmotionInitialized,
|
||||
this,
|
||||
this.onEmotionInitialized
|
||||
);
|
||||
|
||||
Utils.addInnerEL(
|
||||
InnerMsgCode.ChatTotalCountChange,
|
||||
this,
|
||||
this.onChatCountChange
|
||||
);
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
Utils.removeInnerEL(
|
||||
InnerMsgCode.Chat_DialogRefresh,
|
||||
this,
|
||||
this.onDialogUpdate
|
||||
);
|
||||
Utils.removeInnerEL(
|
||||
InnerMsgCode.LanguageChange,
|
||||
this,
|
||||
this.onLanguageChangeCallback
|
||||
);
|
||||
Utils.removeInnerEL(
|
||||
InnerMsgCode.ChatTotalCountChange,
|
||||
this,
|
||||
this.onChatCountChange
|
||||
);
|
||||
Utils.removeInnerEL(
|
||||
InnerMsgCode.Chat_EmotionInitialized,
|
||||
this,
|
||||
this.onEmotionInitialized
|
||||
);
|
||||
|
||||
// 解绑ChatController(不销毁,因为它是单例)
|
||||
if (this.chatController) {
|
||||
this.chatController.unbindView();
|
||||
this.chatController = null;
|
||||
}
|
||||
}
|
||||
refresh() {
|
||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||
|
||||
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
|
||||
@@ -372,6 +353,8 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
||||
}
|
||||
protected onEnable(): void {
|
||||
if (!this.manager) this.manager = DialogManager.getInstance();
|
||||
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
public async OnClickSend() {
|
||||
@@ -465,11 +448,7 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
||||
|
||||
returnBtn() {
|
||||
// Navigate back to GirlDetailPanel with current girlId using smooth transition
|
||||
NavigationManager.Instance.navigateToGirlDetail(
|
||||
this.id,
|
||||
NavigationManager.getTransitionPresets().SLIDE_RIGHT_TO_LEFT,
|
||||
this
|
||||
);
|
||||
NavigationManager.Instance.switchToPanel(PanelType.GIRL_DETAIL);
|
||||
}
|
||||
onClickRecord() {
|
||||
ViewManager.I.openBundlesView("RecordPanel", this.id);
|
||||
|
||||
Reference in New Issue
Block a user