refactor(map): 统一关卡卡片交互拦截逻辑

移除各按钮点击的前置拦截,改为统一通过nock节点阻挡未召唤英雄时的点击
This commit is contained in:
panFD
2026-07-22 22:28:35 +08:00
parent a3354d9595
commit ce5fda3586

View File

@@ -532,11 +532,6 @@ 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) {
@@ -569,11 +564,6 @@ 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) {
@@ -890,23 +880,10 @@ export class MissionCardComp extends CCComp {
*/
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;
// nock_node 是覆盖在其他按钮上的阻挡层:
// 未召唤英雄时激活(阻挡点击),召唤英雄后隐藏(允许点击)
if (this.nock_node && this.nock_node.isValid) {
this.nock_node.active = !interactable;
}
}
@@ -997,11 +974,6 @@ 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) {