2 Commits

Author SHA1 Message Date
panFD
ce5fda3586 refactor(map): 统一关卡卡片交互拦截逻辑
移除各按钮点击的前置拦截,改为统一通过nock节点阻挡未召唤英雄时的点击
2026-07-22 22:28:35 +08:00
panFD
a3354d9595 feat(missionCard): 新增召唤英雄前的面板锁定机制
1.  为角色控制器预制体绑定home_btn节点
2.  添加nock_node节点引用与召唤状态标记
3.  新增面板交互状态更新方法,通过阻挡层控制按钮可用性
4.  在技能/商店/装备面板点击事件中增加召唤英雄前置校验
5.  首次召唤英雄后解锁所有功能面板并重置初始状态
2026-07-22 22:22:24 +08:00
3 changed files with 1234 additions and 149 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -8664,7 +8664,9 @@
"__prefab": {
"__id__": 391
},
"home_btn": null,
"home_btn": {
"__id__": 130
},
"hero_btn": {
"__id__": 83
},

View File

@@ -103,6 +103,8 @@ export class MissionCardComp extends CCComp {
/** 抽卡(刷新)按钮节点 */
@property(Node)
cards_chou: Node = null!
@property(Node)
nock_node: Node = null!
/** 英雄卡牌池cards_node显示隐藏 */
@property(Node)
@@ -175,6 +177,8 @@ export class MissionCardComp extends CCComp {
private cardComps: CardComp[] = [];
/** 技能卡槽控制器缓存 */
private skillCardComps: SCardComp[] = [];
/** 是否已召唤过英雄(用于控制其他面板按钮是否可点击) */
private hasCalledHero: boolean = false;
/** 已购买装备的 UUID 集合(跨波次保持,防止重复购买) */
private purchasedEquipUuids: Set<number> = new Set();
/** 已购买商品的 UUID 集合(跨波次保持,防止重复购买) */
@@ -296,6 +300,10 @@ export class MissionCardComp extends CCComp {
this.purchasedItemUuids.clear();
this.populateShopItems();
// 重置英雄召唤状态(游戏刚开始时其他面板不可点击)
this.hasCalledHero = false;
this.updatePanelButtonsInteractable();
// 首次进入准备阶段自动抽取一次技能卡,后续刷新只能通过技能刷新按钮触发
this.initSkillCardsOnce();
@@ -496,14 +504,15 @@ export class MissionCardComp extends CCComp {
* 首次进入准备阶段时自动抽取一次技能卡:
* - 仅在任务开始时调用一次。
* - 后续抽卡只能通过技能刷新按钮触发。
* - 游戏刚开始时不激活技能面板(等召唤第一个英雄后才开放)。
*/
private initSkillCardsOnce() {
if (this.skillCardComps.length === 0) {
this.cacheCardComps();
}
// 显示技能卡牌面板
// 游戏刚开始时不显示技能卡牌面板(等召唤英雄后才开放)
if (this.skill_card_node) {
this.skill_card_node.active = true;
this.skill_card_node.active = false;
}
const cards = this.buildSkillDrawCards();
this.dispatchCardsToSkillSlots(cards);
@@ -731,6 +740,12 @@ export class MissionCardComp extends CCComp {
const after = this.getAliveHeroCount();
this.updateHeroNumUI(true, after > before);
// 第一次召唤英雄后,开放其他面板按钮
if (!this.hasCalledHero) {
this.hasCalledHero = true;
this.updatePanelButtonsInteractable();
}
// 第一次召唤英雄后关闭guide3
// 注:首个英雄召唤后战斗自动开始(见 MissionComp不再需要 Guide4 引导点击开始按钮
if (!smc.finish_guides.includes(3)) {
@@ -857,6 +872,21 @@ export class MissionCardComp extends CCComp {
this.playButtonResetAnim(this.cards_chou);
}
/**
* 更新面板按钮的可交互状态。
* 游戏刚开始时(未召唤英雄),只有英雄面板可打开;
* 召唤第一个英雄后,其他面板才允许点击。
* 通过 nock_node阻挡层控制按钮是否可点击而非隐藏按钮本身。
*/
private updatePanelButtonsInteractable() {
const interactable = this.hasCalledHero;
// nock_node 是覆盖在其他按钮上的阻挡层:
// 未召唤英雄时激活(阻挡点击),召唤英雄后隐藏(允许点击)
if (this.nock_node && this.nock_node.isValid) {
this.nock_node.active = !interactable;
}
}
/**
* 关闭所有面板(英雄卡池、技能卡池、装备商店、商品商店)。
* 用于打开新面板前确保同时只显示一个面板。