refactor(渲染): 重构实体层级管理方式

- 移除通过 setSiblingIndex 手动设置层级的方式
- 新增 HERO、LINE1、LINE2、SKILL 等容器节点自动管理层级
- 调整英雄、怪物、技能等实体的父节点到对应容器
- 优化提示信息的位置偏移量
This commit is contained in:
2025-11-04 14:23:07 +08:00
parent 1e0537b63d
commit 087f4010be
7 changed files with 419 additions and 59 deletions

View File

@@ -99,7 +99,7 @@ export class HeroViewComp extends CCComp {
/** 初始化 UI 节点引用 */
private initUINodes() {
this.top_node = this.node.getChildByName("top");
let hp_y = this.node.getComponent(UITransform).height;
let hp_y = this.node.getComponent(UITransform).height+10;
this.top_node.setPosition(0, hp_y, 0);
}
@@ -245,7 +245,7 @@ export class HeroViewComp extends CCComp {
}
/** 技能提示 */
private tooltip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 90) {
private tooltip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 120) {
let tip = ecs.getEntity<Tooltip>(Tooltip);
let pos = v3(0, 60);
pos.y = pos.y + y;
@@ -253,7 +253,7 @@ export class HeroViewComp extends CCComp {
}
/** 血量提示(伤害数字) */
private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 100) {
private hp_tip(type: number = 1, value: string = "", s_uuid: number = 1001, y: number = 120) {
let tip = ecs.getEntity<Tooltip>(Tooltip);
let x = this.node.position.x;
let ny = this.node.getComponent(UITransform).height + y;