refactor(渲染): 重构实体层级管理方式
- 移除通过 setSiblingIndex 手动设置层级的方式 - 新增 HERO、LINE1、LINE2、SKILL 等容器节点自动管理层级 - 调整英雄、怪物、技能等实体的父节点到对应容器 - 优化提示信息的位置偏移量
This commit is contained in:
@@ -28,17 +28,17 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 110
|
"__id__": 126
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 112
|
"__id__": 128
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 114
|
"__id__": 130
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 116
|
"__id__": 132
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -197,17 +197,17 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 103
|
"__id__": 119
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 105
|
"__id__": 121
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 107
|
"__id__": 123
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 109
|
"__id__": 125
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -257,17 +257,17 @@
|
|||||||
"__id__": 88
|
"__id__": 88
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 94
|
"__id__": 110
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 100
|
"__id__": 116
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 102
|
"__id__": 118
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -2023,23 +2023,83 @@
|
|||||||
{
|
{
|
||||||
"__type__": "cc.Node",
|
"__type__": "cc.Node",
|
||||||
"_name": "EntityLayer",
|
"_name": "EntityLayer",
|
||||||
"_objFlags": 512,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"_parent": {
|
"_parent": {
|
||||||
"__id__": 7
|
"__id__": 7
|
||||||
},
|
},
|
||||||
|
"_children": [
|
||||||
|
{
|
||||||
|
"__id__": 89
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 93
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 97
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 101
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_active": true,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 105
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 107
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 109
|
||||||
|
},
|
||||||
|
"_lpos": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_lrot": {
|
||||||
|
"__type__": "cc.Quat",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0,
|
||||||
|
"w": 1
|
||||||
|
},
|
||||||
|
"_lscale": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 1,
|
||||||
|
"y": 1,
|
||||||
|
"z": 1
|
||||||
|
},
|
||||||
|
"_mobility": 0,
|
||||||
|
"_layer": 1,
|
||||||
|
"_euler": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "LINE1",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 88
|
||||||
|
},
|
||||||
"_children": [],
|
"_children": [],
|
||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 89
|
"__id__": 90
|
||||||
},
|
|
||||||
{
|
|
||||||
"__id__": 91
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 93
|
"__id__": 92
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -2070,6 +2130,311 @@
|
|||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.UITransform",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 89
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 91
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 100,
|
||||||
|
"height": 100
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "b8C5CFg5lM4oUHMeSrc/sV"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__id__": 0
|
||||||
|
},
|
||||||
|
"fileId": "4dcNJaDM1CLI9q3fIqHZ/U",
|
||||||
|
"instance": null,
|
||||||
|
"targetOverrides": null,
|
||||||
|
"nestedPrefabInstanceRoots": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "HERO",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 88
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": true,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 94
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 96
|
||||||
|
},
|
||||||
|
"_lpos": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_lrot": {
|
||||||
|
"__type__": "cc.Quat",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0,
|
||||||
|
"w": 1
|
||||||
|
},
|
||||||
|
"_lscale": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 1,
|
||||||
|
"y": 1,
|
||||||
|
"z": 1
|
||||||
|
},
|
||||||
|
"_mobility": 0,
|
||||||
|
"_layer": 1,
|
||||||
|
"_euler": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.UITransform",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 93
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 95
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 100,
|
||||||
|
"height": 100
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "dasmpuTSVM7qA3QW9/3XjQ"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__id__": 0
|
||||||
|
},
|
||||||
|
"fileId": "eaiasKNEFO6qvodGhL4a0b",
|
||||||
|
"instance": null,
|
||||||
|
"targetOverrides": null,
|
||||||
|
"nestedPrefabInstanceRoots": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "LINE2",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 88
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": true,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 98
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 100
|
||||||
|
},
|
||||||
|
"_lpos": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_lrot": {
|
||||||
|
"__type__": "cc.Quat",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0,
|
||||||
|
"w": 1
|
||||||
|
},
|
||||||
|
"_lscale": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 1,
|
||||||
|
"y": 1,
|
||||||
|
"z": 1
|
||||||
|
},
|
||||||
|
"_mobility": 0,
|
||||||
|
"_layer": 1,
|
||||||
|
"_euler": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.UITransform",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 97
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 99
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 100,
|
||||||
|
"height": 100
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "ea767WaZRHo4s0bZQfN8zP"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__id__": 0
|
||||||
|
},
|
||||||
|
"fileId": "60UdPtJn9ALLHCveLwT1bT",
|
||||||
|
"instance": null,
|
||||||
|
"targetOverrides": null,
|
||||||
|
"nestedPrefabInstanceRoots": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "SKILL",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 88
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": true,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 102
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 104
|
||||||
|
},
|
||||||
|
"_lpos": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_lrot": {
|
||||||
|
"__type__": "cc.Quat",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0,
|
||||||
|
"w": 1
|
||||||
|
},
|
||||||
|
"_lscale": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 1,
|
||||||
|
"y": 1,
|
||||||
|
"z": 1
|
||||||
|
},
|
||||||
|
"_mobility": 0,
|
||||||
|
"_layer": 1,
|
||||||
|
"_euler": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.UITransform",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"__editorExtras__": {},
|
||||||
|
"node": {
|
||||||
|
"__id__": 101
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"__prefab": {
|
||||||
|
"__id__": 103
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 100,
|
||||||
|
"height": 100
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.CompPrefabInfo",
|
||||||
|
"fileId": "47rZJ0Uv9HkIhkIUzm2ES9"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__id__": 0
|
||||||
|
},
|
||||||
|
"fileId": "f0bFfyrcRF77DMu5a9MYtG",
|
||||||
|
"instance": null,
|
||||||
|
"targetOverrides": null,
|
||||||
|
"nestedPrefabInstanceRoots": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"__type__": "cc.UITransform",
|
"__type__": "cc.UITransform",
|
||||||
"_name": "",
|
"_name": "",
|
||||||
@@ -2080,7 +2445,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 90
|
"__id__": 106
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -2108,7 +2473,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 92
|
"__id__": 108
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
@@ -2141,14 +2506,14 @@
|
|||||||
"_active": true,
|
"_active": true,
|
||||||
"_components": [
|
"_components": [
|
||||||
{
|
{
|
||||||
"__id__": 95
|
"__id__": 111
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__id__": 97
|
"__id__": 113
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"_prefab": {
|
"_prefab": {
|
||||||
"__id__": 99
|
"__id__": 115
|
||||||
},
|
},
|
||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
@@ -2185,11 +2550,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 94
|
"__id__": 110
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 96
|
"__id__": 112
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -2213,11 +2578,11 @@
|
|||||||
"_objFlags": 0,
|
"_objFlags": 0,
|
||||||
"__editorExtras__": {},
|
"__editorExtras__": {},
|
||||||
"node": {
|
"node": {
|
||||||
"__id__": 94
|
"__id__": 110
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 98
|
"__id__": 114
|
||||||
},
|
},
|
||||||
"light": null,
|
"light": null,
|
||||||
"_id": ""
|
"_id": ""
|
||||||
@@ -2249,7 +2614,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 101
|
"__id__": 117
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -2290,7 +2655,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 104
|
"__id__": 120
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -2318,7 +2683,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 106
|
"__id__": 122
|
||||||
},
|
},
|
||||||
"camera": {
|
"camera": {
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
@@ -2333,10 +2698,10 @@
|
|||||||
"__id__": 84
|
"__id__": 84
|
||||||
},
|
},
|
||||||
"entityLayer": {
|
"entityLayer": {
|
||||||
"__id__": 91
|
"__id__": 107
|
||||||
},
|
},
|
||||||
"SkillLayer": {
|
"SkillLayer": {
|
||||||
"__id__": 97
|
"__id__": 113
|
||||||
},
|
},
|
||||||
"isFollowPlayer": true,
|
"isFollowPlayer": true,
|
||||||
"_id": ""
|
"_id": ""
|
||||||
@@ -2355,7 +2720,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 108
|
"__id__": 124
|
||||||
},
|
},
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
@@ -2386,7 +2751,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 111
|
"__id__": 127
|
||||||
},
|
},
|
||||||
"_contentSize": {
|
"_contentSize": {
|
||||||
"__type__": "cc.Size",
|
"__type__": "cc.Size",
|
||||||
@@ -2414,7 +2779,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 113
|
"__id__": 129
|
||||||
},
|
},
|
||||||
"_cameraComponent": {
|
"_cameraComponent": {
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
@@ -2436,7 +2801,7 @@
|
|||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": true,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 115
|
"__id__": 131
|
||||||
},
|
},
|
||||||
"_alignFlags": 45,
|
"_alignFlags": 45,
|
||||||
"_target": null,
|
"_target": null,
|
||||||
|
|||||||
@@ -46,15 +46,14 @@ export class Hero extends ecs.Entity {
|
|||||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||||
var node = instantiate(prefab);
|
var node = instantiate(prefab);
|
||||||
var scene = smc.map.MapView.scene;
|
var scene = smc.map.MapView.scene;
|
||||||
node.parent = scene.entityLayer!.node!
|
node.parent = scene.entityLayer!.node!.getChildByName("HERO")!;
|
||||||
const collider = node.getComponent(BoxCollider2D);
|
const collider = node.getComponent(BoxCollider2D);
|
||||||
if (collider) collider.enabled = false; // 先禁用
|
if (collider) collider.enabled = false; // 先禁用
|
||||||
node.setScale(size*node.scale.x,size*node.scale.y);
|
node.setScale(size*node.scale.x,size*node.scale.y);
|
||||||
node.setPosition(pos)
|
node.setPosition(pos)
|
||||||
|
|
||||||
// 🔥 设置初始 SiblingIndex - 英雄基础层级 + 位置偏移
|
// 🔥 设置初始 SiblingIndex - 英雄基础层级 + 位置偏移
|
||||||
const initialSiblingIndex = IndexSet.HERO;
|
|
||||||
node.setSiblingIndex(initialSiblingIndex);
|
|
||||||
console.log("hero",node.getSiblingIndex());
|
console.log("hero",node.getSiblingIndex());
|
||||||
|
|
||||||
// console.log("hero load",pos)
|
// console.log("hero load",pos)
|
||||||
|
|||||||
@@ -293,10 +293,10 @@ export class HeroMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpd
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 设置渲染顺序:x坐标越大的显示在上层(index越大,层级越高)
|
// 设置渲染顺序:x坐标越大的显示在上层(index越大,层级越高)
|
||||||
sortedUnits.forEach((unit, index) => {
|
// sortedUnits.forEach((unit, index) => {
|
||||||
const model = unit.get(HeroViewComp);
|
// const model = unit.get(HeroViewComp);
|
||||||
model.node.setSiblingIndex(index); // 直接使用index,x坐标大的index大,层级高
|
// model.node.setSiblingIndex(index); // 直接使用index,x坐标大的index大,层级高
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 检查指定位置是否已被占用 */
|
/** 检查指定位置是否已被占用 */
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export class HeroViewComp extends CCComp {
|
|||||||
/** 初始化 UI 节点引用 */
|
/** 初始化 UI 节点引用 */
|
||||||
private initUINodes() {
|
private initUINodes() {
|
||||||
this.top_node = this.node.getChildByName("top");
|
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);
|
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 tip = ecs.getEntity<Tooltip>(Tooltip);
|
||||||
let pos = v3(0, 60);
|
let pos = v3(0, 60);
|
||||||
pos.y = pos.y + y;
|
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 tip = ecs.getEntity<Tooltip>(Tooltip);
|
||||||
let x = this.node.position.x;
|
let x = this.node.position.x;
|
||||||
let ny = this.node.getComponent(UITransform).height + y;
|
let ny = this.node.getComponent(UITransform).height + y;
|
||||||
|
|||||||
@@ -42,20 +42,15 @@ export class Monster extends ecs.Entity {
|
|||||||
var path = "game/heros/"+HeroInfo[uuid].path;
|
var path = "game/heros/"+HeroInfo[uuid].path;
|
||||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||||
var node = instantiate(prefab);
|
var node = instantiate(prefab);
|
||||||
|
let LINE1=scene.entityLayer!.node!.getChildByName("LINE1")!;
|
||||||
node.parent = scene.entityLayer!.node!
|
let LINE2=scene.entityLayer!.node!.getChildByName("LINE2")!;
|
||||||
|
// 🔥 设置初始 SiblingIndex - 防止溢出
|
||||||
|
const baseLane = lane === 0 ? LINE1 : LINE2;
|
||||||
|
node.parent = baseLane
|
||||||
const collider = node.getComponent(BoxCollider2D);
|
const collider = node.getComponent(BoxCollider2D);
|
||||||
if (collider) collider.enabled = false; // 先禁用 // 延迟一帧启用碰撞体
|
if (collider) collider.enabled = false; // 先禁用 // 延迟一帧启用碰撞体
|
||||||
node.setScale(size*node.scale.x,size*node.scale.y);
|
node.setScale(size*node.scale.x,size*node.scale.y);
|
||||||
node.setPosition(pos)
|
node.setPosition(pos)
|
||||||
|
|
||||||
// 🔥 设置初始 SiblingIndex - 防止溢出
|
|
||||||
const baseLane = lane === 0 ? IndexSet.MON1 : IndexSet.MON2;
|
|
||||||
// 使用模运算防止索引溢出,确保在安全范围内循环
|
|
||||||
const safeSpawnOrder = spawnOrder % 999; // 限制在999以内,避免溢出到其他层级
|
|
||||||
const initialSiblingIndex = baseLane + safeSpawnOrder;
|
|
||||||
node.setSiblingIndex(initialSiblingIndex);
|
|
||||||
console.log("mon",node.getSiblingIndex());
|
|
||||||
var view = node.getComponent(HeroViewComp)!;
|
var view = node.getComponent(HeroViewComp)!;
|
||||||
const model = this.get(HeroAttrsComp);
|
const model = this.get(HeroAttrsComp);
|
||||||
const skillsComp = this.get(HeroSkillsComp);
|
const skillsComp = this.get(HeroSkillsComp);
|
||||||
@@ -71,11 +66,10 @@ export class Monster extends ecs.Entity {
|
|||||||
model.type = hero.type;
|
model.type = hero.type;
|
||||||
model.fac = FacSet.MON;
|
model.fac = FacSet.MON;
|
||||||
model.is_boss = monType == MonType.BOSS;
|
model.is_boss = monType == MonType.BOSS;
|
||||||
if(model.is_boss) node.setSiblingIndex(IndexSet.BOSS);
|
if(model.is_boss) node.parent = scene.entityLayer!.node!.getChildByName("HERO")!;
|
||||||
if(!model.is_boss){
|
if(!model.is_boss){
|
||||||
model.is_kalami = true;
|
model.is_kalami = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据等级和类型获取怪物属性
|
// 根据等级和类型获取怪物属性
|
||||||
const {hp, mp, ap, map, def, mdef} = getMonAttr(lv, uuid, monType);
|
const {hp, mp, ap, map, def, mdef} = getMonAttr(lv, uuid, monType);
|
||||||
// 初始化属性数组
|
// 初始化属性数组
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ export class HInfoComp extends CCComp {
|
|||||||
|
|
||||||
// 设置节点位置
|
// 设置节点位置
|
||||||
node.setPosition(this.hero_pos[pos_index]);
|
node.setPosition(this.hero_pos[pos_index]);
|
||||||
node.setSiblingIndex(0);
|
// node.setSiblingIndex(0);
|
||||||
// 根据位置设置不同的缩放值
|
// 根据位置设置不同的缩放值
|
||||||
node.setScale(this.getHeroScale(pos_index));
|
node.setScale(this.getHeroScale(pos_index));
|
||||||
// 加载并播放动画
|
// 加载并播放动画
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { SkillView } from "./SkillView";
|
|||||||
import { SDataCom } from "./SDataCom";
|
import { SDataCom } from "./SDataCom";
|
||||||
import { SMoveDataComp } from "../skill/SMoveComp";
|
import { SMoveDataComp } from "../skill/SMoveComp";
|
||||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||||
|
import { smc } from "../common/SingletonModuleComp";
|
||||||
|
|
||||||
/** Skill 模块 */
|
/** Skill 模块 */
|
||||||
@ecs.register(`Skill`)
|
@ecs.register(`Skill`)
|
||||||
@@ -46,7 +47,8 @@ export class Skill extends ecs.Entity {
|
|||||||
// console.log("load skill startPos",startPos)
|
// console.log("load skill startPos",startPos)
|
||||||
const node: Node = instantiate(prefab);
|
const node: Node = instantiate(prefab);
|
||||||
// console.log("load skill node",node)
|
// console.log("load skill node",node)
|
||||||
node.parent = parent;
|
var scene = smc.map.MapView.scene;
|
||||||
|
node.parent = scene.entityLayer!.node!.getChildByName("SKILL")!;
|
||||||
// 设置节点属性
|
// 设置节点属性
|
||||||
node.setPosition(startPos);
|
node.setPosition(startPos);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user