feat(missionCard): 新增召唤英雄前的面板锁定机制

1.  为角色控制器预制体绑定home_btn节点
2.  添加nock_node节点引用与召唤状态标记
3.  新增面板交互状态更新方法,通过阻挡层控制按钮可用性
4.  在技能/商店/装备面板点击事件中增加召唤英雄前置校验
5.  首次召唤英雄后解锁所有功能面板并重置初始状态
This commit is contained in:
panFD
2026-07-22 22:22:24 +08:00
parent db981e89ce
commit a3354d9595
3 changed files with 1262 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);
@@ -523,6 +532,11 @@ export class MissionCardComp extends CCComp {
*/
private onShowSkillsClick() {
if (!this.skill_card_node || !this.skill_card_node.isValid) return;
// 未召唤英雄时阻止打开技能面板
if (!this.hasCalledHero) {
oops.gui.toast("请先召唤一个英雄");
return;
}
oops.audio.playEffect("music/button");
const visible = !this.skill_card_node.active;
if (visible) {
@@ -555,6 +569,11 @@ export class MissionCardComp extends CCComp {
*/
private onShowShopClick() {
if (!this.shopPanNode || !this.shopPanNode.isValid) return;
// 未召唤英雄时阻止打开商店面板
if (!this.hasCalledHero) {
oops.gui.toast("请先召唤一个英雄");
return;
}
oops.audio.playEffect("music/button");
const visible = !this.shopPanNode.active;
if (visible) {
@@ -731,6 +750,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 +882,34 @@ export class MissionCardComp extends CCComp {
this.playButtonResetAnim(this.cards_chou);
}
/**
* 更新面板按钮的可交互状态。
* 游戏刚开始时(未召唤英雄),只有英雄面板可打开;
* 召唤第一个英雄后,其他面板才允许点击。
* 通过 nock_node阻挡层控制按钮是否可点击而非隐藏按钮本身。
*/
private updatePanelButtonsInteractable() {
const interactable = this.hasCalledHero;
// 技能面板按钮:显示按钮但用 nock_node 阻挡点击
if (this.showSkills && this.showSkills.isValid) {
this.showSkills.active = true;
const nock = this.showSkills.getChildByName("nock");
if (nock) nock.active = !interactable;
}
// 装备商店按钮:显示按钮但用 nock_node 阻挡点击
if (this.showEquips && this.showEquips.isValid) {
this.showEquips.active = true;
const nock = this.showEquips.getChildByName("nock");
if (nock) nock.active = !interactable;
}
// 商品商店按钮:显示按钮但用 nock_node 阻挡点击
if (this.showShop && this.showShop.isValid) {
this.showShop.active = true;
const nock = this.showShop.getChildByName("nock");
if (nock) nock.active = !interactable;
}
}
/**
* 关闭所有面板(英雄卡池、技能卡池、装备商店、商品商店)。
* 用于打开新面板前确保同时只显示一个面板。
@@ -944,6 +997,11 @@ export class MissionCardComp extends CCComp {
*/
private onShowEquipsClick() {
if (!this.equipsPanNode || !this.equipsPanNode.isValid) return;
// 未召唤英雄时阻止打开装备面板
if (!this.hasCalledHero) {
oops.gui.toast("请先召唤一个英雄");
return;
}
oops.audio.playEffect("music/button");
const visible = !this.equipsPanNode.active;
if (visible) {