feat(guide): 新增新手引导系统功能

1.  创建了通用引导预制体guide.prefab,包含手势提示节点
2.  实现GuideComp组件,支持引导状态跟踪、点击交互和自动销毁
3.  在角色控制和技能框预制体中接入引导组件,配置默认引导ID
4.  完成引导完成状态的本地记录与节点自动隐藏逻辑
This commit is contained in:
pan
2026-06-11 16:32:05 +08:00
parent 193beb0d24
commit 1c74138334
6 changed files with 2680 additions and 1034 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,394 @@
[
{
"__type__": "cc.Prefab",
"_name": "guide",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "guide",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 14
},
{
"__id__": 16
}
],
"_prefab": {
"__id__": 18
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 640,
"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": "hand",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": {
"__id__": 11
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -294.238,
"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": "hand",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 8
},
"_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.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 98,
"height": 111
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "79Vu4Cv05PnJw1LXaSE4DD"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@5990a",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e4qJ7s1yxD9JrYdfGLFkVo"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "c98HTacPpLKZkCGXoKpM4T",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 10
},
"_contentSize": {
"__type__": "cc.Size",
"width": 400,
"height": 140
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8bH6M7VahGk79zZiTESQBG"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "cbf1XjyLtM3ptfNNcea20y",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "50NXlbXx9PHYhb8LT2nDRv"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 15
},
"_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": 100,
"_originalHeight": 100,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "10DsksGxZDUbKjtrjCTMxF"
},
{
"__type__": "25122z/cnRPhp90+CJYs5+r",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 17
},
"hand": {
"__id__": 2
},
"guide_id": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1fYnYBrbBNgoLyArRX18hs"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "6dh4o/8p1Cy5An1p6o4Bc3",
"targetOverrides": null
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "93fda804-b794-4119-a287-952a70be15cb",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "guide"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -22,26 +22,26 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 437 "__id__": 445
}, },
{ {
"__id__": 446 "__id__": 454
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 459 "__id__": 467
}, },
{ {
"__id__": 461 "__id__": 469
}, },
{ {
"__id__": 463 "__id__": 471
} }
], ],
"_prefab": { "_prefab": {
"__id__": 465 "__id__": 473
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -100,17 +100,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 430 "__id__": 438
}, },
{ {
"__id__": 432 "__id__": 440
}, },
{ {
"__id__": 434 "__id__": 442
} }
], ],
"_prefab": { "_prefab": {
"__id__": 436 "__id__": 444
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -9423,36 +9423,140 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "guide",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_prefab": {
"__id__": 417
},
"__editorExtras__": {}
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 416
},
"asset": {
"__uuid__": "93fda804-b794-4119-a287-952a70be15cb",
"__expectedType__": "cc.Prefab"
},
"fileId": "6dh4o/8p1Cy5An1p6o4Bc3",
"instance": {
"__id__": 418
},
"targetOverrides": null
},
{
"__type__": "cc.PrefabInstance",
"fileId": "5aJhr6IKBCvr1yjzfuMlha",
"prefabRootNode": {
"__id__": 1
},
"mountedChildren": [],
"mountedComponents": [
{
"__id__": 419
}
],
"propertyOverrides": [
{
"__id__": 433
},
{
"__id__": 435
},
{
"__id__": 436
},
{
"__id__": 437
}
],
"removedComponents": []
},
{
"__type__": "cc.MountedComponentsInfo",
"targetInfo": {
"__id__": 420
},
"components": [
{
"__id__": 421
}
]
},
{
"__type__": "cc.TargetInfo",
"localID": [
"cbf1XjyLtM3ptfNNcea20y"
]
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {
"mountedRoot": {
"__id__": 416
}
},
"node": {
"__id__": 422
},
"_enabled": true,
"__prefab": {
"__id__": 432
},
"_alignFlags": 44,
"_target": null,
"_left": 160,
"_right": 160,
"_top": 0,
"_bottom": 275.762,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 400,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "hand",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 416
},
"_children": [ "_children": [
{ {
"__id__": 417 "__id__": 423
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 423 "__id__": 429
}, },
{ {
"__id__": 425 "__id__": 421
},
{
"__id__": 427
} }
], ],
"_prefab": { "_prefab": {
"__id__": 429 "__id__": 431
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 640, "y": -294.238,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -9484,25 +9588,25 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 416 "__id__": 422
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 418 "__id__": 424
}, },
{ {
"__id__": 420 "__id__": 426
} }
], ],
"_prefab": { "_prefab": {
"__id__": 422 "__id__": 428
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 36.036, "x": 0,
"y": -354.417, "y": 0,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -9534,11 +9638,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 417 "__id__": 423
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 419 "__id__": 425
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -9562,11 +9666,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 417 "__id__": 423
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 421 "__id__": 427
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@@ -9582,7 +9686,7 @@
"__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@5990a", "__uuid__": "6165ffc9-a838-4a33-b569-bdbaaab0e6b4@5990a",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 1,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 1, "_sizeMode": 1,
"_fillCenter": { "_fillCenter": {
@@ -9620,16 +9724,16 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 416 "__id__": 422
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 424 "__id__": 430
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 720, "width": 400,
"height": 1280 "height": 140
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -9640,64 +9744,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "50NXlbXx9PHYhb8LT2nDRv" "fileId": "8bH6M7VahGk79zZiTESQBG"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 416
},
"_enabled": true,
"__prefab": {
"__id__": 426
},
"_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": 100,
"_originalHeight": 100,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "10DsksGxZDUbKjtrjCTMxF"
},
{
"__type__": "25122z/cnRPhp90+CJYs5+r",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 416
},
"_enabled": true,
"__prefab": {
"__id__": 428
},
"hand": {
"__id__": 417
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1fYnYBrbBNgoLyArRX18hs"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
@@ -9707,11 +9754,77 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "6dh4o/8p1Cy5An1p6o4Bc3", "fileId": "cbf1XjyLtM3ptfNNcea20y",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6b+8SFUXpKIYA8Q2ep3HVS"
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 434
},
"propertyPath": [
"_name"
],
"value": "guide"
},
{
"__type__": "cc.TargetInfo",
"localID": [
"6dh4o/8p1Cy5An1p6o4Bc3"
]
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 434
},
"propertyPath": [
"_lpos"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 640,
"z": 0
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 434
},
"propertyPath": [
"_lrot"
],
"value": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
}
},
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 434
},
"propertyPath": [
"_euler"
],
"value": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
}
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -9722,7 +9835,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 431 "__id__": 439
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -9750,7 +9863,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 433 "__id__": 441
}, },
"_alignFlags": 21, "_alignFlags": 21,
"_target": null, "_target": null,
@@ -9786,7 +9899,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 435 "__id__": 443
}, },
"home_btn": { "home_btn": {
"__id__": 121 "__id__": 121
@@ -9835,14 +9948,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 438 "__id__": 446
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 437 "__id__": 445
}, },
"asset": { "asset": {
"__uuid__": "26bff847-cd29-48a5-bbfa-c3e2dbda688d", "__uuid__": "26bff847-cd29-48a5-bbfa-c3e2dbda688d",
@@ -9850,7 +9963,7 @@
}, },
"fileId": "5a9CMsVQhKP5Y+UJfTKPbx", "fileId": "5a9CMsVQhKP5Y+UJfTKPbx",
"instance": { "instance": {
"__id__": 439 "__id__": 447
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -9864,19 +9977,19 @@
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{ {
"__id__": 440 "__id__": 448
}, },
{ {
"__id__": 442 "__id__": 450
}, },
{ {
"__id__": 443 "__id__": 451
}, },
{ {
"__id__": 444 "__id__": 452
}, },
{ {
"__id__": 445 "__id__": 453
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -9884,7 +9997,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 441 "__id__": 449
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -9900,7 +10013,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 441 "__id__": 449
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -9915,7 +10028,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 441 "__id__": 449
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -9931,7 +10044,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 441 "__id__": 449
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -9946,7 +10059,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 441 "__id__": 449
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
@@ -9960,14 +10073,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 447 "__id__": 455
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 446 "__id__": 454
}, },
"asset": { "asset": {
"__uuid__": "56aee962-4a5e-45ae-a779-999444d06d18", "__uuid__": "56aee962-4a5e-45ae-a779-999444d06d18",
@@ -9975,7 +10088,7 @@
}, },
"fileId": "cboM54s0hM07XCtrpFp0/b", "fileId": "cboM54s0hM07XCtrpFp0/b",
"instance": { "instance": {
"__id__": 448 "__id__": 456
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -9988,29 +10101,29 @@
"mountedChildren": [], "mountedChildren": [],
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{
"__id__": 449
},
{
"__id__": 451
},
{
"__id__": 452
},
{
"__id__": 453
},
{
"__id__": 454
},
{
"__id__": 456
},
{ {
"__id__": 457 "__id__": 457
}, },
{ {
"__id__": 458 "__id__": 459
},
{
"__id__": 460
},
{
"__id__": 461
},
{
"__id__": 462
},
{
"__id__": 464
},
{
"__id__": 465
},
{
"__id__": 466
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -10018,7 +10131,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 450 "__id__": 458
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -10034,7 +10147,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 450 "__id__": 458
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -10049,7 +10162,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 450 "__id__": 458
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -10065,7 +10178,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 450 "__id__": 458
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -10080,7 +10193,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 455 "__id__": 463
}, },
"propertyPath": [ "propertyPath": [
"_top" "_top"
@@ -10096,7 +10209,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 455 "__id__": 463
}, },
"propertyPath": [ "propertyPath": [
"_alignFlags" "_alignFlags"
@@ -10106,7 +10219,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 455 "__id__": 463
}, },
"propertyPath": [ "propertyPath": [
"_bottom" "_bottom"
@@ -10116,7 +10229,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 450 "__id__": 458
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
@@ -10133,7 +10246,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 460 "__id__": 468
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -10161,7 +10274,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 462 "__id__": 470
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@@ -10197,7 +10310,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 464 "__id__": 472
}, },
"debugMode": false, "debugMode": false,
"_id": "" "_id": ""
@@ -10219,10 +10332,13 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {
"__id__": 446 "__id__": 454
}, },
{ {
"__id__": 437 "__id__": 445
},
{
"__id__": 416
}, },
{ {
"__id__": 55 "__id__": 55

View File

@@ -3,9 +3,7 @@ import { mLogger } from "../common/Logger";
import { _decorator, Animation, AnimationClip, EventTouch, Label, Node, NodeEventType, Sprite, SpriteAtlas, Tween, tween, UIOpacity, Vec3, resources, Light, UITransform, Widget, CCInteger } from "cc"; import { _decorator, Animation, AnimationClip, EventTouch, Label, Node, NodeEventType, Sprite, SpriteAtlas, Tween, tween, UIOpacity, Vec3, resources, Light, UITransform, Widget, CCInteger } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -20,18 +18,64 @@ export class GuideComp extends CCComp {
/** 手势图标节点 */ /** 手势图标节点 */
@property(Node) @property(Node)
hand: Node = null! hand: Node = null!
/** 手势图标节点 */
/** 引导编号 ID */
@property({ type: CCInteger }) @property({ type: CCInteger })
guide_id: number = 0 guide_id: number = 0
onLoad() { onLoad() {
// 如果该引导已经完成,则隐藏并销毁本节点
if (smc.finish_guides.includes(this.guide_id)) {
this.node.active = false;
this.node.destroy();
return;
} }
// 监听手势节点点击事件
if (this.hand) {
this.hand.on(NodeEventType.TOUCH_START, this.onTouchStart, this);
this.hand.on(NodeEventType.TOUCH_END, this.onGuideClick, this);
} else {
// 兜底:如果没有绑定手势节点,则监听自身节点
this.node.on(NodeEventType.TOUCH_START, this.onTouchStart, this);
this.node.on(NodeEventType.TOUCH_END, this.onGuideClick, this);
}
}
private onTouchStart(event: EventTouch) {
// 允许事件穿透,确保底层的实际功能按钮能正常接收到 TOUCH_START 事件
event.preventSwallow = true;
}
private onGuideClick(event: EventTouch) {
// 记录该引导 ID 已完成
if (!smc.finish_guides.includes(this.guide_id)) {
smc.finish_guides.push(this.guide_id);
mLogger.log(this.debugMode, 'Guide', `完成引导 ID: ${this.guide_id}`);
// TODO: 若需要持久化保存,可在此处调用本地存储或同步到服务器的方法
// oops.storage.set("finish_guides", smc.finish_guides);
}
// 允许事件穿透,确保底层的实际功能按钮能正常接收到点击事件
event.preventSwallow = true;
// 完成后隐藏并销毁引导节点
this.node.active = false;
this.node.destroy();
}
/** 组件销毁时解绑所有事件,防止残留回调 */ /** 组件销毁时解绑所有事件,防止残留回调 */
onDestroy() { onDestroy() {
if (this.hand && this.hand.isValid) {
this.hand.off(NodeEventType.TOUCH_START, this.onTouchStart, this);
this.hand.off(NodeEventType.TOUCH_END, this.onGuideClick, this);
}
if (this.node && this.node.isValid) {
this.node.off(NodeEventType.TOUCH_START, this.onTouchStart, this);
this.node.off(NodeEventType.TOUCH_END, this.onGuideClick, this);
}
} }
/** 外部初始化入口(由 MissionGuideComp 调用) */ /** 外部初始化入口(由 MissionGuideComp 调用) */
@@ -39,9 +83,10 @@ export class GuideComp extends CCComp {
} }
/** ECS 组件移除时的释放钩子:销毁节点 */ /** ECS 组件移除时的释放钩子:销毁节点 */
reset() { reset() {
if (this.node && this.node.isValid) {
this.node.destroy(); this.node.destroy();
} }
}
} }