头像入版 页面跳转优化
This commit is contained in:
@@ -7,6 +7,8 @@ import {
|
||||
instantiate,
|
||||
UITransform,
|
||||
Size,
|
||||
Vec3,
|
||||
tween,
|
||||
} from "cc";
|
||||
import li_BaseView from "db://assets/Scripts/Main/Common/li_BaseView";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
@@ -69,10 +71,14 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
openUIDataCT(data) {
|
||||
this.id = data;
|
||||
}
|
||||
|
||||
videoAreaPos;
|
||||
onLoadCT() {
|
||||
super.onLoadCT();
|
||||
this.imgItemInst.node.active = false;
|
||||
this.videoAreaPos = this.videoArea.node.getWorldPosition();
|
||||
|
||||
this.node.scale = Vec3.ZERO;
|
||||
tween(this.node).to(0.3, { scale: Vec3.ONE }).start();
|
||||
|
||||
// 检查 SceneBgVideoLayer 是否可用
|
||||
if (!this.videoLayer) {
|
||||
@@ -80,7 +86,7 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
} else {
|
||||
console.log("GirlDetailPanel: 成功获取 SceneBgVideoLayer 实例");
|
||||
// 初始化视频显示位置
|
||||
this.initVideoPosition();
|
||||
//this.initVideoPosition();
|
||||
}
|
||||
|
||||
this.refresh(this.id);
|
||||
@@ -182,16 +188,30 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
? new Size(this.videoArea.width, this.videoArea.height)
|
||||
: new Size(600, 800);
|
||||
|
||||
// 获取 videoArea 的中心位置作为参考节点(使用世界坐标)
|
||||
const videoAreaPos = this.videoArea
|
||||
? this.videoArea.node.getWorldPosition()
|
||||
: undefined;
|
||||
// 获取 videoArea 的中心位置,确保使用正确的世界坐标
|
||||
const videoAreaPos = this.videoAreaPos;
|
||||
if (this.videoArea) {
|
||||
// 获取 videoArea 的世界坐标
|
||||
this.videoAreaPos = this.videoArea.node.getWorldPosition();
|
||||
|
||||
// 也检查 videoLayer 的父节点信息,确保坐标系统一致
|
||||
if (this.videoLayer && this.videoLayer.getVideoPlayer()) {
|
||||
const videoPlayerParent =
|
||||
this.videoLayer.getVideoPlayer().node.parent;
|
||||
if (videoPlayerParent) {
|
||||
const parentWorldPos = videoPlayerParent.getWorldPosition();
|
||||
console.log(
|
||||
`GirlDetailPanel: VideoPlayer 父节点世界位置: (${parentWorldPos.x}, ${parentWorldPos.y}, ${parentWorldPos.z})`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 使用新的统一 playVideo 方法
|
||||
this.videoLayer.playVideo(firstPath, {
|
||||
loop: true,
|
||||
size: targetSize,
|
||||
position: videoAreaPos
|
||||
position: videoAreaPos,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -266,7 +286,7 @@ export class GirlDetailPanel extends li_BaseView {
|
||||
// 使用 videoArea 的世界坐标位置
|
||||
const videoAreaWorldPos = this.videoArea.node.getWorldPosition();
|
||||
// 视频位置和缩放已在 playVideo 中处理
|
||||
this.videoLayer.setVideoScale(1);
|
||||
//this.videoLayer.setVideoScale(1);
|
||||
console.log(
|
||||
`GirlDetailPanel: 初始化视频世界位置到 (${videoAreaWorldPos.x}, ${videoAreaWorldPos.y})`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user