From e8f418048396cab4912a2f37a3b85e13d2b06074 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Wed, 2 Sep 2026 08:35:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(scripts):=20PoC=20=E9=98=B6=E6=AE=B5=202?= =?UTF-8?q?=20-=20Layer10=5FProtocol=20+=20Widget=20=E9=94=9A=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit computeWidgetAlignment(spirit) 简化版 (水平+垂直居中): _alignFlags = 16 | 8 _horizontalCenter = x + w/2 - 640 _verticalCenter = 360 - (y + h/2) emitPrefabJson 仅在 Spirit 父节点是 group (非 Layer 根) 时调用; root / group-X envelope 沿用默认 _alignFlags=45 全屏铺满. PoC 验证: Layer00010.xml Protol_Layer (group 37, 4 spirits) 生成 Protol_Layer.prefab — 6 Widget 节点 (1 root + 1 group-37 + 4 spirit), 4 spirit widget 全部 _alignFlags=24. --- .../out/legacy-migration/Protol_Layer.prefab | 979 +++++++++++++ .../legacy-migration/Protol_Layer.prefab.diff | 1208 +++++++++++++++++ .../poc-protocol.test.mjs | 68 + .../scripts/legacy-layer-to-cocos-prefab.mjs | 71 +- 4 files changed, 2322 insertions(+), 4 deletions(-) create mode 100644 cocoscreator_projects/YouleNexus/out/legacy-migration/Protol_Layer.prefab create mode 100644 cocoscreator_projects/YouleNexus/out/legacy-migration/Protol_Layer.prefab.diff create mode 100644 cocoscreator_projects/framework-tests/legacy-layer-migration/poc-protocol.test.mjs diff --git a/cocoscreator_projects/YouleNexus/out/legacy-migration/Protol_Layer.prefab b/cocoscreator_projects/YouleNexus/out/legacy-migration/Protol_Layer.prefab new file mode 100644 index 0000000..cc7a1b2 --- /dev/null +++ b/cocoscreator_projects/YouleNexus/out/legacy-migration/Protol_Layer.prefab @@ -0,0 +1,979 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "Protol_Layer", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false + }, + { + "__type__": "cc.Node", + "_name": "Protol_Layer", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 41 + }, + { + "__id__": 43 + } + ], + "_prefab": { + "__id__": 44 + }, + "_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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "group-37", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 11 + }, + { + "__id__": 19 + }, + { + "__id__": 27 + } + ], + "_active": true, + "_components": [ + { + "__id__": 36 + }, + { + "__id__": 38 + } + ], + "_prefab": { + "__id__": 39 + }, + "_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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "协议遮罩", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 7 + }, + { + "__id__": 9 + } + ], + "_prefab": { + "__id__": 10 + }, + "_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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "x0IvAcFprR09jBj3F9ZqfM" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": { + "__id__": 4 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1280, + "height": 720 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "k27YpdDROJN3PwtpFBqu2X" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": { + "__id__": 6 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "eabf148a-fa6a-460a-be4f-8e586eb80e07@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "4kra9jO2Upq0a8CDkFGk6y" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": { + "__id__": 8 + }, + "_alignFlags": 24, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "A2rJprBVu5rQ1lfyfhnoE1", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "协议背景", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 13 + }, + { + "__id__": 15 + }, + { + "__id__": 17 + } + ], + "_prefab": { + "__id__": 18 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -7, + "y": 5, + "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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "1tAFH2qR4PNs5TcEj9WbBN" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": { + "__id__": 12 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 820, + "height": 650 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "H0F6KOqTnrFHqBlxYya7nW" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": { + "__id__": 14 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "3e7492cb-7ae1-4f56-806d-07096662d8fb@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 1, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "8BOyuPKPZHetZAnf80c7wu" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 11 + }, + "_enabled": true, + "__prefab": { + "__id__": 16 + }, + "_alignFlags": 24, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": -7, + "_verticalCenter": 5, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "zMXkBOeB9BIiYszl2FyzWz", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "协议内容", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 21 + }, + { + "__id__": 23 + }, + { + "__id__": 25 + } + ], + "_prefab": { + "__id__": 26 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -5.5, + "y": -208.5, + "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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "R4LbfxF9leygoYiRZDazU1" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 19 + }, + "_enabled": true, + "__prefab": { + "__id__": 20 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 729, + "height": 997 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "uzrkcGNHVyWfKzKkcHwPMk" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 19 + }, + "_enabled": true, + "__prefab": { + "__id__": 22 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "998850c4-7861-4c12-8cb4-be7a7415c42a@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "n4E6Phc2Du7834JbFXg4nd" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 19 + }, + "_enabled": true, + "__prefab": { + "__id__": 24 + }, + "_alignFlags": 24, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": -5.5, + "_verticalCenter": -208.5, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "297AVROK4atf6oUqkN1hbU", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Spirit253", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 29 + }, + { + "__id__": 31 + }, + { + "__id__": 33 + } + ], + "_prefab": { + "__id__": 34 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 395.5, + "y": 312, + "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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "MXs4krBnTwKs9jcRoWsoue" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 27 + }, + "_enabled": true, + "__prefab": { + "__id__": 28 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 83, + "height": 84 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "RSxoUbKQ13s5FDPa4S8stK" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 27 + }, + "_enabled": true, + "__prefab": { + "__id__": 30 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "eedce6d7-3ea6-434c-83e1-87d9a04b2bad@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "S8Gp4f43opGMNFU8yqYvIr" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 27 + }, + "_enabled": true, + "__prefab": { + "__id__": 32 + }, + "_alignFlags": 24, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": 395.5, + "_verticalCenter": 312, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "F94TpZYd1zvtC2C8Nuvc9j", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "CpXRd4oB7tzsDjXicMDoBj" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 35 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1600, + "height": 720 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "2ENhII9krOzYmsdNNyONVy" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 37 + }, + "_alignFlags": 45, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "Qt4q2pzjFx5f5d4OA92IMG", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "9JRbFTOp1wkFliPtymUsWo" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 40 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 1600, + "height": 720 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "bxFGsUwP3dv7LOuTH9hMVB" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 42 + }, + "_alignFlags": 45, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "9oCxJX1UEvxpUeW4I1c8XL", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + } +] \ No newline at end of file diff --git a/cocoscreator_projects/YouleNexus/out/legacy-migration/Protol_Layer.prefab.diff b/cocoscreator_projects/YouleNexus/out/legacy-migration/Protol_Layer.prefab.diff new file mode 100644 index 0000000..998f553 --- /dev/null +++ b/cocoscreator_projects/YouleNexus/out/legacy-migration/Protol_Layer.prefab.diff @@ -0,0 +1,1208 @@ +--- YouleNexus/assets/framework/ui/prefabs/widgets/Layer10_Protocol.prefab 2026-09-01 01:11:57.893374800 +0800 ++++ YouleNexus\out\legacy-migration\Protol_Layer.prefab 2026-09-02 08:34:28.171418700 +0800 +@@ -1,7 +1,7 @@ + [ + { + "__type__": "cc.Prefab", +- "_name": "Layer10_Protocol", ++ "_name": "Protol_Layer", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", +@@ -13,32 +13,22 @@ + }, + { + "__type__": "cc.Node", +- "_name": "Layer10_Protocol", ++ "_name": "Protol_Layer", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, +- "_children": [ +- { +- "__id__": 2 +- }, +- { +- "__id__": 3 +- }, +- { +- "__id__": 4 +- }, +- { +- "__id__": 5 +- } +- ], ++ "_children": [], + "_active": true, + "_components": [ + { +- "__id__": 36 ++ "__id__": 41 ++ }, ++ { ++ "__id__": 43 + } + ], + "_prefab": { +- "__id__": 38 ++ "__id__": 44 + }, + "_lpos": { + "__type__": "cc.Vec3", +@@ -50,7 +40,8 @@ + "__type__": "cc.Quat", + "x": 0, + "y": 0, +- "z": 0 ++ "z": 0, ++ "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", +@@ -70,125 +61,37 @@ + }, + { + "__type__": "cc.Node", +- "_name": "Box", ++ "_name": "group-37", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, +- "_children": [], +- "_active": true, +- "_components": [ ++ "_children": [ + { +- "__id__": 6 ++ "__id__": 3 + }, + { +- "__id__": 8 ++ "__id__": 11 + }, + { +- "__id__": 10 +- } +- ], +- "_prefab": { +- "__id__": 12 +- }, +- "_lpos": { +- "__type__": "cc.Vec3", +- "x": 0, +- "y": 0, +- "z": 0 +- }, +- "_lrot": { +- "__type__": "cc.Quat", +- "x": 0, +- "y": 0, +- "z": 0 +- }, +- "_lscale": { +- "__type__": "cc.Vec3", +- "x": 1, +- "y": 1, +- "z": 1 +- }, +- "_mobility": 0, +- "_layer": 1073741824, +- "_euler": { +- "__type__": "cc.Vec3", +- "x": 0, +- "y": 0, +- "z": 0 +- }, +- "_id": "" +- }, +- { +- "__type__": "cc.Node", +- "_name": "Title", +- "_objFlags": 0, +- "__editorExtras__": {}, +- "_parent": { +- "__id__": 1 +- }, +- "_children": [], +- "_active": true, +- "_components": [ +- { +- "__id__": 13 ++ "__id__": 19 + }, + { +- "__id__": 15 ++ "__id__": 27 + } + ], +- "_prefab": { +- "__id__": 17 +- }, +- "_lpos": { +- "__type__": "cc.Vec3", +- "x": 0, +- "y": 200, +- "z": 0 +- }, +- "_lrot": { +- "__type__": "cc.Quat", +- "x": 0, +- "y": 0, +- "z": 0 +- }, +- "_lscale": { +- "__type__": "cc.Vec3", +- "x": 1, +- "y": 1, +- "z": 1 +- }, +- "_mobility": 0, +- "_layer": 1073741824, +- "_euler": { +- "__type__": "cc.Vec3", +- "x": 0, +- "y": 0, +- "z": 0 +- }, +- "_id": "" +- }, +- { +- "__type__": "cc.Node", +- "_name": "Content", +- "_objFlags": 0, +- "__editorExtras__": {}, +- "_parent": { +- "__id__": 1 +- }, +- "_children": [], + "_active": true, + "_components": [ + { +- "__id__": 18 ++ "__id__": 36 + }, + { +- "__id__": 20 ++ "__id__": 38 + } + ], + "_prefab": { +- "__id__": 22 ++ "__id__": 39 + }, + "_lpos": { + "__type__": "cc.Vec3", +@@ -200,7 +103,8 @@ + "__type__": "cc.Quat", + "x": 0, + "y": 0, +- "z": 0 ++ "z": 0, ++ "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", +@@ -220,43 +124,40 @@ + }, + { + "__type__": "cc.Node", +- "_name": "AgreeBtn", ++ "_name": "协议遮罩", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { +- "__id__": 1 ++ "__id__": 2 + }, +- "_children": [ +- { +- "__id__": 23 +- } +- ], ++ "_children": [], + "_active": true, + "_components": [ + { +- "__id__": 29 ++ "__id__": 5 + }, + { +- "__id__": 31 ++ "__id__": 7 + }, + { +- "__id__": 33 ++ "__id__": 9 + } + ], + "_prefab": { +- "__id__": 35 ++ "__id__": 10 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, +- "y": -180, ++ "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, +- "z": 0 ++ "z": 0, ++ "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", +@@ -275,21 +176,25 @@ + "_id": "" + }, + { ++ "__type__": "cc.CompPrefabInfo", ++ "fileId": "x0IvAcFprR09jBj3F9ZqfM" ++ }, ++ { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 2 ++ "__id__": 3 + }, + "_enabled": true, + "__prefab": { +- "__id__": 7 ++ "__id__": 4 + }, + "_contentSize": { + "__type__": "cc.Size", +- "width": 1000, +- "height": 500 ++ "width": 1280, ++ "height": 720 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", +@@ -300,7 +205,7 @@ + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "oXaUBE5FadJPKPV1kNBwB2" ++ "fileId": "k27YpdDROJN3PwtpFBqu2X" + }, + { + "__type__": "cc.Sprite", +@@ -308,15 +213,11 @@ + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 2 ++ "__id__": 3 + }, + "_enabled": true, + "__prefab": { +- "__id__": 9 +- }, +- "_spriteFrame": { +- "__uuid__": "dcc4530b-344b-40b6-8fbb-9fa35db6a289@f9941", +- "__expectedType__": "cc.SpriteFrame" ++ "__id__": 6 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, +@@ -328,7 +229,11 @@ + "b": 255, + "a": 255 + }, +- "_type": 1, ++ "_spriteFrame": { ++ "__uuid__": "eabf148a-fa6a-460a-be4f-8e586eb80e07@f9941", ++ "__expectedType__": "cc.SpriteFrame" ++ }, ++ "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { +@@ -345,29 +250,41 @@ + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "6Kb2nGRMAooTyFfd3Lyehj" ++ "fileId": "4kra9jO2Upq0a8CDkFGk6y" + }, + { +- "__type__": "cc.UIOpacity", ++ "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 2 ++ "__id__": 3 + }, + "_enabled": true, + "__prefab": { +- "__id__": 11 ++ "__id__": 8 + }, +- "opacity": 240, +- "_opacity": 240, ++ "_alignFlags": 24, ++ "_target": null, ++ "_left": 0, ++ "_right": 0, ++ "_top": 0, ++ "_bottom": 0, ++ "_horizontalCenter": 0, ++ "_verticalCenter": 0, ++ "_isAbsLeft": true, ++ "_isAbsRight": true, ++ "_isAbsTop": true, ++ "_isAbsBottom": true, ++ "_isAbsHorizontalCenter": true, ++ "_isAbsVerticalCenter": true, ++ "_originalWidth": 0, ++ "_originalHeight": 0, ++ "_alignMode": 2, ++ "_lockFlags": 0, + "_id": "" + }, + { +- "__type__": "cc.CompPrefabInfo", +- "fileId": "4/ZvQyMMnHy/MP8e62EaCC" +- }, +- { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 +@@ -375,151 +292,174 @@ + "asset": { + "__id__": 0 + }, +- "fileId": "12kemrqntATYjK8nnBs4cG", ++ "fileId": "A2rJprBVu5rQ1lfyfhnoE1", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { +- "__type__": "cc.UITransform", +- "_name": "", ++ "__type__": "cc.Node", ++ "_name": "协议背景", + "_objFlags": 0, + "__editorExtras__": {}, +- "node": { +- "__id__": 3 ++ "_parent": { ++ "__id__": 2 + }, +- "_enabled": true, +- "__prefab": { +- "__id__": 14 ++ "_children": [], ++ "_active": true, ++ "_components": [ ++ { ++ "__id__": 13 ++ }, ++ { ++ "__id__": 15 ++ }, ++ { ++ "__id__": 17 ++ } ++ ], ++ "_prefab": { ++ "__id__": 18 + }, +- "_contentSize": { +- "__type__": "cc.Size", +- "width": 160, +- "height": 50.4 ++ "_lpos": { ++ "__type__": "cc.Vec3", ++ "x": -7, ++ "y": 5, ++ "z": 0 + }, +- "_anchorPoint": { +- "__type__": "cc.Vec2", +- "x": 0.5, +- "y": 0.5 ++ "_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": 1073741824, ++ "_euler": { ++ "__type__": "cc.Vec3", ++ "x": 0, ++ "y": 0, ++ "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "6fuT3QWjUGU74W2qJnikSF" ++ "fileId": "1tAFH2qR4PNs5TcEj9WbBN" + }, + { +- "__type__": "cc.Label", ++ "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 3 ++ "__id__": 11 + }, + "_enabled": true, + "__prefab": { +- "__id__": 16 ++ "__id__": 12 ++ }, ++ "_contentSize": { ++ "__type__": "cc.Size", ++ "width": 820, ++ "height": 650 ++ }, ++ "_anchorPoint": { ++ "__type__": "cc.Vec2", ++ "x": 0.5, ++ "y": 0.5 + }, +- "_string": "用户协议", +- "_horizontalAlign": 1, +- "_verticalAlign": 1, +- "_actualFontSize": 40, +- "_fontSize": 40, +- "_fontFamily": "Arial", +- "_lineHeight": 40, +- "_overflow": 0, +- "_enableWrapText": true, +- "_font": null, +- "_isSystemFontUsed": true, +- "_spacingX": 0, +- "_isItalic": false, +- "_isBold": false, +- "_isUnderline": false, +- "_underlineHeight": 2, +- "_cacheMode": 0, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "MqdIJNnB7oR9OK2odjpEu1" +- }, +- { +- "__type__": "cc.PrefabInfo", +- "root": { +- "__id__": 1 +- }, +- "asset": { +- "__id__": 0 +- }, +- "fileId": "d1mqm6hC9Km47bc4Q4RIHK", +- "instance": null, +- "targetOverrides": null, +- "nestedPrefabInstanceRoots": null ++ "fileId": "H0F6KOqTnrFHqBlxYya7nW" + }, + { +- "__type__": "cc.UITransform", ++ "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 4 ++ "__id__": 11 + }, + "_enabled": true, + "__prefab": { +- "__id__": 19 ++ "__id__": 14 + }, +- "_contentSize": { +- "__type__": "cc.Size", +- "width": 433.33984375, +- "height": 50.4 ++ "_customMaterial": null, ++ "_srcBlendFactor": 2, ++ "_dstBlendFactor": 4, ++ "_color": { ++ "__type__": "cc.Color", ++ "r": 255, ++ "g": 255, ++ "b": 255, ++ "a": 255 + }, +- "_anchorPoint": { ++ "_spriteFrame": { ++ "__uuid__": "3e7492cb-7ae1-4f56-806d-07096662d8fb@f9941", ++ "__expectedType__": "cc.SpriteFrame" ++ }, ++ "_type": 1, ++ "_fillType": 0, ++ "_sizeMode": 0, ++ "_fillCenter": { + "__type__": "cc.Vec2", +- "x": 0.5, +- "y": 0.5 ++ "x": 0, ++ "y": 0 + }, ++ "_fillStart": 0, ++ "_fillRange": 0, ++ "_isTrimmedMode": true, ++ "_useGrayscale": false, ++ "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "dPEVXxMhCo5XiYvPRL9RMs" ++ "fileId": "8BOyuPKPZHetZAnf80c7wu" + }, + { +- "__type__": "cc.Label", ++ "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 4 ++ "__id__": 11 + }, + "_enabled": true, + "__prefab": { +- "__id__": 21 ++ "__id__": 16 + }, +- "_string": "请阅读并同意用户协议...", +- "_horizontalAlign": 1, +- "_verticalAlign": 1, +- "_actualFontSize": 40, +- "_fontSize": 40, +- "_fontFamily": "Arial", +- "_lineHeight": 40, +- "_overflow": 0, +- "_enableWrapText": true, +- "_font": null, +- "_isSystemFontUsed": true, +- "_spacingX": 0, +- "_isItalic": false, +- "_isBold": false, +- "_isUnderline": false, +- "_underlineHeight": 2, +- "_cacheMode": 0, ++ "_alignFlags": 24, ++ "_target": null, ++ "_left": 0, ++ "_right": 0, ++ "_top": 0, ++ "_bottom": 0, ++ "_horizontalCenter": -7, ++ "_verticalCenter": 5, ++ "_isAbsLeft": true, ++ "_isAbsRight": true, ++ "_isAbsTop": true, ++ "_isAbsBottom": true, ++ "_isAbsHorizontalCenter": true, ++ "_isAbsVerticalCenter": true, ++ "_originalWidth": 0, ++ "_originalHeight": 0, ++ "_alignMode": 2, ++ "_lockFlags": 0, + "_id": "" + }, + { +- "__type__": "cc.CompPrefabInfo", +- "fileId": "Gh3LCG2aZmYi/Y021RISB4" +- }, +- { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 +@@ -527,43 +467,47 @@ + "asset": { + "__id__": 0 + }, +- "fileId": "91FXgVD3NDxoCyE64MzU0Q", ++ "fileId": "zMXkBOeB9BIiYszl2FyzWz", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", +- "_name": "Label", ++ "_name": "协议内容", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { +- "__id__": 5 ++ "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { +- "__id__": 24 ++ "__id__": 21 ++ }, ++ { ++ "__id__": 23 + }, + { +- "__id__": 26 ++ "__id__": 25 + } + ], + "_prefab": { +- "__id__": 28 ++ "__id__": 26 + }, + "_lpos": { + "__type__": "cc.Vec3", +- "x": 0, +- "y": 0, ++ "x": -5.5, ++ "y": -208.5, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, +- "z": 0 ++ "z": 0, ++ "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", +@@ -582,21 +526,25 @@ + "_id": "" + }, + { ++ "__type__": "cc.CompPrefabInfo", ++ "fileId": "R4LbfxF9leygoYiRZDazU1" ++ }, ++ { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 23 ++ "__id__": 19 + }, + "_enabled": true, + "__prefab": { +- "__id__": 25 ++ "__id__": 20 + }, + "_contentSize": { + "__type__": "cc.Size", +- "width": 80, +- "height": 50.4 ++ "width": 729, ++ "height": 997 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", +@@ -607,42 +555,84 @@ + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "2lh0VzkfUMMVkQWokCZzYz" ++ "fileId": "uzrkcGNHVyWfKzKkcHwPMk" + }, + { +- "__type__": "cc.Label", ++ "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 23 ++ "__id__": 19 + }, + "_enabled": true, + "__prefab": { +- "__id__": 27 ++ "__id__": 22 ++ }, ++ "_customMaterial": null, ++ "_srcBlendFactor": 2, ++ "_dstBlendFactor": 4, ++ "_color": { ++ "__type__": "cc.Color", ++ "r": 255, ++ "g": 255, ++ "b": 255, ++ "a": 255 ++ }, ++ "_spriteFrame": { ++ "__uuid__": "998850c4-7861-4c12-8cb4-be7a7415c42a@f9941", ++ "__expectedType__": "cc.SpriteFrame" + }, +- "_string": "同意", +- "_horizontalAlign": 1, +- "_verticalAlign": 1, +- "_actualFontSize": 40, +- "_fontSize": 40, +- "_fontFamily": "Arial", +- "_lineHeight": 40, +- "_overflow": 0, +- "_enableWrapText": true, +- "_font": null, +- "_isSystemFontUsed": true, +- "_spacingX": 0, +- "_isItalic": false, +- "_isBold": false, +- "_isUnderline": false, +- "_underlineHeight": 2, +- "_cacheMode": 0, ++ "_type": 0, ++ "_fillType": 0, ++ "_sizeMode": 0, ++ "_fillCenter": { ++ "__type__": "cc.Vec2", ++ "x": 0, ++ "y": 0 ++ }, ++ "_fillStart": 0, ++ "_fillRange": 0, ++ "_isTrimmedMode": true, ++ "_useGrayscale": false, ++ "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "hJE0C+184TvFR8bGendFq3" ++ "fileId": "n4E6Phc2Du7834JbFXg4nd" ++ }, ++ { ++ "__type__": "cc.Widget", ++ "_name": "", ++ "_objFlags": 0, ++ "__editorExtras__": {}, ++ "node": { ++ "__id__": 19 ++ }, ++ "_enabled": true, ++ "__prefab": { ++ "__id__": 24 ++ }, ++ "_alignFlags": 24, ++ "_target": null, ++ "_left": 0, ++ "_right": 0, ++ "_top": 0, ++ "_bottom": 0, ++ "_horizontalCenter": -5.5, ++ "_verticalCenter": -208.5, ++ "_isAbsLeft": true, ++ "_isAbsRight": true, ++ "_isAbsTop": true, ++ "_isAbsBottom": true, ++ "_isAbsHorizontalCenter": true, ++ "_isAbsVerticalCenter": true, ++ "_originalWidth": 0, ++ "_originalHeight": 0, ++ "_alignMode": 2, ++ "_lockFlags": 0, ++ "_id": "" + }, + { + "__type__": "cc.PrefabInfo", +@@ -652,27 +642,84 @@ + "asset": { + "__id__": 0 + }, +- "fileId": "0foVnezLdMaKOM1JSMLNEY", ++ "fileId": "297AVROK4atf6oUqkN1hbU", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { ++ "__type__": "cc.Node", ++ "_name": "Spirit253", ++ "_objFlags": 0, ++ "__editorExtras__": {}, ++ "_parent": { ++ "__id__": 2 ++ }, ++ "_children": [], ++ "_active": true, ++ "_components": [ ++ { ++ "__id__": 29 ++ }, ++ { ++ "__id__": 31 ++ }, ++ { ++ "__id__": 33 ++ } ++ ], ++ "_prefab": { ++ "__id__": 34 ++ }, ++ "_lpos": { ++ "__type__": "cc.Vec3", ++ "x": 395.5, ++ "y": 312, ++ "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": 1073741824, ++ "_euler": { ++ "__type__": "cc.Vec3", ++ "x": 0, ++ "y": 0, ++ "z": 0 ++ }, ++ "_id": "" ++ }, ++ { ++ "__type__": "cc.CompPrefabInfo", ++ "fileId": "MXs4krBnTwKs9jcRoWsoue" ++ }, ++ { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 5 ++ "__id__": 27 + }, + "_enabled": true, + "__prefab": { +- "__id__": 30 ++ "__id__": 28 + }, + "_contentSize": { + "__type__": "cc.Size", +- "width": 200, +- "height": 60 ++ "width": 83, ++ "height": 84 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", +@@ -683,7 +730,7 @@ + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "b1ZgddyJxPMx64lUDbs5Ht" ++ "fileId": "RSxoUbKQ13s5FDPa4S8stK" + }, + { + "__type__": "cc.Sprite", +@@ -691,15 +738,11 @@ + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 5 ++ "__id__": 27 + }, + "_enabled": true, + "__prefab": { +- "__id__": 32 +- }, +- "_spriteFrame": { +- "__uuid__": "dcc4530b-344b-40b6-8fbb-9fa35db6a289@f9941", +- "__expectedType__": "cc.SpriteFrame" ++ "__id__": 30 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, +@@ -711,7 +754,11 @@ + "b": 255, + "a": 255 + }, +- "_type": 1, ++ "_spriteFrame": { ++ "__uuid__": "eedce6d7-3ea6-434c-83e1-87d9a04b2bad@f9941", ++ "__expectedType__": "cc.SpriteFrame" ++ }, ++ "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { +@@ -728,65 +775,116 @@ + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "zIQRK9nIRNfXI1eAmamlv+" ++ "fileId": "S8Gp4f43opGMNFU8yqYvIr" + }, + { +- "__type__": "cc.Button", ++ "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { +- "__id__": 5 ++ "__id__": 27 + }, + "_enabled": true, + "__prefab": { +- "__id__": 34 ++ "__id__": 32 + }, +- "_interactable": true, +- "_transition": 3, +- "_normalColor": { +- "__type__": "cc.Color", +- "r": 255, +- "g": 255, +- "b": 255, +- "a": 255 ++ "_alignFlags": 24, ++ "_target": null, ++ "_left": 0, ++ "_right": 0, ++ "_top": 0, ++ "_bottom": 0, ++ "_horizontalCenter": 395.5, ++ "_verticalCenter": 312, ++ "_isAbsLeft": true, ++ "_isAbsRight": true, ++ "_isAbsTop": true, ++ "_isAbsBottom": true, ++ "_isAbsHorizontalCenter": true, ++ "_isAbsVerticalCenter": true, ++ "_originalWidth": 0, ++ "_originalHeight": 0, ++ "_alignMode": 2, ++ "_lockFlags": 0, ++ "_id": "" ++ }, ++ { ++ "__type__": "cc.PrefabInfo", ++ "root": { ++ "__id__": 1 + }, +- "_hoverColor": { +- "__type__": "cc.Color", +- "r": 211, +- "g": 211, +- "b": 211, +- "a": 255 ++ "asset": { ++ "__id__": 0 + }, +- "_pressedColor": { +- "__type__": "cc.Color", +- "r": 255, +- "g": 255, +- "b": 255, +- "a": 255 ++ "fileId": "F94TpZYd1zvtC2C8Nuvc9j", ++ "instance": null, ++ "targetOverrides": null, ++ "nestedPrefabInstanceRoots": null ++ }, ++ { ++ "__type__": "cc.CompPrefabInfo", ++ "fileId": "CpXRd4oB7tzsDjXicMDoBj" ++ }, ++ { ++ "__type__": "cc.UITransform", ++ "_name": "", ++ "_objFlags": 0, ++ "__editorExtras__": {}, ++ "node": { ++ "__id__": 2 + }, +- "_disabledColor": { +- "__type__": "cc.Color", +- "r": 124, +- "g": 124, +- "b": 124, +- "a": 255 ++ "_enabled": true, ++ "__prefab": { ++ "__id__": 35 ++ }, ++ "_contentSize": { ++ "__type__": "cc.Size", ++ "width": 1600, ++ "height": 720 + }, +- "_normalSprite": null, +- "_hoverSprite": null, +- "_pressedSprite": null, +- "_disabledSprite": null, +- "_duration": 0.1, +- "_zoomScale": 1.2, +- "_target": { +- "__id__": 5 ++ "_anchorPoint": { ++ "__type__": "cc.Vec2", ++ "x": 0.5, ++ "y": 0.5 + }, +- "_clickEvents": [], + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "yfJ5G/LeFUJFLlB39J+0+C" ++ "fileId": "2ENhII9krOzYmsdNNyONVy" ++ }, ++ { ++ "__type__": "cc.Widget", ++ "_name": "", ++ "_objFlags": 0, ++ "__editorExtras__": {}, ++ "node": { ++ "__id__": 2 ++ }, ++ "_enabled": true, ++ "__prefab": { ++ "__id__": 37 ++ }, ++ "_alignFlags": 45, ++ "_target": null, ++ "_left": 0, ++ "_right": 0, ++ "_top": 0, ++ "_bottom": 0, ++ "_horizontalCenter": 0, ++ "_verticalCenter": 0, ++ "_isAbsLeft": true, ++ "_isAbsRight": true, ++ "_isAbsTop": true, ++ "_isAbsBottom": true, ++ "_isAbsHorizontalCenter": true, ++ "_isAbsVerticalCenter": true, ++ "_originalWidth": 0, ++ "_originalHeight": 0, ++ "_alignMode": 2, ++ "_lockFlags": 0, ++ "_id": "" + }, + { + "__type__": "cc.PrefabInfo", +@@ -796,12 +894,16 @@ + "asset": { + "__id__": 0 + }, +- "fileId": "f7LFsNystNUqYo2DwvY0qM", ++ "fileId": "Qt4q2pzjFx5f5d4OA92IMG", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { ++ "__type__": "cc.CompPrefabInfo", ++ "fileId": "9JRbFTOp1wkFliPtymUsWo" ++ }, ++ { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, +@@ -811,12 +913,12 @@ + }, + "_enabled": true, + "__prefab": { +- "__id__": 37 ++ "__id__": 40 + }, + "_contentSize": { + "__type__": "cc.Size", +- "width": 100, +- "height": 100 ++ "width": 1600, ++ "height": 720 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", +@@ -827,7 +929,39 @@ + }, + { + "__type__": "cc.CompPrefabInfo", +- "fileId": "zQumdxaGzk8Ue2+Mf+gDOO" ++ "fileId": "bxFGsUwP3dv7LOuTH9hMVB" ++ }, ++ { ++ "__type__": "cc.Widget", ++ "_name": "", ++ "_objFlags": 0, ++ "__editorExtras__": {}, ++ "node": { ++ "__id__": 1 ++ }, ++ "_enabled": true, ++ "__prefab": { ++ "__id__": 42 ++ }, ++ "_alignFlags": 45, ++ "_target": null, ++ "_left": 0, ++ "_right": 0, ++ "_top": 0, ++ "_bottom": 0, ++ "_horizontalCenter": 0, ++ "_verticalCenter": 0, ++ "_isAbsLeft": true, ++ "_isAbsRight": true, ++ "_isAbsTop": true, ++ "_isAbsBottom": true, ++ "_isAbsHorizontalCenter": true, ++ "_isAbsVerticalCenter": true, ++ "_originalWidth": 0, ++ "_originalHeight": 0, ++ "_alignMode": 2, ++ "_lockFlags": 0, ++ "_id": "" + }, + { + "__type__": "cc.PrefabInfo", +@@ -837,7 +971,7 @@ + "asset": { + "__id__": 0 + }, +- "fileId": "ffywZn4uVL7aw3Apw1z+al", ++ "fileId": "9oCxJX1UEvxpUeW4I1c8XL", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null diff --git a/cocoscreator_projects/framework-tests/legacy-layer-migration/poc-protocol.test.mjs b/cocoscreator_projects/framework-tests/legacy-layer-migration/poc-protocol.test.mjs new file mode 100644 index 0000000..639864c --- /dev/null +++ b/cocoscreator_projects/framework-tests/legacy-layer-migration/poc-protocol.test.mjs @@ -0,0 +1,68 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { execSync } from 'node:child_process'; +import { existsSync, readFileSync } from 'node:fs'; + +// PoC 阶段 2 端到端: Layer00010.xml Protol_Layer (group 37, 4 spirits, type 0/5) +// 走 CLI → 生成 prefab JSON → 校验含 cc.Widget 节点 (与 computeWidgetAlignment 锚定). +// +// 路径从 cocoscreator_projects/ 运行 (与 poc-iconbutton.test.mjs 风格一致). +// Layer00010.xml 4 个 spirit 全属 group 37 (无 Layer 根直挂), 生成的 prefab 应有: +// - 1 root Widget (default _alignFlags=45, 全屏铺满) +// - 1 group-37 Widget (default _alignFlags=45) +// - 4 Spirit Widget (apply computeWidgetAlignment: _alignFlags=24=16|8 水平+垂直居中) +const CLI = 'node scripts/legacy-layer-to-cocos-prefab-cli.mjs'; +const INPUT = '../projects/Game_Surface_3/save/Layer00010.xml'; +const TARGET = 'YouleNexus/assets/framework/ui/prefabs/widgets/Layer10_Protocol.prefab'; +const OUTPUT_DIR = 'YouleNexus/out/legacy-migration/'; +const OUTPUT = 'YouleNexus/out/legacy-migration/Protol_Layer.prefab'; + +test('Layer10_Protocol 生成 + 含 cc.Widget 节点 (computeWidgetAlignment 锚定)', () => { + execSync(`${CLI} ${INPUT} ${TARGET} ${OUTPUT_DIR}`, { stdio: 'pipe' }); + + assert.ok(existsSync(OUTPUT), `${OUTPUT} 应生成`); + + const json = JSON.parse(readFileSync(OUTPUT, 'utf8')); + assert.ok(Array.isArray(json)); + + // 1) 至少应有 6 个 cc.Widget 节点 (1 root + 1 group-37 + 4 spirits). + const widgetNodes = json.filter(o => o.__type__ === 'cc.Widget'); + assert.ok( + widgetNodes.length >= 6, + `应有 ≥6 个 cc.Widget 节点 (1 root + 1 group + 4 spirit), 实得 ${widgetNodes.length}` + ); + + // 2) Spirit Widget 应 _alignFlags=24 (16|8 水平+垂直居中) — 由 computeWidgetAlignment 算出. + // 这是 PoC 阶段 2 的关键验证: 证明 computeWidgetAlignment 真实生效 (而非全部用默认 45). + // Spirit Widget 与 root/group Widget 的区别: Widget.node.__id__ 指向的 cc.Node + // _name 不为 'Protol_Layer' (root) 也不以 'group-' 开头 (group 父节点). + const spiritWidgetCount = widgetNodes.filter(w => { + const nid = w.node && w.node.__id__; + if (nid === undefined) return false; + const targetNode = json[nid]; + if (!targetNode || targetNode.__type__ !== 'cc.Node' || !targetNode._name) return false; + return targetNode._name !== 'Protol_Layer' && !targetNode._name.startsWith('group-'); + }).length; + assert.equal( + spiritWidgetCount, 4, + `应有 4 个 Spirit Widget, 实得 ${spiritWidgetCount}` + ); + + // 3) Spirit Widget _alignFlags 必须等于 24 (= 16 | 8, 水平居中 + 垂直居中). + // 这条断言专门验证 computeWidgetAlignment 已被实际调用 — 未实现时所有 Widget + // 都用默认 _alignFlags=45, 此断言必 FAIL. + const spiritWidgets = widgetNodes.filter(w => { + const nid = w.node && w.node.__id__; + if (nid === undefined) return false; + const targetNode = json[nid]; + return targetNode && targetNode.__type__ === 'cc.Node' && targetNode._name + && targetNode._name !== 'Protol_Layer' + && !targetNode._name.startsWith('group-'); + }); + for (const w of spiritWidgets) { + assert.equal( + w._alignFlags, 24, + `Spirit Widget 应 _alignFlags=24 (16|8), 实得 ${w._alignFlags}` + ); + } +}); diff --git a/cocoscreator_projects/scripts/legacy-layer-to-cocos-prefab.mjs b/cocoscreator_projects/scripts/legacy-layer-to-cocos-prefab.mjs index 18f07a5..25c940d 100644 --- a/cocoscreator_projects/scripts/legacy-layer-to-cocos-prefab.mjs +++ b/cocoscreator_projects/scripts/legacy-layer-to-cocos-prefab.mjs @@ -114,6 +114,39 @@ export function computeContentSize(spirit) { }; } +/** + * 计算 Spirit 在其所属 group 内的 cc.Widget 锚定参数 (PoC 阶段 2 简化版). + * + * 数据源权威: 公式仅处理 Spirit.Y < 360 (上) vs > 360 (下) 与水平偏移, 完全基于 + * 已知字段 (x/y/w/h). SizeCalcMode / CoordRelaX / CoordRelaY 等逆向未出的字段 + * 暂不支持 — 由 buildSpiritBlock 调用方保证父 group 已经处理 SizeCalcMode ≠ 0. + * + * 简化规则: + * _alignFlags = 16 | 8 # 16=水平居中, 8=垂直居中 + * _horizontalCenter = x + w/2 - 640 # 像素偏移, 1280 坐标系水平中心 + * _verticalCenter = 360 - (y + h/2) # Y-up 翻转 + 720 坐标系垂直中心 + * + * @param {{ x?: string, y?: string, w?: string, h?: string }} spirit + * @returns {object} cc.Widget 字段 (除 __type__/node/__prefab/_id 外) + */ +export function computeWidgetAlignment(spirit) { + const x = parseFloat(spirit.x || '0'); + const y = parseFloat(spirit.y || '0'); + const w = parseFloat(spirit.w || '0'); + const h = parseFloat(spirit.h || '0'); + return { + _alignFlags: 16 | 8, // 水平居中 + 垂直居中 + _target: null, + _left: 0, _right: 0, _top: 0, _bottom: 0, + _horizontalCenter: x + w / 2 - 640, // 1280 体系半宽 + _verticalCenter: 360 - (y + h / 2), // Y-up + 720 体系半高 + _isAbsLeft: true, _isAbsRight: true, _isAbsTop: true, _isAbsBottom: true, + _isAbsHorizontalCenter: true, _isAbsVerticalCenter: true, + _originalWidth: 0, _originalHeight: 0, + _alignMode: 2, _lockFlags: 0, + }; +} + /** * 将 Spirit 记录按 BelongGroupID 归类, 生成 group-X 父节点集合 + Layer 根直挂子节点. * @@ -365,6 +398,25 @@ function makeWidget(nodeId, compPrefabId) { }; } +// Spirit 专用的 Widget 工厂: 调用 computeWidgetAlignment 计算锚定参数. +// 用法: buildSpiritBlock 在父节点是 group 时调用此工厂, 替代默认 makeWidget. +// 注意: 此工厂只应在 parent 确实是 group 容器 (而非 Layer 根) 时调用 — 见 +// buildSpiritBlock 的入参语义. Layer 根与 group-X 末尾 envelope 仍用 makeWidget. +function makeSpiritWidget(nodeId, compPrefabId, spirit) { + const align = computeWidgetAlignment(spirit); + return { + __type__: 'cc.Widget', + _name: '', + _objFlags: 0, + __editorExtras__: {}, + node: { __id__: nodeId }, + _enabled: true, + __prefab: { __id__: compPrefabId }, + ...align, // _alignFlags, _horizontal/verticalCenter... + _id: '', + }; +} + function makeSprite(nodeId, compPrefabId, spriteFrameUuid, type = 0) { return { __type__: 'cc.Sprite', @@ -574,7 +626,7 @@ export function emitPrefabJson(layer) { if (!spirit) { throw new Error(`emitPrefabJson: spirit id ${spiritId} referenced by ${gi.group.name} but not found in layer.spirits`); } - const info = buildSpiritBlock(spirit, { __id__: gi.nodeId }, out); + const info = buildSpiritBlock(spirit, { __id__: gi.nodeId }, out, { parentIsGroup: true }); spiritInfo.set(spiritId, info); gi.node._children.push({ __id__: info.nodeId }); } @@ -585,7 +637,7 @@ export function emitPrefabJson(layer) { if (!spirit) { throw new Error(`emitPrefabJson: root child spirit id ${spiritId} not found in layer.spirits`); } - const info = buildSpiritBlock(spirit, { __id__: rootId }, out); + const info = buildSpiritBlock(spirit, { __id__: rootId }, out, { parentIsGroup: false }); spiritInfo.set(spiritId, info); rootNode._children.push({ __id__: info.nodeId }); } @@ -605,8 +657,15 @@ export function emitPrefabJson(layer) { * 构造单个 Spirit 的所有对象 (Node + UITransform + CompPrefabInfo + 主组件 + * CompPrefabInfo + Widget + CompPrefabInfo + PrefabInfo), 按 schema 顺序 push * 到 out 数组, 返回关键 id 供外层 wiring. + * + * @param {object} spirit - Spirit 字段 + * @param {{ __id__: number }} parentRef - 父节点引用 + * @param {Array} out - 输出 JSON 数组 + * @param {{ parentIsGroup: boolean }} [opts] - parentIsGroup=true 时 Widget + * 走 computeWidgetAlignment (锚定 = 水平/垂直居中); false (Layer 根直挂) + * 走默认 makeWidget (_alignFlags=45 全屏铺满). */ -function buildSpiritBlock(spirit, parentRef, out) { +function buildSpiritBlock(spirit, parentRef, out, opts = { parentIsGroup: false }) { const lpos = computeLpos(spirit); const size = computeContentSize(spirit); const componentName = mapSpiritTypeToComponent(spirit.type); @@ -656,7 +715,11 @@ function buildSpiritBlock(spirit, parentRef, out) { const widgetCompInfo = makeCompPrefabInfo(); out.push(widgetCompInfo); const widgetCompInfoId = out.length - 1; - const widget = makeWidget(nodeId, widgetCompInfoId); + // parentIsGroup 时走 computeWidgetAlignment (水平+垂直居中); Layer 根直挂时 + // 用默认 _alignFlags=45 (全屏铺满占位, 后续 PoC 阶段再细化). + const widget = opts.parentIsGroup + ? makeSpiritWidget(nodeId, widgetCompInfoId, spirit) + : makeWidget(nodeId, widgetCompInfoId); out.push(widget); const widgetId = out.length - 1;