Compare commits
2 Commits
c1d461516b
...
97ff09669c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97ff09669c | ||
|
|
486090682a |
@@ -97,6 +97,9 @@ export class CardComp extends CCComp {
|
||||
ap_node = null!
|
||||
@property(Node)
|
||||
hp_node = null!
|
||||
/** 金币不足提示节点(useCard 费用不足时显示 2 秒) */
|
||||
@property(Node)
|
||||
no_cion_node = null!
|
||||
|
||||
// ======================== 运行时状态 ========================
|
||||
|
||||
@@ -147,6 +150,8 @@ export class CardComp extends CCComp {
|
||||
this.applyEmptyUI();
|
||||
// call_btn 默认隐藏,仅在点击本卡时显示
|
||||
this.hideCallBtn();
|
||||
// 金币不足提示默认隐藏
|
||||
if (this.no_cion_node) this.no_cion_node.active = false;
|
||||
}
|
||||
|
||||
/** 组件销毁时解绑所有事件,防止残留回调 */
|
||||
@@ -307,6 +312,8 @@ export class CardComp extends CCComp {
|
||||
if (!success) {
|
||||
oops.message.dispatchEvent(GameEvent.ShowSmallTip, "buy_coin");
|
||||
this.playReboundAnim();
|
||||
// 显示"金币不足"提示节点 2 秒
|
||||
this.showNoCoinNode();
|
||||
mLogger.log(this.debugMode, "CardComp", "use card coin not enough", {
|
||||
uuid: this.cardData.uuid,
|
||||
type: this.cardData.type,
|
||||
@@ -754,7 +761,7 @@ export class CardComp extends CCComp {
|
||||
if (this.lvl_node) {
|
||||
// 升级卡:显示「当前→升级后」;普通英雄卡:显示当前等级。统一使用默认颜色
|
||||
if (isUpgradeCard && heroLv > 1) {
|
||||
this.lvl_node.string = `Lv.${heroLv - 1} Lv.${heroLv}`;
|
||||
this.lvl_node.string = `Lv.${heroLv - 1} -> Lv.${heroLv}`;
|
||||
} else {
|
||||
this.lvl_node.string = `Lv.${heroLv}`;
|
||||
}
|
||||
@@ -844,6 +851,26 @@ export class CardComp extends CCComp {
|
||||
.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示"金币不足"提示节点,2 秒后自动隐藏。
|
||||
* Why: useCard 金币不足时给玩家明确的视觉反馈。
|
||||
* 使用 scheduleOnce 与组件生命周期绑定,组件销毁时自动清理。
|
||||
*/
|
||||
private showNoCoinNode() {
|
||||
if (!this.no_cion_node) return;
|
||||
// 清理上一次的隐藏回调,避免连续触发时被提前关闭
|
||||
this.unschedule(this.hideNoCoinNode);
|
||||
this.no_cion_node.active = true;
|
||||
this.scheduleOnce(this.hideNoCoinNode, 2);
|
||||
}
|
||||
|
||||
/** 隐藏"金币不足"提示节点 */
|
||||
private hideNoCoinNode() {
|
||||
if (this.no_cion_node && this.no_cion_node.isValid) {
|
||||
this.no_cion_node.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用消失动画:
|
||||
* - 节点从当前位置向上移动 120px(X 轴保持当前值不变,不使用 restPosition.x)
|
||||
|
||||
@@ -262,7 +262,7 @@ export class MissionCardComp extends CCComp {
|
||||
|
||||
/**
|
||||
* 绑定所有事件监听:
|
||||
* - 节点级事件:MissionStart / MissionEnd / NewWave / FightStart
|
||||
* - 节点级事件:MissionStart / MissionEnd / FightStart
|
||||
* - 全局消息:CoinAdd / MasterCalled / HeroDead / UseHeroCard / UseSpecialCard
|
||||
* - 按钮触控:抽卡(cards_chou)
|
||||
*/
|
||||
@@ -270,7 +270,6 @@ export class MissionCardComp extends CCComp {
|
||||
/** 生命周期事件(节点级) */
|
||||
this.on(GameEvent.MissionStart, this.onMissionStart, this);
|
||||
this.on(GameEvent.MissionEnd, this.onMissionEnd, this);
|
||||
this.on(GameEvent.NewWave, this.onNewWave, this);
|
||||
this.on(GameEvent.FightStart, this.onFightStart, this);
|
||||
this.on("PhasePrepareStart", this.onPhasePrepareStart, this);
|
||||
|
||||
@@ -372,15 +371,6 @@ export class MissionCardComp extends CCComp {
|
||||
this.updateHeroNumUI(true, true);
|
||||
}
|
||||
|
||||
/** 新一波:展开面板 → 刷新费用 UI → 重新抽卡分发 */
|
||||
private onNewWave() {
|
||||
this.enterPreparePhase();
|
||||
this.updateCoinAndCostUI();
|
||||
this.layoutCardSlots();
|
||||
const cards = this.buildDrawCards();
|
||||
this.dispatchCardsToSlots(cards);
|
||||
}
|
||||
|
||||
/**
|
||||
* 技能卡入场动画:每个卡槽从场景基准位置下方 80px 处升起,
|
||||
* 终止位置 = 场景编辑器位置(保持初始不做位移的约束),
|
||||
|
||||
Reference in New Issue
Block a user