refactor(hero system): 重构英雄升级与卡片展示逻辑
1. 重构英雄升级方法,移除外部传入所需碎片参数,改为从配置表自动读取 2. 简化CardLiteComp.setHeroByUuid,移除卡池等级参数,直接读取英雄静态配置 3. 新增ChipComp.setHeroIconByUuid,重构英雄图标渲染逻辑 4. 新增英雄详情面板的升级功能与碎片展示 5. 新增英雄成长变化的事件监听与面板刷新逻辑
This commit is contained in:
@@ -112,29 +112,22 @@ export class CardLiteComp extends CCComp {
|
||||
}
|
||||
|
||||
/**
|
||||
* 便捷方法:通过英雄 UUID 和卡池等级直接设置英雄卡。
|
||||
* 自动从 CardPoolList 查找匹配的卡牌配置。
|
||||
* 通过英雄 UUID 直接设置英雄卡(纯展示场景)。
|
||||
* 从 HeroInfo 读取静态配置,不再依赖 CardPoolList。
|
||||
* @param uuid 英雄 UUID
|
||||
* @param cardLv 卡牌等级(默认 1)
|
||||
*/
|
||||
setHeroByUuid(uuid: number, cardLv: number = 1) {
|
||||
const card = CardPoolList.find(c => c.uuid === uuid && c.card_lv === cardLv);
|
||||
if (card) {
|
||||
this.setData(card);
|
||||
return;
|
||||
}
|
||||
setHeroByUuid(uuid: number) {
|
||||
const hero = HeroInfo[uuid];
|
||||
if (hero) {
|
||||
this.setData({
|
||||
uuid: hero.uuid,
|
||||
type: CardType.Hero,
|
||||
cost: 5,
|
||||
weight: 25,
|
||||
card_lv: cardLv,
|
||||
kind: CKind.Hero,
|
||||
hero_lv: smc.getHeroOuterLv(hero.uuid)
|
||||
});
|
||||
}
|
||||
if (!hero) return;
|
||||
this.setData({
|
||||
uuid: hero.uuid,
|
||||
type: CardType.Hero,
|
||||
cost: 0,
|
||||
weight: 0,
|
||||
card_lv: hero.card_lv ?? 1,
|
||||
kind: CKind.Hero,
|
||||
hero_lv: smc.getHeroOuterLv(hero.uuid)
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询当前是否有卡牌数据 */
|
||||
|
||||
Reference in New Issue
Block a user