refactor: 统一将 pool_lv 重命名为 card_lv 并清理废弃代码

本次提交完成了全项目范围内的术语统一重构:
1.  将所有`pool_lv`相关变量、字段、注释替换为`card_lv`,对齐卡牌等级的业务含义
2.  移除了配置中冗余的默认`pool_lv`赋值,简化数据结构
3.  删除了废弃的`HlistComp.ts`组件及其元文件
4.  修正了多处逻辑错误,确保卡牌等级正确驱动背景框切换
5.  更新了相关注释和文档,保持代码一致性
This commit is contained in:
pan
2026-07-27 15:54:53 +08:00
parent 62264deeed
commit 9f2599e9ec
21 changed files with 137 additions and 467 deletions

View File

@@ -73,7 +73,7 @@ export class MissionHeroComp extends CCComp {
/** 是否正在消费召唤队列(防止并发) */
is_processing_queue: boolean = false
/** 召唤请求队列:保证召唤按顺序串行执行 */
summon_queue: { uuid: number; hero_lv: number; pool_lv: number }[] = []
summon_queue: { uuid: number; hero_lv: number; card_lv: number }[] = []
/** 预留英雄列表 */
heros: any = []
@@ -141,17 +141,17 @@ export class MissionHeroComp extends CCComp {
/**
* 召唤请求入口:
* 从事件参数中提取 uuid / hero_lv / pool_lv放入串行队列。
* 从事件参数中提取 uuid / hero_lv / card_lv放入串行队列。
* 防御:已召唤的英雄 uuid 拒绝重复召唤(只能通过升级卡升级)。
*
* @param event 事件名
* @param args { uuid, hero_lv, pool_lv }
* @param args { uuid, hero_lv, card_lv }
*/
private async call_hero(event: string, args: any) {
const payload = args ?? event;
const uuid = Number(payload?.uuid ?? 1001);
const hero_lv = Math.max(1, Number(payload?.hero_lv ?? 1));
const pool_lv = Math.max(1, Number(payload?.pool_lv ?? 1));
const card_lv = Math.max(1, Number(payload?.card_lv ?? 1));
// 防御:场上已有同 uuid 的存活英雄时,拒绝重复召唤
if (this.isHeroAlreadySummoned(uuid)) {
@@ -159,7 +159,7 @@ export class MissionHeroComp extends CCComp {
return;
}
this.summon_queue.push({ uuid, hero_lv, pool_lv });
this.summon_queue.push({ uuid, hero_lv, card_lv });
this.processSummonQueue();
}
@@ -216,16 +216,16 @@ export class MissionHeroComp extends CCComp {
*
* @param uuid 英雄 UUID
* @param hero_lv 英雄等级
* @param pool_lv 卡等级(历史遗留,新机制下不再使用
* @param card_lv 卡等级(驱动 bg_node 颜色
* @returns 创建的 Hero 实体
*/
private addHero(uuid: number = 1001, hero_lv: number = 1, pool_lv: number = 1) {
private addHero(uuid: number = 1001, hero_lv: number = 1, card_lv: number = 1) {
let hero = ecs.getEntity<Hero>(Hero);
let scale = 1
const posIndex = this.pickPositionIndexForHero();
const landingPos = MissionHeroComp.HERO_POSITIONS[posIndex];
let spawnPos: Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
hero.load(spawnPos, scale, uuid, landingPos.y, hero_lv, pool_lv, posIndex);
hero.load(spawnPos, scale, uuid, landingPos.y, hero_lv, card_lv, posIndex);
// 召唤完成后,派发事件以更新英雄面板
const model = hero.get(HeroAttrsComp);
@@ -267,7 +267,7 @@ export class MissionHeroComp extends CCComp {
while (this.summon_queue.length > 0) {
const payload = this.summon_queue.shift();
if (!payload) continue;
await this.handleSingleSummon(payload.uuid, payload.hero_lv, payload.pool_lv);
await this.handleSingleSummon(payload.uuid, payload.hero_lv, payload.card_lv);
}
} finally {
this.is_processing_queue = false;
@@ -279,10 +279,10 @@ export class MissionHeroComp extends CCComp {
*
* @param uuid 英雄 UUID
* @param hero_lv 英雄等级
* @param pool_lv 卡等级(历史遗留)
* @param card_lv 卡等级
*/
private async handleSingleSummon(uuid: number, hero_lv: number, pool_lv: number = 1) {
this.addHero(uuid, hero_lv, pool_lv);
private async handleSingleSummon(uuid: number, hero_lv: number, card_lv: number = 1) {
this.addHero(uuid, hero_lv, card_lv);
}