diff --git a/assets/script/game/map/MissionCardComp.ts b/assets/script/game/map/MissionCardComp.ts index 93f26229..92168364 100644 --- a/assets/script/game/map/MissionCardComp.ts +++ b/assets/script/game/map/MissionCardComp.ts @@ -43,6 +43,9 @@ export class MissionCardComp extends CCComp { // 已购买的卡片槽位标记 (用于物品购买) purchasedSlots: boolean[] = [false, false, false, false, false]; + // 是否处于锁定状态 + private isLocked: boolean = true; + onLoad() { if (this.btnClose) { this.btnClose.on(Node.EventType.TOUCH_END, this.onGiveUp, this); @@ -77,7 +80,8 @@ export class MissionCardComp extends CCComp { /** 游戏开始初始化 */ onMissionStart() { - this.Lock.active = true; + this.isLocked = true; + if (this.Lock) this.Lock.active = false; // 初始不显示,等待 showCardType this.eventQueue = []; } @@ -165,6 +169,11 @@ export class MissionCardComp extends CCComp { this.btnClose.active = (type === CardType.Potion); } + // 根据锁定状态显示 Lock 节点 + if (this.Lock) { + this.Lock.active = this.isLocked; + } + this.resetCardStates(); this.refCards(); this.playShowAnimation(); @@ -365,6 +374,7 @@ export class MissionCardComp extends CCComp { console.log("播放激励视频广告..."); // 模拟广告播放成功回调 + this.isLocked = false; if (this.Lock) { this.Lock.active = false; oops.gui.toast("解锁成功"); @@ -407,6 +417,11 @@ export class MissionCardComp extends CCComp { this.btnClose.active = false; } + // 关闭时隐藏 Lock 节点 + if (this.Lock) { + this.Lock.active = false; + } + this.checkQueue(); }