refactor(map): 移除所有卡牌购买的扣费逻辑,改为免费获取
统一调整四个卡牌组件的购买流程,删除MissionEconomy导入和扣费校验代码,更新注释说明当前为免费购买模式,简化日志输出内容
This commit is contained in:
@@ -23,7 +23,6 @@ import { buildCardDescRich, buildEquipRich } from "../common/config/HeroSkillDes
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { getCardIconId, setSpriteFrame } from "../common/CardIconHelper";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { MissionEconomy } from "./MissionEconomy";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -340,19 +339,7 @@ export class ItemListComp extends CCComp {
|
||||
|
||||
oops.audio.playEffect("music/button");
|
||||
|
||||
// 扣费
|
||||
const cost = this.cardData.cost ?? 0;
|
||||
const success = MissionEconomy.spendCoin(cost);
|
||||
if (!success) {
|
||||
oops.message.dispatchEvent(GameEvent.ShowSmallTip, "buy_coin");
|
||||
mLogger.log(this.debugMode, "ItemListComp", "purchase failed: not enough coin", {
|
||||
uuid: this.cardData.uuid,
|
||||
cost
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据类型派发对应事件
|
||||
// 购买不花费金币(免费获取),直接根据类型派发对应事件
|
||||
const isEquip = this.cardData.trigger_type === CardTriggerType.Field;
|
||||
const isPotion = this.cardData.kind === CKind.Potion;
|
||||
|
||||
@@ -360,23 +347,20 @@ export class ItemListComp extends CCComp {
|
||||
// 装备:被动驻场,由 MissEquipComp 处理
|
||||
oops.message.dispatchEvent(GameEvent.UseEquipCard, this.cardData);
|
||||
mLogger.log(this.debugMode, "ItemListComp", "equipment purchased", {
|
||||
uuid: this.cardData.uuid,
|
||||
cost
|
||||
uuid: this.cardData.uuid
|
||||
});
|
||||
} else if (isPotion) {
|
||||
// 商品/药品:一次性 buff 技能,由 MissSkillsComp 处理
|
||||
oops.message.dispatchEvent(GameEvent.UseItemCard, this.cardData);
|
||||
mLogger.log(this.debugMode, "ItemListComp", "item purchased", {
|
||||
uuid: this.cardData.uuid,
|
||||
skill: this.cardData.skill,
|
||||
cost
|
||||
skill: this.cardData.skill
|
||||
});
|
||||
} else {
|
||||
// 默认走技能卡流程
|
||||
oops.message.dispatchEvent(GameEvent.UseSkillCard, this.cardData);
|
||||
mLogger.log(this.debugMode, "ItemListComp", "card purchased", {
|
||||
uuid: this.cardData.uuid,
|
||||
cost
|
||||
uuid: this.cardData.uuid
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user