feat(hero): 新增英雄详情弹窗与图鉴页面重构

1.  新增HeroInfoComp英雄详情弹窗,支持英雄属性展示、升级操作、前后切换功能
2.  重构HerosListComp图鉴页面,将详情面板逻辑剥离至弹窗,点击卡片直接打开详情页
3.  新增英雄列表排序工具函数,统一图鉴与弹窗切换的排序逻辑
4.  优化战斗渲染排序逻辑,移除无关的Y轴渲染权重计算
5.  新增英雄详情弹窗UI配置与预制体资源
This commit is contained in:
panFD
2026-09-18 11:22:03 +08:00
parent 93dc59a616
commit 63a9f6cba5
9 changed files with 16410 additions and 15910 deletions

View File

@@ -56,7 +56,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
private readonly renderSortInterval = 0.05;
private lastRenderSortAt = 0;
private heroViewMatcher: ecs.IMatcher | null = null;
private readonly renderEntries: { node: Node; bossPriority: number; frontScore: number; spawnOrder: number; eid: number; laneScore: number; isCastingMax: boolean }[] = [];
private readonly renderEntries: { node: Node; spawnOrder: number; eid: number; isCastingMax: boolean }[] = [];
private renderEntryCount = 0;
// ======================== 英雄编队排队 ========================
@@ -431,8 +431,8 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
const monRoot = layerNode.getChildByName("MON");
const bossRoot = layerNode.getChildByName("BOSS");
/** 分层重排同层节点:各阵营层内按 Y 轴路次 -> 前后位置 -> 出生序 -> eid 排序
* (Boss 已有独立 BOSS 层固定在最底,无需 bossPriority 参与排序) */
/** 分层重排同层节点:层内层级只由「是否释放大招」决定,出生序/eid 仅保证排序稳定
* (Boss 已有独立 BOSS 层固定在最底,天然在最下层) */
this.renderEntryCount = 0;
ecs.query(this.getHeroViewMatcher()).forEach(e => {
const attrs = e.get(HeroAttrsComp);
@@ -456,20 +456,13 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
const move = e.get(MoveComp);
const spawnOrder = move?.spawnOrder ?? 0;
// 按 Y 轴计算渲染层级权重(Y 越小,说明越靠近屏幕下方,应该渲染在越前面)
const laneScore = -actorView.node.position.y;
// X 轴权重:站在前排的(交战处)优先渲染
const frontScore = attrs.fac === FacSet.HERO ? actorView.node.position.x : -actorView.node.position.x;
const entryIndex = this.renderEntryCount;
let entry = this.renderEntries[entryIndex];
if (!entry) {
entry = { node: actorView.node, bossPriority: 0, frontScore: 0, spawnOrder: 0, eid: 0, laneScore: 0, isCastingMax: false };
entry = { node: actorView.node, spawnOrder: 0, eid: 0, isCastingMax: false };
this.renderEntries.push(entry);
}
entry.node = actorView.node;
entry.laneScore = laneScore;
entry.frontScore = frontScore;
entry.spawnOrder = spawnOrder;
entry.eid = e.eid;
entry.isCastingMax = actorView.isCastingMax;
@@ -478,11 +471,9 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
this.renderEntries.length = this.renderEntryCount;
this.renderEntries.sort((a, b) => {
// 正在播放大招的英雄排在最后,siblingIndex 越大渲染层级越靠上
// 层级只受大招影响:正在播放大招的单位排在最后,siblingIndex 越大渲染层级越靠上
if (a.isCastingMax !== b.isCastingMax) return a.isCastingMax ? 1 : -1;
// Y轴靠下的(laneScore 较大)应该在后面,从而渲染在上面
if (Math.abs(a.laneScore - b.laneScore) > 10) return a.laneScore - b.laneScore;
if (a.frontScore !== b.frontScore) return a.frontScore - b.frontScore;
// 与位置无关的稳定排序:出生序 -> eid
if (a.spawnOrder !== b.spawnOrder) return a.spawnOrder - b.spawnOrder;
return a.eid - b.eid;
});