This commit is contained in:
2025-10-14 18:54:02 +08:00
parent b40b02e2a2
commit af2031f486
11 changed files with 352 additions and 111 deletions
+15 -2
View File
@@ -148,6 +148,12 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.onEmotionInitialized
);
// 停止视频播放,释放资源
if (this.videoLayer) {
this.videoLayer.stop();
logger.log("ChatPanel: 销毁时停止视频播放");
}
// 解绑ChatController(不销毁,因为它是单例)
if (this.chatController) {
this.chatController.unbindView();
@@ -401,13 +407,20 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.isActive = true; // 设置为活跃状态
ChatAIService.Instance.setShouldShowErrorTips(true); // 启用错误提示
this.base.active = false;
// 注意:basePanel 的显隐现在由 NavigationManager 统一管理,无需手动设置
this.refresh();
}
protected onDisable(): void {
this.isActive = false; // 设置为非活跃状态,停止响应异步操作
ChatAIService.Instance.setShouldShowErrorTips(false); // 禁用错误提示,避免在其他页面显示
this.base.active = true;
// 停止视频播放,释放资源
if (this.videoLayer) {
this.videoLayer.stop();
logger.log("ChatPanel: 面板禁用时停止视频播放");
}
// 注意:basePanel 的显隐现在由 NavigationManager 统一管理,无需手动设置
}
isWaiting: boolean = false;
@@ -205,14 +205,9 @@ export class GirlDetailPanel extends li_BaseView {
this.descKey = girlData.getGrilDesc(this.category.toString(), this.id);
this.desc.string = LanguageUtils.getText(this.descKey);
let desc = "";
this.tagKey = girlData.getGrilTagKey(this.category.toString(), this.id);
const tags = LanguageUtils.getText(this.tagKey).split("|");
for (let i = 0; i < tags.length; i++) {
if (i != 0) desc += "\n";
desc += tags[i];
}
this.tags.string = desc;
this.tags.string = LanguageUtils.getText(this.tagKey);
const star = girlData.getStar(this.category.toString(), this.id);
const stars = this.starParent.getComponentsInChildren(Sprite);
logger.log("好感度:" + star);
@@ -335,8 +330,8 @@ export class GirlDetailPanel extends li_BaseView {
currentPanel,
chatData,
{
openAnimation: PageTransitionType.SLIDE_LEFT,
closeAnimation: PageTransitionType.SLIDE_RIGHT,
openAnimation: PageTransitionType.NONE,
closeAnimation: PageTransitionType.NONE,
hideBasePanel: true,
}
);
@@ -351,8 +346,6 @@ export class GirlDetailPanel extends li_BaseView {
// id: this.id,
// });
// }
this.close();
}
returnBtn() {
@@ -366,8 +359,8 @@ export class GirlDetailPanel extends li_BaseView {
onClose() {
// 停止视频播放,释放资源
if (this.videoLayer) {
//this.videoLayer.stop();
//logger.log("GirlDetailPanel: 停止视频播放");
this.videoLayer.stop();
logger.log("GirlDetailPanel: 停止视频播放");
}
super.onClose();
@@ -448,8 +441,8 @@ export class GirlDetailPanel extends li_BaseView {
onDestroy() {
// 确保视频资源被释放
if (this.videoLayer) {
//this.videoLayer.stop();
//logger.log("GirlDetailPanel: 销毁时停止视频播放");
this.videoLayer.stop();
logger.log("GirlDetailPanel: 销毁时停止视频播放");
}
// 回收所有使用中的节点到对象池
@@ -25,6 +25,7 @@ import ResManager from "../../../Main/Manager/ResManager";
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
import { GirlDetailPanel } from "./GirlDetailPanel";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@@ -94,7 +95,7 @@ export class GirlListPopupPanel extends li_BaseView {
Utils.addInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange);
}
Close() {
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
}
onDestroy(): void {
Utils.removeInnerEL(InnerMsgCode.BalanceChange, this, this.onBalanceChange);
@@ -118,10 +119,10 @@ export class GirlListPopupPanel extends li_BaseView {
walletData.vipExpire = Number(resData.vipExpire);
// 刷新界面
this.base.refresh();
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
TipsPanel.show("Buy Succeed");
} else {
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
TipsPanel.show("Insufficient balance, need to purchase");
}
// TipsPanel.show("Insufficient balance, need to purchase");
@@ -23,6 +23,7 @@ import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { Dialog } from "../../data/DialogData";
import { InnerMsgCode } from "../../../Main/Config/InnerMsgCode";
import { logger } from "db://assets/Scripts/Main/Common/Logger";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@@ -295,6 +296,6 @@ export class RecordPanel extends li_BaseView {
*/
returnBtn() {
this.onClose();
this.close(); // 使用li_BaseView的close方法
NavigationManager.Instance.closePopupPanel(this.node);
}
}
@@ -1,5 +1,6 @@
import { _decorator, Component, Node, tween, UIOpacity, Vec3 } from "cc";
import li_BaseView from "../../../Main/Common/li_BaseView";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@ccclass("ReleasePanel")
@@ -13,6 +14,6 @@ export class ReleasePanel extends li_BaseView {
}
private closePanel() {
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
}
}
@@ -3,6 +3,7 @@ import li_BaseView from "../../../Main/Common/li_BaseView";
import Utils from "../../../Main/Common/Utils";
import { ViewManager } from "../../../Main/Manager/ViewManager";
import { GButton } from "../../../Main/Common/GButton";
import { NavigationManager } from "../../manager/NavigationManager";
const { ccclass, property } = _decorator;
@@ -105,7 +106,7 @@ export class TipsPanel extends li_BaseView {
private closePanel() {
this.playHideAnimation(() => {
this.close();
NavigationManager.Instance.closePopupPanel(this.node);
});
}
}