1 Commits

Author SHA1 Message Date
walkpan
af5b79b9a1 fix(gui/mission): 调整任务prefab的布局参数与激活状态
修正了任务界面预制体的位置、尺寸、对齐边距以及默认激活状态,修复界面显示错位问题
2026-05-15 19:42:38 +08:00
6 changed files with 46 additions and 22 deletions

View File

@@ -1382,7 +1382,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -330, "x": -330,
"y": 390.888, "y": 372.03,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -2604,7 +2604,7 @@
"__id__": 148 "__id__": 148
} }
], ],
"_active": false, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 156 "__id__": 156
@@ -2621,8 +2621,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 259.067,
"y": 208.926, "y": 158.268,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -2715,7 +2715,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 720, "width": 510.00000000000006,
"height": 50 "height": 50
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -3166,7 +3166,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 720, "width": 510.00000000000006,
"height": 50 "height": 50
}, },
"_anchorPoint": { "_anchorPoint": {
@@ -3236,8 +3236,8 @@
}, },
"_alignFlags": 40, "_alignFlags": 40,
"_target": null, "_target": null,
"_left": 0, "_left": 4.06699999999995,
"_right": 0, "_right": -4.06699999999995,
"_top": 0, "_top": 0,
"_bottom": 0, "_bottom": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
@@ -3316,7 +3316,7 @@
"_left": 30, "_left": 30,
"_right": 515, "_right": 515,
"_top": 0, "_top": 0,
"_bottom": 260.888, "_bottom": 242.02999999999997,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,

View File

@@ -320,6 +320,7 @@ export class HeroAttrsComp extends ecs.Comp {
this.maxSkillDistance = 0; this.maxSkillDistance = 0;
this.minSkillDistance = 0; this.minSkillDistance = 0;
this.is_dead = false; this.is_dead = false;
this.is_count_dead = false; this.is_count_dead = false;
this.is_atking = false; this.is_atking = false;

View File

@@ -446,13 +446,14 @@ export class HeroViewComp extends CCComp {
} }
if(this.model.fac === FacSet.HERO){ if(this.model.fac === FacSet.HERO){
// 英雄直接销毁,不再进入墓地 // 英雄移到玩家看不到的墓地
this.node.setPosition(v3(-2000, -2000, 0));
const collider = this.node.getComponent(Collider2D); const collider = this.node.getComponent(Collider2D);
if (collider) { if (collider) {
collider.enabled = false; collider.enabled = false;
} }
// 隐藏UI
this.top_node.active = false; this.top_node.active = false;
this.ent.destroy();
} else { } else {
// 🔥 方案B治理性措施 - 在销毁实体前先禁用碰撞体,从源头减少"尸体"参与碰撞 // 🔥 方案B治理性措施 - 在销毁实体前先禁用碰撞体,从源头减少"尸体"参与碰撞
const collider = this.node.getComponent(Collider2D); const collider = this.node.getComponent(Collider2D);

View File

@@ -433,6 +433,13 @@ export class MissionCardComp extends CCComp {
const payload = args ?? event; const payload = args ?? event;
if (!payload) return; if (!payload) return;
if (this.isBattlePhase) {
payload.cancel = true;
payload.reason = "battle_phase";
oops.gui.toast("战斗阶段无法召唤英雄");
return;
}
const current = this.getAliveHeroCount(); const current = this.getAliveHeroCount();
this.syncMissionHeroData(current); this.syncMissionHeroData(current);
const heroMax = this.getMissionHeroMaxNum(); const heroMax = this.getMissionHeroMaxNum();
@@ -664,10 +671,16 @@ export class MissionCardComp extends CCComp {
private enterBattlePhase() { private enterBattlePhase() {
if (!this.cards_node || !this.cards_node.isValid) return; if (!this.cards_node || !this.cards_node.isValid) return;
this.initCardsPanelPos(); this.initCardsPanelPos();
// 战斗阶段抽卡面板不再收起 // 战斗阶段不再隐藏抽卡面板
this.cards_node.active = true; // Tween.stopAllByTarget(this.cards_node);
Tween.stopAllByTarget(this.cards_node); // tween(this.cards_node)
this.cards_node.setScale(this.cardsShowScale); // .to(this.cardsPanelMoveDuration, { scale: this.cardsHideScale })
// .call(() => {
// if (this.cards_node && this.cards_node.isValid) {
// this.cards_node.active = false;
// }
// })
// .start();
this.cachedHInfoComps.forEach(comp => { this.cachedHInfoComps.forEach(comp => {
if (comp && comp.isValid) { if (comp && comp.isValid) {
@@ -680,8 +693,7 @@ export class MissionCardComp extends CCComp {
private buildDrawCards(): CardConfig[] { private buildDrawCards(): CardConfig[] {
let targetType: CardType | CardType[] | undefined = undefined; let targetType: CardType | CardType[] | undefined = undefined;
if (this.isBattlePhase) { if (this.isBattlePhase) {
// 战斗阶段只刷英雄卡牌,不刷其他卡牌 targetType = CardType.Skill;
targetType = CardType.Hero;
} else { } else {
targetType = [CardType.Hero, CardType.SpecialRefresh]; targetType = [CardType.Hero, CardType.SpecialRefresh];
} }

View File

@@ -520,9 +520,9 @@ export class MissionComp extends CCComp {
case MissionPhase.BattleEnd: case MissionPhase.BattleEnd:
// BattleEnd 计时结束后,如果是因为全灭或手动调用的 fight_end进入 Settle // BattleEnd 计时结束后,如果是因为全灭或手动调用的 fight_end进入 Settle
// 需要注意的是open_Victory / fight_end 现在只需切换到 BattleEnd 即可Settle 由这里自动接管 // 需要注意的是open_Victory / fight_end 现在只需切换到 BattleEnd 即可Settle 由这里自动接管
// 如果游戏正在运行(波次更迭),直接进入下一波的 BattleStart不再进入 PrepareStart // 如果游戏正在运行(波次更迭),则自动进入 PrepareStart 阶段
if (smc.mission.play && !smc.mission.pause) { if (smc.mission.play && !smc.mission.pause) {
this.changePhase(MissionPhase.BattleStart); this.changePhase(MissionPhase.PrepareStart);
} else { } else {
this.changePhase(MissionPhase.Settle); this.changePhase(MissionPhase.Settle);
@@ -566,7 +566,7 @@ export class MissionComp extends CCComp {
* - 显示开始按钮 * - 显示开始按钮
* - 触发英雄战斗结束技能 * - 触发英雄战斗结束技能
*/ */
enterPreparePhase() { private enterPreparePhase() {
this.changePhase(MissionPhase.PrepareStart); this.changePhase(MissionPhase.PrepareStart);
} }

View File

@@ -121,14 +121,24 @@ export class MissionHeroCompComp extends CCComp {
} }
} }
/** 战斗准备阶段:重置出战英雄计数,恢复满血 */ /** 战斗准备阶段:重置出战英雄计数,恢复满血重新登场 */
fight_ready(){ fight_ready(){
const heroes = this.getAllHeroes(); const heroes = this.getAllHeroes();
smc.vmdata.mission_data.hero_num = heroes.length; smc.vmdata.mission_data.hero_num = heroes.length;
for (let i = 0; i < heroes.length; i++) { for (let i = 0; i < heroes.length; i++) {
const hero = heroes[i]; const hero = heroes[i];
const model = hero.get(HeroAttrsComp); const model = hero.get(HeroAttrsComp);
if (model) { const view = hero.get(HeroViewComp);
if (model && view) {
if (model.is_dead) {
view.alive();
const landingPos = this.pickPositionForHero([hero.eid]);
// 不再直接设置位置,而是播放下落入场动画
// 计算出出生点(空中)
const spawnPos: Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0);
view.node.setPosition(spawnPos);
hero.playDropAnim(spawnPos, landingPos.y);
}
model.dirty_hp = true; model.dirty_hp = true;
} }
} }