feat(引导系统): 新增引导预制体并优化引导交互逻辑

新增引导1至引导4四个引导预制体及对应元数据文件
优化GuideComp组件:添加触摸事件监听与销毁解绑逻辑,实现事件穿透以保证底层功能按钮正常响应
调整已完成引导列表的初始值从空数组改为包含0号引导项
更新角色控制器预制体的引导相关配置参数
This commit is contained in:
pan
2026-06-12 10:08:37 +08:00
parent 167c6b485a
commit facccf9a6a
12 changed files with 5846 additions and 1625 deletions

View File

@@ -1,7 +1,7 @@
[ [
{ {
"__type__": "cc.Prefab", "__type__": "cc.Prefab",
"_name": "guide", "_name": "guide1",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_native": "", "_native": "",
@@ -13,7 +13,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "guide", "_name": "guide1",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": null, "_parent": null,
@@ -740,7 +740,7 @@
"__id__": 30 "__id__": 30
} }
], ],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 36 "__id__": 36

View File

@@ -8,6 +8,6 @@
], ],
"subMetas": {}, "subMetas": {},
"userData": { "userData": {
"syncNodeName": "guide" "syncNodeName": "guide1"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "26b4ba5a-c5e4-405a-8ce9-27be21f86171",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "guide2"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "9864952d-1b4a-4fb8-9e10-05ae52a1befb",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "guide3"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "d2dcd02d-b49b-45ea-8e20-1cc474837da9",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "guide4"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -22,26 +22,26 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 445 "__id__": 449
}, },
{ {
"__id__": 454 "__id__": 458
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 467
},
{
"__id__": 469
},
{ {
"__id__": 471 "__id__": 471
},
{
"__id__": 473
},
{
"__id__": 475
} }
], ],
"_prefab": { "_prefab": {
"__id__": 473 "__id__": 477
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -99,18 +99,18 @@
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 438
},
{
"__id__": 440
},
{ {
"__id__": 442 "__id__": 442
},
{
"__id__": 444
},
{
"__id__": 446
} }
], ],
"_prefab": { "_prefab": {
"__id__": 444 "__id__": 448
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -9460,17 +9460,20 @@
} }
], ],
"propertyOverrides": [ "propertyOverrides": [
{
"__id__": 433
},
{ {
"__id__": 435 "__id__": 435
}, },
{ {
"__id__": 436 "__id__": 437
}, },
{ {
"__id__": 437 "__id__": 438
},
{
"__id__": 439
},
{
"__id__": 440
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -9506,7 +9509,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 432 "__id__": 434
}, },
"_alignFlags": 44, "_alignFlags": 44,
"_target": null, "_target": null,
@@ -9544,14 +9547,14 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 429 "__id__": 431
}, },
{ {
"__id__": 421 "__id__": 421
} }
], ],
"_prefab": { "_prefab": {
"__id__": 431 "__id__": 433
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -9584,7 +9587,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "hand", "_name": "shouzhi",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
@@ -9598,10 +9601,13 @@
}, },
{ {
"__id__": 426 "__id__": 426
},
{
"__id__": 428
} }
], ],
"_prefab": { "_prefab": {
"__id__": 428 "__id__": 430
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -9705,6 +9711,39 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "e4qJ7s1yxD9JrYdfGLFkVo" "fileId": "e4qJ7s1yxD9JrYdfGLFkVo"
}, },
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 423
},
"_enabled": true,
"__prefab": {
"__id__": 429
},
"playOnLoad": false,
"_clips": [
{
"__uuid__": "70fd0e99-c640-4497-b2c2-936f5179f227",
"__expectedType__": "cc.AnimationClip"
},
{
"__uuid__": "be8b49e0-c726-4c44-823e-d50921b886d3",
"__expectedType__": "cc.AnimationClip"
}
],
"_defaultClip": {
"__uuid__": "70fd0e99-c640-4497-b2c2-936f5179f227",
"__expectedType__": "cc.AnimationClip"
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "68wJojAspAaqazqpHr1Fes"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
@@ -9728,7 +9767,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 430 "__id__": 432
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -9766,7 +9805,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 434 "__id__": 436
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -9782,7 +9821,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 434 "__id__": 436
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -9797,7 +9836,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 434 "__id__": 436
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -9813,7 +9852,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 434 "__id__": 436
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -9825,6 +9864,22 @@
"z": 0 "z": 0
} }
}, },
{
"__type__": "CCPropertyOverrideInfo",
"targetInfo": {
"__id__": 441
},
"propertyPath": [
"guide_id"
],
"value": 1
},
{
"__type__": "cc.TargetInfo",
"localID": [
"1fYnYBrbBNgoLyArRX18hs"
]
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -9835,7 +9890,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 439 "__id__": 443
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -9863,7 +9918,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 441 "__id__": 445
}, },
"_alignFlags": 21, "_alignFlags": 21,
"_target": null, "_target": null,
@@ -9899,7 +9954,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 443 "__id__": 447
}, },
"home_btn": { "home_btn": {
"__id__": 121 "__id__": 121
@@ -9948,14 +10003,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 446 "__id__": 450
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 445 "__id__": 449
}, },
"asset": { "asset": {
"__uuid__": "26bff847-cd29-48a5-bbfa-c3e2dbda688d", "__uuid__": "26bff847-cd29-48a5-bbfa-c3e2dbda688d",
@@ -9963,7 +10018,7 @@
}, },
"fileId": "5a9CMsVQhKP5Y+UJfTKPbx", "fileId": "5a9CMsVQhKP5Y+UJfTKPbx",
"instance": { "instance": {
"__id__": 447 "__id__": 451
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -9976,20 +10031,20 @@
"mountedChildren": [], "mountedChildren": [],
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{
"__id__": 448
},
{
"__id__": 450
},
{
"__id__": 451
},
{ {
"__id__": 452 "__id__": 452
}, },
{ {
"__id__": 453 "__id__": 454
},
{
"__id__": 455
},
{
"__id__": 456
},
{
"__id__": 457
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -9997,7 +10052,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 449 "__id__": 453
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -10013,7 +10068,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 449 "__id__": 453
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -10028,7 +10083,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 449 "__id__": 453
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -10044,7 +10099,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 449 "__id__": 453
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -10059,7 +10114,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 449 "__id__": 453
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
@@ -10073,14 +10128,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 455 "__id__": 459
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 454 "__id__": 458
}, },
"asset": { "asset": {
"__uuid__": "56aee962-4a5e-45ae-a779-999444d06d18", "__uuid__": "56aee962-4a5e-45ae-a779-999444d06d18",
@@ -10088,7 +10143,7 @@
}, },
"fileId": "cboM54s0hM07XCtrpFp0/b", "fileId": "cboM54s0hM07XCtrpFp0/b",
"instance": { "instance": {
"__id__": 456 "__id__": 460
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -10101,20 +10156,11 @@
"mountedChildren": [], "mountedChildren": [],
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{
"__id__": 457
},
{
"__id__": 459
},
{
"__id__": 460
},
{ {
"__id__": 461 "__id__": 461
}, },
{ {
"__id__": 462 "__id__": 463
}, },
{ {
"__id__": 464 "__id__": 464
@@ -10124,6 +10170,15 @@
}, },
{ {
"__id__": 466 "__id__": 466
},
{
"__id__": 468
},
{
"__id__": 469
},
{
"__id__": 470
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -10131,7 +10186,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 458 "__id__": 462
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -10147,7 +10202,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 458 "__id__": 462
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -10162,7 +10217,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 458 "__id__": 462
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -10178,7 +10233,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 458 "__id__": 462
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -10193,7 +10248,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 463 "__id__": 467
}, },
"propertyPath": [ "propertyPath": [
"_top" "_top"
@@ -10209,7 +10264,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 463 "__id__": 467
}, },
"propertyPath": [ "propertyPath": [
"_alignFlags" "_alignFlags"
@@ -10219,7 +10274,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 463 "__id__": 467
}, },
"propertyPath": [ "propertyPath": [
"_bottom" "_bottom"
@@ -10229,7 +10284,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 458 "__id__": 462
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
@@ -10246,7 +10301,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 468 "__id__": 472
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -10274,7 +10329,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 470 "__id__": 474
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@@ -10310,7 +10365,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 472 "__id__": 476
}, },
"debugMode": false, "debugMode": false,
"_id": "" "_id": ""
@@ -10329,13 +10384,20 @@
}, },
"fileId": "6514ysgfJNtIx/ak03+nce", "fileId": "6514ysgfJNtIx/ak03+nce",
"instance": null, "instance": null,
"targetOverrides": null, "targetOverrides": [
"nestedPrefabInstanceRoots": [
{ {
"__id__": 454 "__id__": 478
}, },
{ {
"__id__": 445 "__id__": 481
}
],
"nestedPrefabInstanceRoots": [
{
"__id__": 458
},
{
"__id__": 449
}, },
{ {
"__id__": 416 "__id__": 416
@@ -10353,5 +10415,65 @@
"__id__": 3 "__id__": 3
} }
] ]
},
{
"__type__": "cc.TargetOverrideInfo",
"source": {
"__id__": 416
},
"sourceInfo": {
"__id__": 479
},
"propertyPath": [
"hand"
],
"target": {
"__id__": 416
},
"targetInfo": {
"__id__": 480
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"1fYnYBrbBNgoLyArRX18hs"
]
},
{
"__type__": "cc.TargetInfo",
"localID": [
"cbf1XjyLtM3ptfNNcea20y"
]
},
{
"__type__": "cc.TargetOverrideInfo",
"source": {
"__id__": 416
},
"sourceInfo": {
"__id__": 482
},
"propertyPath": [
"clickNode"
],
"target": {
"__id__": 416
},
"targetInfo": {
"__id__": 483
}
},
{
"__type__": "cc.TargetInfo",
"localID": [
"1fYnYBrbBNgoLyArRX18hs"
]
},
{
"__type__": "cc.TargetInfo",
"localID": [
"66lMyyOIJOM6WzoHGNf2yi"
]
} }
] ]

View File

@@ -44,7 +44,7 @@ export class SingletonModuleComp extends ecs.Comp {
in_fight: false, in_fight: false,
stop_mon_action: false, stop_mon_action: false,
}; };
finish_guides: number[] = [] finish_guides: number[] = [0]
data: any = { data: any = {
score: 0, score: 0,
mission: 1, mission: 1,

View File

@@ -64,13 +64,24 @@ export class GuideComp extends CCComp {
} }
}); });
} }
// 监听手势节点点击事件
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 事件
* (现在通过编辑器绑定 Button 组件或代码显式调用触发) event.preventSwallow = true;
*/ }
public onGuideClick() {
private onGuideClick(event: EventTouch) {
// 记录该引导 ID 已完成 // 记录该引导 ID 已完成
if (!smc.finish_guides.includes(this.guide_id)) { if (!smc.finish_guides.includes(this.guide_id)) {
smc.finish_guides.push(this.guide_id); smc.finish_guides.push(this.guide_id);
@@ -80,6 +91,9 @@ export class GuideComp extends CCComp {
// oops.storage.set("finish_guides", smc.finish_guides); // oops.storage.set("finish_guides", smc.finish_guides);
} }
// 允许事件穿透,确保底层的实际功能按钮能正常接收到点击事件
event.preventSwallow = true;
// 完成后隐藏并销毁引导节点 // 完成后隐藏并销毁引导节点
this.node.active = false; this.node.active = false;
this.node.destroy(); this.node.destroy();
@@ -87,6 +101,14 @@ export class GuideComp extends CCComp {
/** 组件销毁时解绑所有事件,防止残留回调 */ /** 组件销毁时解绑所有事件,防止残留回调 */
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 调用) */