CocosCreator 3.8.3
UI制作如上
SpriteSplash节点上有如下脚本
import { _decorator, Component, EventTouch, isValid, Node } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('TowerBuildItem')
export class TowerBuildItem extends Component {
protected start(): void {
this.node.on(Node.EventType.TOUCH_START, this.onTouchStart, this);
this.node.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
this.node.on(Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.node.on(Node.EventType.TOUCH_CANCEL, this.onTouchCancel, this);
}
onTouchStart(e: EventTouch) {
console.log("onTouchStart");
}
onTouchEnd(e: EventTouch) {
console.log("onTouchEnd");
}
onTouchMove(e: EventTouch) {
console.log("onTouchMove");
}
onTouchCancel(e: EventTouch) {
console.log("onTouchCancel");
}
}
运行结果1(刷新页面后,触摸移动,然后再节点内释放)
问题:
- onTouchCancel不该被触发
- onTouchEnd并没有被触发
运行结果2(刷新页面后,触摸移动,然后再节点外释放)

问题:
- onTouchCancel不该被触发
麻烦官方大佬和社区大佬帮看看是我用法有问题吗?



