ui调整
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "900676d0-c788-4ab0-8741-c7fd8ac75169",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
9
assets/script/game/common/interfaces.meta
Normal file
9
assets/script/game/common/interfaces.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "61005978-72d1-4d6b-9779-38495b2cb356",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "855727c2-30f9-4725-a913-0be50b80ddbd",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"importer": "text",
|
||||
"imported": true,
|
||||
"uuid": "a0f43271-04b8-4076-ad98-59501e4cda5b",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user