feat(hero box): 添加英雄面板空槽位点击交互
1. 新增GameEvent.HeroBoxEmptyClick事件用于空槽位点击通知 2. 为HeroBoxComp添加空槽位节点和点击回调,播放点击动画并派发事件 3. 在MissionCardComp中注册该事件,点击时打开英雄卡池选择界面 4. 完善空槽位的显示/隐藏逻辑
This commit is contained in:
@@ -388,6 +388,7 @@ export class MissionCardComp extends CCComp {
|
||||
oops.message.on(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
|
||||
oops.message.on(GameEvent.ShowSmallTip, this.onShowSmallTip, this);
|
||||
oops.message.on(GameEvent.CardUsed, this.onCardUsed, this);
|
||||
oops.message.on(GameEvent.HeroBoxEmptyClick, this.onHeroBoxEmptyClick, this);
|
||||
|
||||
/** 按钮触控事件:抽卡 */
|
||||
this.cards_chou?.on(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
|
||||
@@ -629,6 +630,7 @@ export class MissionCardComp extends CCComp {
|
||||
oops.message.off(GameEvent.UseSpecialCard, this.onUseSpecialCard, this);
|
||||
oops.message.off(GameEvent.ShowSmallTip, this.onShowSmallTip, this);
|
||||
oops.message.off(GameEvent.CardUsed, this.onCardUsed, this);
|
||||
oops.message.off(GameEvent.HeroBoxEmptyClick, this.onHeroBoxEmptyClick, this);
|
||||
if (this.cards_chou && this.cards_chou.isValid) {
|
||||
this.cards_chou.off(NodeEventType.TOUCH_START, this.onDrawTouchStart, this);
|
||||
this.cards_chou.off(NodeEventType.TOUCH_END, this.onDrawTouchEnd, this);
|
||||
@@ -716,6 +718,11 @@ export class MissionCardComp extends CCComp {
|
||||
this.refreshHeroBoxSlots();
|
||||
}
|
||||
|
||||
/** 英雄面板空槽位点击回调:展示英雄卡池选择界面 */
|
||||
private onHeroBoxEmptyClick() {
|
||||
this.onShowCardsClick();
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用英雄卡的 guard 校验(由 CHeroComp 通过 UseHeroCard 事件调用):
|
||||
* - 当前英雄数 < 上限 → 允许使用。
|
||||
|
||||
Reference in New Issue
Block a user