diff --git a/assets/resources/gui/role_controller.prefab b/assets/resources/gui/role_controller.prefab index 8402ab40..4a5b2093 100644 --- a/assets/resources/gui/role_controller.prefab +++ b/assets/resources/gui/role_controller.prefab @@ -180,7 +180,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -300, + "x": -276.526, "y": 1130, "z": 0 }, @@ -230,7 +230,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 14.894, + "x": 0, "y": -5, "z": 0 }, @@ -369,7 +369,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -21.369, + "x": -30.654, "y": 0, "z": 0 }, @@ -508,7 +508,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 40.92, + "x": 24.748, "y": 0, "z": 0 }, @@ -658,8 +658,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 100, - "height": 60 + "width": 150, + "height": 100 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -758,9 +758,9 @@ }, "_alignFlags": 9, "_target": null, - "_left": 10, + "_left": 8.47399999999999, "_right": 20, - "_top": 120, + "_top": 100, "_bottom": 35, "_horizontalCenter": 0, "_verticalCenter": 0, diff --git a/assets/script/game/map/HInfoComp.ts b/assets/script/game/map/HInfoComp.ts index 93916b69..c90d5eb6 100644 --- a/assets/script/game/map/HInfoComp.ts +++ b/assets/script/game/map/HInfoComp.ts @@ -147,12 +147,18 @@ export class HInfoComp extends Component { this.moveHeroesLeft(); } - moveHeroesRight() { - // 移动所有现有节点向右 - for (let i = 0; i < this.heroNodes.length; i++) { + moveHeroesLeft() { + // 在动画开始前,直接销毁hero_pos[6]上的节点 + if (this.heroNodes[6]) { + this.heroNodes[6].destroy(); + this.heroNodes[6] = null; + } + + // 移动所有现有节点向左(除了已销毁的heroNodes[6]) + for (let i = 0; i < 6; i++) { if (this.heroNodes[i]) { - // 计算目标位置 - let targetPos = this.hero_pos[i + 1] || this.hero_pos[0]; + // 计算目标位置:向左移动 + let targetPos = this.hero_pos[i + 1]; // 使用Tween执行平滑移动 tween(this.heroNodes[i]) @@ -161,14 +167,9 @@ export class HInfoComp extends Component { } } - // 延迟创建新节点和删除旧节点,等待动画完成 + // 延迟重排数组和创建新节点,等待动画完成 setTimeout(() => { - // 删除原先位于hero_pos[6]位置的节点 - if (this.heroNodes[6]) { - this.heroNodes[6].destroy(); - } - - // 移动数组元素 + // 移动数组元素(向后平移) for (let i = 6; i > 0; i--) { this.heroNodes[i] = this.heroNodes[i - 1]; } @@ -187,12 +188,18 @@ export class HInfoComp extends Component { }, 300); // 与动画时间保持一致 } - moveHeroesLeft() { - // 移动所有现有节点向左 - for (let i = 0; i < this.heroNodes.length; i++) { + moveHeroesRight() { + // 在动画开始前,直接销毁hero_pos[0]上的节点 + if (this.heroNodes[0]) { + this.heroNodes[0].destroy(); + this.heroNodes[0] = null; + } + + // 移动所有现有节点向右(除了已销毁的heroNodes[0]) + for (let i = 1; i < this.heroNodes.length; i++) { if (this.heroNodes[i]) { - // 计算目标位置 - let targetPos = this.hero_pos[i - 1] || this.hero_pos[6]; + // 计算目标位置:向右移动 + let targetPos = this.hero_pos[i - 1]; // 使用Tween执行平滑移动 tween(this.heroNodes[i]) @@ -201,14 +208,9 @@ export class HInfoComp extends Component { } } - // 延迟创建新节点和删除旧节点,等待动画完成 + // 延迟重排数组和创建新节点,等待动画完成 setTimeout(() => { - // 删除原先位于hero_pos[0]位置的节点 - if (this.heroNodes[0]) { - this.heroNodes[0].destroy(); - } - - // 移动数组元素 + // 移动数组元素(向前平移) for (let i = 0; i < 6; i++) { this.heroNodes[i] = this.heroNodes[i + 1]; } @@ -227,9 +229,6 @@ export class HInfoComp extends Component { }, 300); // 与动画时间保持一致 } - close(){ - oops.gui.removeByNode(this.node) - } reset() { this.node.destroy() }