This commit is contained in:
2025-09-17 16:12:54 +08:00
parent 586ea3848d
commit be1389df98
16 changed files with 621 additions and 178 deletions
@@ -55,7 +55,7 @@ export class DialogBubble extends Component {
this.content.overflow = Overflow.NONE;
// 如果是加载状态,使用固定的"..."
if (isLoading && str === "...") {
if (isLoading) {
this.content.string = "...";
// 设置固定尺寸用于加载显示
const contentWidth = 60;
@@ -7,6 +7,7 @@ import {
tween,
UITransform,
path,
view,
} from "cc";
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
import Utils from "db://assets/Scripts/Main/Common/Utils";
@@ -23,8 +24,10 @@ export class ImagePopup extends Component {
@property(Sprite)
image: Sprite;
private isAnimating: boolean = false;
start() {
this.node.setPosition(new Vec3(-1500, 493, 0));
this.node.setPosition(this.getOffscreenPosition());
GButton.BandClick(this.image.node, this.openImage, this);
this.node.active = false;
}
@@ -36,6 +39,26 @@ export class ImagePopup extends Component {
categoryId: string;
girlId: number;
resId: number;
/**
* 获取屏幕外位置(完全在左侧屏幕外)
*/
private getOffscreenPosition(): Vec3 {
const visibleSize = view.getVisibleSize();
const x = -visibleSize.width; // 完全在屏幕左侧外
const y = visibleSize.height * 0.33; // 屏幕高度的1/3处
return new Vec3(x, y, 0);
}
/**
* 获取屏幕内位置(左侧边缘内侧)
*/
private getOnscreenPosition(): Vec3 {
const visibleSize = view.getVisibleSize();
const x = -visibleSize.width/2 + 100; // 从左边缘向内100像素
const y = visibleSize.height * 0.33; // 屏幕高度的1/3处
return new Vec3(x, y, 0);
}
//url: string;
refresh(categoryId: string, girlId: number, resId: number, clear = false) {
this.node.active = true;
@@ -96,16 +119,25 @@ export class ImagePopup extends Component {
//
}
popUp() {
if (this.isAnimating) return;
this.isAnimating = true;
tween(this.node)
.to(0.5, { position: new Vec3(-559.374, 493, 0) }, { easing: "backOut" })
.to(0.5, { position: this.getOnscreenPosition() }, { easing: "backOut" })
.call(() => {
this.scheduleOnce(() => {
this.popDown();
}, 3);
})
.start();
this.scheduleOnce(() => {
this.popDown();
}, 5);
}
popDown() {
tween(this.node)
.to(0.5, { position: new Vec3(-1500, 493, 0) }, { easing: "backIn" })
.to(0.5, { position: this.getOffscreenPosition() }, { easing: "backIn" })
.call(() => {
this.isAnimating = false;
})
.start();
}
}