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

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