This commit is contained in:
2025-10-26 12:00:44 +08:00
parent 2e6a8b80a7
commit ef4099b873
23 changed files with 4746 additions and 8950 deletions

View File

@@ -22,13 +22,13 @@ export class HInfoComp extends CCComp {
// 英雄位置定义
hero_pos:any={
0:v3(420,-109,0), // 不在屏幕内
1:v3(280,-109,0),
2:v3(140,-109,0),
3:v3(0,-109,0),
4:v3(-140,-109,0),
5:v3(-280,-109,0),
6:v3(-420,-109,0), // 不在屏幕内
0:v3(420,-57,0), // 不在屏幕内
1:v3(280,-57,0),
2:v3(140,-57,0),
3:v3(0,-67,0),
4:v3(-140,-57,0),
5:v3(-280,-57,0),
6:v3(-420,-57,0), // 不在屏幕内
}
// 动画锁定标志:防止快速点击导致的动画冲突
@@ -88,6 +88,13 @@ export class HInfoComp extends CCComp {
// 载入英雄预制体并设置位置
this.heroNodes[i] = this.load_hui(heroUuid, i);
// 添加初始缩放动画确保3号位是1.5倍
if (this.heroNodes[i] && i === 3) {
tween(this.heroNodes[i])
.to(0.2, { scale: v3(-1.5, 1.5, 1) })
.start();
}
}
this.show_lock()
}
@@ -101,6 +108,12 @@ export class HInfoComp extends CCComp {
// 设置节点位置
node.setPosition(this.hero_pos[pos_index]);
node.setSiblingIndex(0);
// 设置缩放3号位1.5倍其他位置1倍
if(pos_index==3){
node.setScale(v3(-1.5,1.5,1))
} else {
node.setScale(v3(-1,1,1))
}
// 加载并播放动画
let anm_path=HeroInfo[uuid].path;
resources.load("game/heros/hero/"+anm_path+"/idle", AnimationClip, (err, clip) => {
@@ -210,9 +223,11 @@ export class HInfoComp extends CCComp {
// 计算目标位置:向左移动
let targetPos = this.hero_pos[i + 1];
// 使用Tween执行平滑移动
// 使用Tween执行平滑移动和缩放动画
let targetScale = (i + 1) === 3 ? v3(-1.5, 1.5, 1) : v3(-1, 1, 1);
tween(this.heroNodes[i])
.to(0.2, { position: targetPos })
.to(0.2, { position: targetPos, scale: targetScale })
.start();
}
}
@@ -236,6 +251,11 @@ export class HInfoComp extends CCComp {
this.heroNodes[0] = this.load_hui(heros[newIndex], 0);
// 确保新创建的节点初始缩放为1倍因为0号位不是中心位置
if (this.heroNodes[0]) {
this.heroNodes[0].setScale(v3(-1, 1, 1));
}
// 动画完成,解除锁定
this.isMoving = false;
this.moveTimeoutId = null;
@@ -263,9 +283,11 @@ export class HInfoComp extends CCComp {
// 计算目标位置:向右移动
let targetPos = this.hero_pos[i - 1];
// 使用Tween执行平滑移动
// 使用Tween执行平滑移动和缩放动画
let targetScale = (i - 1) === 3 ? v3(-1.5, 1.5, 1) : v3(-1, 1, 1);
tween(this.heroNodes[i])
.to(0.2, { position: targetPos })
.to(0.2, { position: targetPos, scale: targetScale })
.start();
}
}
@@ -289,6 +311,11 @@ export class HInfoComp extends CCComp {
this.heroNodes[6] = this.load_hui(heros[newIndex], 6);
// 确保新创建的节点初始缩放为1倍因为6号位不是中心位置
if (this.heroNodes[6]) {
this.heroNodes[6].setScale(v3(-1, 1, 1));
}
// 动画完成,解除锁定
this.isMoving = false;
this.moveTimeoutId = null;