refactor(map): 移除卡牌购买限购逻辑,改为可重复购买
1. 重构SCardComp、ItemListComp、EquipListComp的isPurchased注释与逻辑,不再用于限制重复购买 2. 删除MissionCardComp中的跨波次购买记录集合与相关监听、标记逻辑 3. 调整购买按钮逻辑,购买后保持可见不再隐藏
This commit is contained in:
@@ -72,7 +72,7 @@ export class ItemListComp extends CCComp {
|
||||
|
||||
/** 当前商品的卡牌配置 */
|
||||
private cardData: CardConfig | null = null;
|
||||
/** 是否已购买 */
|
||||
/** 购买/逝去动画播放中标记(仅用于跳过新卡的普通逝去动画,不影响再次购买) */
|
||||
private isPurchased: boolean = false;
|
||||
/** 透明度组件(用于淡入淡出动画) */
|
||||
private opacityComp: UIOpacity | null = null;
|
||||
@@ -330,10 +330,10 @@ export class ItemListComp extends CCComp {
|
||||
* 2. 根据卡牌类型派发对应事件:
|
||||
* - 装备卡(trigger_type=Field)→ UseEquipCard → MissEquipComp
|
||||
* - 商品/药品卡(kind=Potion)→ UseItemCard → MissSkillsComp(一次性 buff 技能)
|
||||
* 3. 标记已购买,隐藏购买按钮。
|
||||
* 3. 播放购买动画,购买后可继续购买(购买按钮保持可见)。
|
||||
*/
|
||||
private onBuyClick() {
|
||||
if (!this.cardData || this.isPurchased) return;
|
||||
if (!this.cardData) return;
|
||||
|
||||
// 播放按钮点击回弹动画
|
||||
this.playBtnClickAnim();
|
||||
@@ -380,25 +380,17 @@ export class ItemListComp extends CCComp {
|
||||
});
|
||||
}
|
||||
|
||||
// 标记已购买
|
||||
this.isPurchased = true;
|
||||
if (this.buy_node) {
|
||||
this.buy_node.active = false;
|
||||
}
|
||||
|
||||
// 播放购买动画(卡牌放大 + 淡出)
|
||||
this.isPurchased = true;
|
||||
this.playPurchaseAnim();
|
||||
|
||||
// 派发 CardUsed 事件,触发整池刷新
|
||||
oops.message.dispatchEvent(GameEvent.CardUsed, this);
|
||||
}
|
||||
|
||||
/** 标记为已购买状态(用于跨波次保持购买记录) */
|
||||
/** 标记购买动画播放中(供外部在刷新前保持动画状态,不再用于限购) */
|
||||
setPurchased(): void {
|
||||
this.isPurchased = true;
|
||||
if (this.buy_node) {
|
||||
this.buy_node.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** ECS 组件移除时销毁节点 */
|
||||
|
||||
Reference in New Issue
Block a user