update 音效 - 主题图

This commit is contained in:
2025-09-11 18:49:27 +08:00
parent 0f9690b0e1
commit 49f4d21c56
27 changed files with 1130 additions and 983 deletions
+109 -163
View File
@@ -25,6 +25,13 @@ export class SceneBgVideoLayer extends li_BaseView {
private isPlaying: boolean = false;
private currentVideoData: any = null;
// 待处理的视频配置(用于在视频准备好后应用)
private pendingVideoConfig: {
size?: { width: number; height: number } | Size;
position?: { x: number; y: number; z?: number } | Vec3;
scale?: number | Vec3;
} | null = null;
//----重写父类接口---------------------------------------
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab);
@@ -93,11 +100,18 @@ export class SceneBgVideoLayer extends li_BaseView {
position: options?.position,
};
// 先停止当前视频
// 先停止当前视频并清理状态
if (this.isPlaying) {
this.pause();
this.stop();
}
// 存储待处理的配置,在视频准备好后应用
this.pendingVideoConfig = {
size: config.size,
position: config.position,
scale: options?.scale
};
// 加载本地视频资源
ResManager.I.changeBundleVideo(
this.videoPlayer,
@@ -113,138 +127,10 @@ export class SceneBgVideoLayer extends li_BaseView {
console.log("SceneBgVideoLayer: 设置视频锚点为 (0.5, 0.5)");
}
// 应用位置设置(先尝试本地坐标,再尝试世界坐标)
if (config.position) {
const pos = config.position;
let targetWorldPos: Vec3;
if (pos instanceof Vec3) {
targetWorldPos = pos;
} else {
targetWorldPos = new Vec3(pos.x, pos.y, pos.z || 0);
}
// 获取 videoPlayer 的父节点信息
const parent = this.videoPlayer.node.parent;
if (parent) {
const parentWorldPos = parent.getWorldPosition();
const parentWorldScale = parent.getWorldScale();
console.log(`SceneBgVideoLayer: VideoPlayer 父节点世界位置: (${parentWorldPos.x}, ${parentWorldPos.y}, ${parentWorldPos.z})`);
console.log(`SceneBgVideoLayer: VideoPlayer 父节点世界缩放: (${parentWorldScale.x}, ${parentWorldScale.y}, ${parentWorldScale.z})`);
// 尝试方法1:计算相对于父节点的本地位置
const localPos = new Vec3();
localPos.x = (targetWorldPos.x - parentWorldPos.x) / parentWorldScale.x;
localPos.y = (targetWorldPos.y - parentWorldPos.y) / parentWorldScale.y;
localPos.z = (targetWorldPos.z - parentWorldPos.z) / parentWorldScale.z;
this.videoPlayer.node.setPosition(localPos);
console.log(`SceneBgVideoLayer: 设置本地位置: (${localPos.x.toFixed(2)}, ${localPos.y.toFixed(2)}, ${localPos.z.toFixed(2)})`);
} else {
// 如果没有父节点,直接使用世界坐标
this.videoPlayer.node.setWorldPosition(targetWorldPos);
console.log(`SceneBgVideoLayer: 无父节点,使用世界坐标: (${targetWorldPos.x}, ${targetWorldPos.y}, ${targetWorldPos.z})`);
}
// 验证位置是否设置正确
const actualWorldPos = this.videoPlayer.node.getWorldPosition();
const actualLocalPos = this.videoPlayer.node.getPosition();
console.log(`SceneBgVideoLayer: 目标世界位置: (${targetWorldPos.x}, ${targetWorldPos.y}, ${targetWorldPos.z})`);
console.log(`SceneBgVideoLayer: 实际世界位置: (${actualWorldPos.x}, ${actualWorldPos.y}, ${actualWorldPos.z})`);
console.log(`SceneBgVideoLayer: 实际本地位置: (${actualLocalPos.x.toFixed(2)}, ${actualLocalPos.y.toFixed(2)}, ${actualLocalPos.z.toFixed(2)})`);
}
// 如果传入了目标尺寸,计算并应用缩放
if (config.size && uiTransform) {
// 获取视频的原始尺寸
const videoWidth = uiTransform.contentSize.width;
const videoHeight = uiTransform.contentSize.height;
if (videoWidth > 0 && videoHeight > 0) {
const targetWidth =
config.size instanceof Size
? config.size.width
: config.size.width;
const targetHeight =
config.size instanceof Size
? config.size.height
: config.size.height;
// 计算缩放比例(填满整个区域)
const scaleX = targetWidth / videoWidth;
const scaleY = targetHeight / videoHeight;
const scale = Math.max(scaleX, scaleY);
this.videoPlayer.node.setScale(new Vec3(scale, scale, 1));
console.log(
`SceneBgVideoLayer: 视频原始尺寸: ${videoWidth}x${videoHeight}, 目标尺寸: ${targetWidth}x${targetHeight}`
);
console.log(
`SceneBgVideoLayer: 缩放比例 - X: ${scaleX.toFixed(3)}, Y: ${scaleY.toFixed(3)}, 最终: ${scale.toFixed(3)}`
);
} else {
// 如果视频尺寸还未准备好,延迟重试
this.scheduleOnce(() => {
if (config.size && uiTransform) {
const videoWidth = uiTransform.contentSize.width;
const videoHeight = uiTransform.contentSize.height;
if (videoWidth > 0 && videoHeight > 0) {
const targetWidth =
config.size instanceof Size
? config.size.width
: config.size.width;
const targetHeight =
config.size instanceof Size
? config.size.height
: config.size.height;
const scaleX = targetWidth / videoWidth;
const scaleY = targetHeight / videoHeight;
const scale = Math.max(scaleX, scaleY);
this.videoPlayer.node.setScale(new Vec3(scale, scale, 1));
console.log(
`SceneBgVideoLayer: (延迟) 视频原始尺寸: ${videoWidth}x${videoHeight}, 目标尺寸: ${targetWidth}x${targetHeight}`
);
console.log(
`SceneBgVideoLayer: (延迟) 缩放比例 - X: ${scaleX.toFixed(3)}, Y: ${scaleY.toFixed(3)}, 最终: ${scale.toFixed(3)}`
);
}
}
}, 0.1);
}
} else {
// 没有指定尺寸,保持原始缩放
this.videoPlayer.node.setScale(Vec3.ONE);
console.log("SceneBgVideoLayer: 未指定尺寸,保持默认缩放 (1, 1, 1)");
}
// 如果显式传入了 scale 参数,覆盖自动计算的缩放
// 立即开始播放,尺寸和位置将在 READY_TO_PLAY 事件中设置
this.videoPlayer.play();
this.isPlaying = true;
console.log(`SceneBgVideoLayer: 播放视频 ${path}, 配置:`, config);
// 最终验证:确保视频节点的状态正确
setTimeout(() => {
const finalWorldPos = this.videoPlayer.node.getWorldPosition();
const finalLocalPos = this.videoPlayer.node.getPosition();
const finalScale = this.videoPlayer.node.getScale();
const finalTransform = this.videoPlayer.node.getComponent(UITransform);
if (finalTransform) {
console.log(`SceneBgVideoLayer: === 最终状态验证 ===`);
console.log(`SceneBgVideoLayer: 最终世界位置: (${finalWorldPos.x.toFixed(2)}, ${finalWorldPos.y.toFixed(2)}, ${finalWorldPos.z.toFixed(2)})`);
console.log(`SceneBgVideoLayer: 最终本地位置: (${finalLocalPos.x.toFixed(2)}, ${finalLocalPos.y.toFixed(2)}, ${finalLocalPos.z.toFixed(2)})`);
console.log(`SceneBgVideoLayer: 最终缩放: (${finalScale.x.toFixed(3)}, ${finalScale.y.toFixed(3)}, ${finalScale.z.toFixed(3)})`);
console.log(`SceneBgVideoLayer: 最终锚点: (${finalTransform.anchorX.toFixed(2)}, ${finalTransform.anchorY.toFixed(2)})`);
console.log(`SceneBgVideoLayer: 最终内容尺寸: ${finalTransform.contentSize.width.toFixed(0)}x${finalTransform.contentSize.height.toFixed(0)}`);
// 计算实际渲染尺寸(内容尺寸 * 缩放)
const renderWidth = finalTransform.contentSize.width * finalScale.x;
const renderHeight = finalTransform.contentSize.height * finalScale.y;
console.log(`SceneBgVideoLayer: 计算的渲染尺寸: ${renderWidth.toFixed(0)}x${renderHeight.toFixed(0)}`);
console.log(`SceneBgVideoLayer: === 验证结束 ===`);
}
}, 200);
console.log(`SceneBgVideoLayer: 开始加载视频 ${path}, 配置:`, config);
}
);
}
@@ -275,7 +161,7 @@ export class SceneBgVideoLayer extends li_BaseView {
stop() {
if (this.videoPlayer) {
this.videoPlayer.stop();
this.isPlaying = false;
this.clearVideoState();
console.log("SceneBgVideoLayer: 停止视频");
}
}
@@ -306,42 +192,92 @@ export class SceneBgVideoLayer extends li_BaseView {
adjustToFillArea(targetSize: Size, position?: Vec3) {
if (!this.videoPlayer) return;
const tryAdjust = () => {
const uiTransform = this.videoPlayer.node.getComponent(UITransform);
if (!uiTransform) return false;
// 如果视频正在播放,直接应用配置
if (this.isPlaying && this.videoPlayer.isPlaying) {
this.applyVideoConfiguration({
size: targetSize,
position: position
});
} else {
// 如果视频还未准备好,存储配置等待应用
this.pendingVideoConfig = {
size: targetSize,
position: position
};
console.log("SceneBgVideoLayer: 视频未准备好,配置已存储等待应用");
}
}
/**
* 清除视频状态和待处理配置
*/
private clearVideoState() {
this.isPlaying = false;
this.pendingVideoConfig = null;
this.currentVideoData = null;
}
//================== 内部辅助方法 ==================
/**
* 应用视频配置(位置、尺寸、缩放)
* @param config 视频配置对象
*/
private applyVideoConfiguration(config: {
size?: { width: number; height: number } | Size;
position?: { x: number; y: number; z?: number } | Vec3;
scale?: number | Vec3;
}) {
if (!this.videoPlayer) return;
const uiTransform = this.videoPlayer.node.getComponent(UITransform);
if (!uiTransform) return;
// 应用位置设置
if (config.position) {
const pos = config.position;
let targetWorldPos: Vec3;
if (pos instanceof Vec3) {
targetWorldPos = pos;
} else {
targetWorldPos = new Vec3(pos.x, pos.y, pos.z || 0);
}
this.videoPlayer.node.setWorldPosition(targetWorldPos);
console.log(`SceneBgVideoLayer: 设置视频位置 (${targetWorldPos.x}, ${targetWorldPos.y}, ${targetWorldPos.z})`);
}
// 应用尺寸和缩放设置
if (config.size) {
// 获取视频的原始尺寸(此时应该是准确的)
const videoSize = uiTransform.contentSize;
if (videoSize.width > 0 && videoSize.height > 0) {
// 计算宽度和高度的缩放比例
const scaleX = targetSize.width / videoSize.width;
const scaleY = targetSize.height / videoSize.height;
const targetWidth = config.size instanceof Size ? config.size.width : config.size.width;
const targetHeight = config.size instanceof Size ? config.size.height : config.size.height;
// 选择较大的缩放比例填满整个区域
// 计算缩放比例填满整个区域
const scaleX = targetWidth / videoSize.width;
const scaleY = targetHeight / videoSize.height;
const scale = Math.max(scaleX, scaleY);
this.videoPlayer.node.setScale(new Vec3(scale, scale, 1));
if (position) {
this.videoPlayer.node.setWorldPosition(position);
}
console.log(`SceneBgVideoLayer: 自适应填充区域,缩放: ${scale}`);
return true;
console.log(`SceneBgVideoLayer: 设置视频缩放 ${scale} (原始尺寸: ${videoSize.width}x${videoSize.height}, 目标尺寸: ${targetWidth}x${targetHeight})`);
} else {
console.warn("SceneBgVideoLayer: 无法获取视频尺寸,跳过缩放设置");
}
return false;
};
// 立即尝试一次
if (!tryAdjust()) {
// 如果失败,延迟尝试
this.scheduleOnce(() => {
if (!tryAdjust()) {
this.scheduleOnce(() => {
tryAdjust();
}, 0.5);
}
}, 0.1);
} else if (config.scale) {
// 如果显式传入了 scale 参数,直接应用
if (typeof config.scale === "number") {
this.videoPlayer.node.setScale(new Vec3(config.scale, config.scale, 1));
console.log(`SceneBgVideoLayer: 设置显式缩放 ${config.scale}`);
} else {
this.videoPlayer.node.setScale(config.scale);
console.log(`SceneBgVideoLayer: 设置显式缩放 (${config.scale.x}, ${config.scale.y}, ${config.scale.z})`);
}
} else {
// 没有指定尺寸或缩放,保持原始缩放
this.videoPlayer.node.setScale(Vec3.ONE);
console.log("SceneBgVideoLayer: 保持默认缩放 (1, 1, 1)");
}
}
@@ -349,6 +285,14 @@ export class SceneBgVideoLayer extends li_BaseView {
private onVideoReadyToPlay = () => {
console.log("SceneBgVideoLayer: 视频准备完成");
// 应用待处理的视频配置
if (this.pendingVideoConfig) {
this.applyVideoConfiguration(this.pendingVideoConfig);
// 清空待处理配置
this.pendingVideoConfig = null;
}
this.onVideoReady();
};
@@ -356,12 +300,12 @@ export class SceneBgVideoLayer extends li_BaseView {
switch (eventType) {
case "completed":
console.log("SceneBgVideoLayer: 视频播放完成");
this.isPlaying = false;
this.clearVideoState();
this.onVideoEnd();
break;
case "error":
console.error("SceneBgVideoLayer: 视频播放错误");
this.isPlaying = false;
this.clearVideoState();
this.onVideoError();
break;
}
@@ -409,6 +353,7 @@ export class SceneBgVideoLayer extends li_BaseView {
*/
onDestroy() {
if (this.videoPlayer) {
this.videoPlayer.stop();
this.videoPlayer.node.off(
VideoPlayer.EventType.READY_TO_PLAY,
this.onVideoReadyToPlay,
@@ -416,6 +361,7 @@ export class SceneBgVideoLayer extends li_BaseView {
);
//this.videoPlayer.node.off(VideoPlayer.EventType.VIDEO_PLAYER_EVENT, this.onVideoEvent, this);
}
this.clearVideoState();
SceneBgVideoLayer.handle = null;
}
}
@@ -101,25 +101,15 @@ export class NavigationManager {
return;
}
const extendedNavigationData = {
...navigationData,
withTransition: true,
transitionType: transitionConfig.incomingTransition,
};
ViewManager.I.openBundlesView(
targetPanel,
extendedNavigationData,
(targetNode) => {
this._executeTransition(
targetNode,
currentPanel,
transitionConfig,
duration,
onComplete
);
}
);
ViewManager.I.openBundlesView(targetPanel, navigationData, (targetNode) => {
this._executeTransition(
targetNode,
currentPanel,
transitionConfig,
duration,
onComplete
);
});
}
/**
@@ -274,7 +264,7 @@ export class NavigationManager {
};
this.navigateWithTransition(
"GirlListPanel",
navigationData,
themeId,
transitionConfig,
currentPanel,
() => {
@@ -370,7 +360,6 @@ export class NavigationManager {
const navigationData = {
categoryId: categoryId,
roleId: roleId,
withSlideTransition: true,
};
const transitionConfig: PageTransitionConfig = {
+39 -131
View File
@@ -8,6 +8,7 @@ import {
UITransform,
VideoPlayer,
Size,
Vec3,
} from "cc";
// 首先加载 polyfills 以确保兼容性
import "../../utils/polyfills";
@@ -29,6 +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";
const { ccclass, property } = _decorator;
@ccclass("ChatPanel")
@@ -70,7 +72,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
private _nodeTab: any = {};
nameKey: string;
private commercialVideos: purchase.CommercialVideo[] = [];
private currentEmotion: VideoEmotion | null = null;
private onLanguageChangeCallback = () => {
@@ -83,7 +84,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
typeof data === "object" && data.roleId !== undefined
? data.roleId
: data;
const withAnimation = typeof data === "object" && data.withSlideTransition;
// 检查是否是切换角色
const isRoleSwitch = this.id && this.id !== newRoleId;
@@ -91,12 +91,10 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.id = newRoleId;
this.categoryId = data.categoryId;
// 如果标记了需要滑入动画,则执行动画
if (withAnimation && this.node && this.node.isValid) {
// 延迟一帧执行动画,确保节点已正确加载到场景中
this.scheduleOnce(() => {
UITransitionHelper.slideInFromRight(this.node, 0.3);
}, 0);
}
// 延迟一帧执行动画,确保节点已正确加载到场景中
this.scheduleOnce(() => {
UITransitionHelper.slideInFromRight(this.node, 0.3);
}, 0);
// 获取ChatController单例并绑定当前Panel
this.chatController = ChatController.Instance;
@@ -122,10 +120,15 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
}
}
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;
@@ -186,15 +189,6 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
this.onEmotionInitialized
);
// Cleanup video event listeners
if (this.videoLayer && this.videoLayer.node) {
this.videoLayer.node.off(
VideoPlayer.EventType.READY_TO_PLAY,
this.adjustVideoScale,
this
);
}
// 解绑ChatController(不销毁,因为它是单例)
if (this.chatController) {
this.chatController.unbindView();
@@ -202,31 +196,10 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
}
refresh() {
//this.id = id;
// 通过ChatController获取角色数据
//const roleData = this.chatController.getRoleData();
//if (!roleData || !roleData.basic) return;
//const data = roleData.basic;
//const dataDetail = roleData.detail;
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
this.girlName.string = LanguageUtils.getText(this.nameKey);
// ResManager.I.changeBundleSpriteFrame(
// this.girlImg,
// data.avatarPath,
// "Girls",
// () => {
// let sizeTran = this.girlImg.node.parent.getComponent(UITransform);
// Utils.adjustBgPixelRatioToSize(
// sizeTran.contentSize,
// this.girlImg.node,
// 2
// );
// }
// );
// 通过ChatController获取商业视频数据
const chatModel = this.chatController.getChatModel();
@@ -249,84 +222,35 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
`Loading initial video: ${initialVideo} (emotion: ${VideoEmotion[initialVideo]})`
);
// 获取 videoArea 的尺寸
const targetSize = this.videoArea
? new Size(this.videoArea.width, this.videoArea.height)
: new Size(600, 800);
// Set current emotion to the loaded video's emotion
this.currentEmotion = this.chatController.getCurrentEmotion();
// 使用新的统一 playVideo 方法
const videoAreaPos = this.videoArea
? this.videoArea.node.getWorldPosition()
: undefined;
// 使用新的统一 playVideo 方法,现在它会自动处理缩放和位置
this.videoLayer.playVideo(initialVideo, {
loop: true,
size: targetSize,
position: videoAreaPos,
size: this.targetSize,
position: this.videoAreaPos,
});
// 延迟调整视频缩放
this.scheduleOnce(() => {
this.adjustVideoScale();
}, 0.1);
// 注意:移除了 adjustVideoScale() 调用,因为 playVideo 现在会自动处理缩放和位置
}
} else {
this.commercialVideos = [];
this.currentEmotion = null; // Reset current emotion when no videos available
console.log("No SceneBgVideoLayer available for role", this.id);
}
}
/**
* @deprecated 此方法已废弃,现在由 SceneBgVideoLayer.playVideo() 自动处理缩放和位置
* 保留此方法仅为了兼容性,但不再主动调用
*/
adjustVideoScale() {
if (!this.videoLayer || !this.videoArea) {
console.error("ChatPanel: SceneBgVideoLayer 或 videoArea 不可用");
return;
}
const tryAdjustScale = () => {
const videoPlayer = this.videoLayer.getVideoPlayer();
if (!videoPlayer) return false;
const videoTransform = videoPlayer.node.getComponent(UITransform);
if (videoTransform && videoTransform.height > 0) {
// 计算缩放比例,使视频高度填满 videoArea
const scale = this.videoArea.height / videoTransform.height;
// 设置视频缩放
this.videoLayer.setVideoScale(scale);
// 获取 videoArea 的世界坐标中心点
const videoAreaWorldPos = this.videoArea.node.getWorldPosition();
// 使用新的 playVideo 方法的位置参数,如果需要更新位置
// 由于视频已经在播放,这里只调整缩放
// 位置调整已在 playVideo 中处理
console.log(
`ChatPanel: 视频缩放到 ${scale}, videoArea高度: ${this.videoArea.height}, 视频高度: ${videoTransform.height}`
);
console.log(
`ChatPanel: 视频世界位置设置为 (${videoAreaWorldPos.x}, ${videoAreaWorldPos.y})`
);
return true;
}
return false;
};
// 立即尝试一次
if (!tryAdjustScale()) {
// 如果失败,延迟尝试
this.scheduleOnce(() => {
if (!tryAdjustScale()) {
// 再次延迟尝试
this.scheduleOnce(() => {
tryAdjustScale();
}, 0.5);
}
}, 0.1);
}
console.log(
"ChatPanel: adjustVideoScale() 方法已废弃,缩放和位置由 playVideo() 自动处理"
);
// 如果确实需要手动调整,可以重新调用 playVideo
// this.videoLayer.playVideo(currentVideo, { size, position });
}
onChatCountChange() {
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
@@ -382,27 +306,16 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
})`
);
// Load the new video with the unified playVideo method
// 获取 videoArea 的尺寸和位置
const targetSize = this.videoArea
? new Size(this.videoArea.width, this.videoArea.height)
: new Size(600, 800);
const videoAreaPos = this.videoArea
? this.videoArea.node.getWorldPosition()
: undefined;
this.videoLayer.playVideo(matchingVideo, {
loop: true,
size: targetSize,
position: videoAreaPos,
size: this.targetSize,
position: this.videoAreaPos, // 修复:使用正确的位置而不是 Vec3.ZERO
});
//ResManager.I.changeBundleVideo(this.girlVideo, matchingVideo, "Girls");
// Update current emotion state
this.currentEmotion = emotion;
// Adjust scale and enable playback
this.adjustVideoScale();
// 注意:移除了 adjustVideoScale() 调用,因为 playVideo 现在会自动处理缩放和位置
this.setVideoEnable(true);
} else {
console.warn(
@@ -416,23 +329,16 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
`Loading fallback video: ${fallbackVideo} (emotion: ${VideoEmotion[fallbackVideo]})`
);
// 获取 videoArea 的尺寸和位置
const targetSize = this.videoArea
? new Size(this.videoArea.width, this.videoArea.height)
: new Size(600, 800);
const videoAreaPos = this.videoArea
? this.videoArea.node.getWorldPosition()
: undefined;
this.videoLayer.playVideo(fallbackVideo, {
loop: true,
size: targetSize,
position: videoAreaPos,
size: this.targetSize,
position: this.videoAreaPos,
});
// Update current emotion state to the fallback video's emotion
this.currentEmotion = this.chatController.getCurrentEmotion();
this.adjustVideoScale();
// 注意:移除了 adjustVideoScale() 调用,因为 playVideo 现在会自动处理缩放和位置
this.setVideoEnable(true);
}
}
@@ -558,10 +464,12 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
}
returnBtn() {
this.onClose();
GameRootUI.I.showDefaultView();
//ViewManager.I.openBundlesView("GirlListPanel");
// Navigate back to GirlDetailPanel with current girlId using smooth transition
NavigationManager.Instance.navigateToGirlDetail(
this.id,
NavigationManager.getTransitionPresets().SLIDE_RIGHT_TO_LEFT,
this
);
}
onClickRecord() {
ViewManager.I.openBundlesView("RecordPanel", this.id);
@@ -60,6 +60,9 @@ export class GirlDetailPanel extends li_BaseView {
@property(Node)
chatBtn: Node;
@property(Node)
descContent: Node;
id = 0;
@property(DetailImageItem)
@@ -75,10 +78,18 @@ export class GirlDetailPanel extends li_BaseView {
onLoadCT() {
super.onLoadCT();
this.imgItemInst.node.active = false;
this.videoAreaPos = this.videoArea.node.getWorldPosition();
this.videoAreaPos = new Vec3(540, 1384);
this.node.scale = Vec3.ZERO;
tween(this.node).to(0.3, { scale: Vec3.ONE }).start();
const pos = new Vec3(
this.descContent.position.x,
this.descContent.position.y,
this.descContent.position.z
);
this.descContent.position = new Vec3(pos.x, pos.y - 1000, pos.z);
//this.node.scale = Vec3.ZERO;
tween(this.descContent)
.to(0.3, { position: pos }, { easing: "quadOut" })
.start();
// 检查 SceneBgVideoLayer 是否可用
if (!this.videoLayer) {
@@ -46,7 +46,9 @@ export class GirlListPopupPanel extends li_BaseView {
}
onLoadCT() {
this.node.scale = Vec3.ZERO;
tween(this.node).to(0.3, { scale: Vec3.ONE }).start();
tween(this.node)
.to(0.2, { scale: Vec3.ONE }, { easing: "quadOut" })
.start();
Utils.parseNode(this.node, this._nodeTab);
this.img = this._nodeTab.img.getComponent(Sprite);
@@ -46,7 +46,10 @@ export class PopupGirlDetailPanel extends li_BaseView {
}
onLoadCT() {
this.node.scale = Vec3.ZERO;
tween(this.node).to(0.3, { scale: Vec3.ONE }).start();
tween(this.node)
.to(0.2, { scale: Vec3.ONE }, { easing: "quadOut" })
.start();
Utils.parseNode(this.node, this._nodeTab);
this.desc = this._nodeTab.content.getComponent(Label);
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
@@ -211,7 +211,7 @@ export class DetailImageItem extends Component {
}
ResManager.I.changeBundleSpriteFrame(this.img, imgPath, "Girls", () => {
if (!this.isVisible) this.question.active = false; // 图片加载成功后隐藏问号
if (!this.isVisible) this.question.active = true; // 图片加载成功后隐藏问号
this.scaleToFillItem();
this.loading.active = false;
});
@@ -42,9 +42,6 @@ export class UITransitionHelper {
{ position: originalPosition },
{
easing: "linear",
onUpdate: () => {
console.log(node.position);
},
}
)
.call(() => {