头像入版 页面跳转优化

This commit is contained in:
2025-09-11 17:07:29 +08:00
parent d6a9898c8d
commit 6bf85c6ad8
74 changed files with 4238 additions and 1070 deletions
@@ -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})`
);
@@ -9,6 +9,7 @@ import { DataManager, DataId } from "../../data/DataManager";
import { GirlData } from "../../data/GirlData";
import proto from "db://assets/Scripts/proto/proto.pb.js";
import GameRootUI from "../../../Main/Common/GameRootUI";
import { UITransitionHelper } from "../../utils/UITransitionHelper";
const { ccclass, property } = _decorator;
@@ -23,7 +24,13 @@ export class GirlListPanel extends li_BaseView {
category: number;
openUIDataCT(data) {
this.category = data;
// 支持新的数据格式:既可以是单纯的数字,也可以是包含过渡动画信息的对象
this.category =
typeof data === "object" && data.category !== undefined
? data.category
: data;
const withAnimation = typeof data === "object" && data.withTransition;
}
onLoadCT() {
Utils.parseNode(this.node, this._nodeTab);
@@ -69,7 +76,37 @@ export class GirlListPanel extends li_BaseView {
GButton.BandClick(this._nodeTab.ReturnBtn, this.Return, this);
}
Return() {
this.onClose();
GameRootUI.I.showDefaultView();
console.log("GirlListPanel: Return button clicked");
// 执行同步的过渡动画:GirlListPanel向右滑出,ThemePanel从左滑入
const duration = 0.1;
let animationsCompleted = 0;
const totalAnimations = 2;
const onAnimationComplete = (source: string) => {
console.log(`GirlListPanel: Animation completed from ${source}`);
animationsCompleted++;
console.log(
`GirlListPanel: ${animationsCompleted}/${totalAnimations} animations completed`
);
if (animationsCompleted >= totalAnimations) {
console.log("GirlListPanel: All animations completed, closing panel");
// 所有动画完成后关闭当前面板
this.onClose();
}
};
// 1. GirlListPanel向右滑出
console.log("GirlListPanel: Starting slideOutToRight animation");
UITransitionHelper.slideOutToRight(this.node, duration, () =>
onAnimationComplete("slideOutToRight")
);
// 2. ThemePanel从左侧滑入
console.log("GirlListPanel: Starting ThemePanel slide_left animation");
GameRootUI.I.showDefaultViewWithTransition("slide_left", duration, () =>
onAnimationComplete("ThemePanel_slide_left")
);
}
}
@@ -7,6 +7,8 @@ import {
View,
Sprite,
UITransform,
Vec3,
tween,
} from "cc";
import li_BaseView from "../../../Main/Common/li_BaseView";
import Utils from "../../../Main/Common/Utils";
@@ -43,6 +45,9 @@ export class GirlListPopupPanel extends li_BaseView {
this.base = data.base;
}
onLoadCT() {
this.node.scale = Vec3.ZERO;
tween(this.node).to(0.3, { scale: Vec3.ONE }).start();
Utils.parseNode(this.node, this._nodeTab);
this.img = this._nodeTab.img.getComponent(Sprite);
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
@@ -1,4 +1,13 @@
import { _decorator, Component, Node, Label, UITransform, Sprite } from "cc";
import {
_decorator,
Component,
Node,
Label,
UITransform,
Sprite,
tween,
Vec3,
} from "cc";
import li_BaseView from "../../../Main/Common/li_BaseView";
import { GButton } from "../../../Main/Common/GButton";
import Utils from "../../../Main/Common/Utils";
@@ -36,6 +45,8 @@ export class PopupGirlDetailPanel extends li_BaseView {
this.type = data.type;
}
onLoadCT() {
this.node.scale = Vec3.ZERO;
tween(this.node).to(0.3, { scale: Vec3.ONE }).start();
Utils.parseNode(this.node, this._nodeTab);
this.desc = this._nodeTab.content.getComponent(Label);
this.uitransform = this._nodeTab.Img_Frame.getComponent(UITransform);
@@ -12,7 +12,7 @@ import Utils from "db://assets/Scripts/Main/Common/Utils";
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
import { ThemeItem } from "../../uiitems/ThemeItem";
import { NavigationManager } from "../../manager/NavigationManager";
import { NavigationManager, PageTransitionType } from "../../manager/NavigationManager";
import { GirlListItem } from "../../uiitems/GirlListItem";
import LanguageUtils from "../../../Main/Common/LanguageUtils";
import { ViewManager } from "../../../Main/Manager/ViewManager";
@@ -90,7 +90,7 @@ export class ThemePanel extends li_BaseView {
for (let id of themeIds) {
let newNode = instantiate(this.itemInst.node);
let item = newNode.getComponent(ThemeItem);
item.refresh(id);
item.refresh(id, this);
newNode.active = true;
this.cache.push(item);
this.content.addChild(newNode);
@@ -165,7 +165,8 @@ export class ThemePanel extends li_BaseView {
this.recId
) == 0;
if (isRelease || isFree) {
NavigationManager.Instance.navigateToGirlDetail(this.recId);
const transitionConfig = NavigationManager.getTransitionPresets().SLIDE_LEFT_TO_RIGHT;
NavigationManager.Instance.navigateToGirlDetail(this.recId, transitionConfig, this);
GameRootUI.I.hideDefaultView();
} else {
//未解锁