diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index dde57a65..93f26229 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -45,7 +45,7 @@ export class MissionCardComp extends CCComp { onLoad() { if (this.btnClose) { - this.btnClose.on(Node.EventType.TOUCH_END, this.close, this); + this.btnClose.on(Node.EventType.TOUCH_END, this.onGiveUp, this); } oops.message.on(GameEvent.TalentSelect, this.onTalentSelect, this); @@ -59,7 +59,7 @@ export class MissionCardComp extends CCComp { onDestroy() { if (this.btnClose) { - this.btnClose.off(Node.EventType.TOUCH_END, this.close, this); + this.btnClose.off(Node.EventType.TOUCH_END, this.onGiveUp, this); } oops.message.off(GameEvent.TalentSelect, this.onTalentSelect, this); @@ -371,6 +371,31 @@ export class MissionCardComp extends CCComp { } } + /** 放弃选择 */ + onGiveUp() { + if (this.hasSelected) return; + this.hasSelected = true; + + // 隐藏关闭按钮 + if (this.btnClose) { + this.btnClose.active = false; + } + + const cards = [this.card1, this.card2, this.card3, this.card4]; + let delayTime = 0.2; + + cards.forEach(card => { + if (card && card.active) { + tween(card).to(delayTime, { scale: Vec3.ZERO }).start(); + } + }); + + // 动画结束后关闭 + this.scheduleOnce(() => { + this.close(); + }, delayTime); + } + /** * 关闭界面 */