import { _decorator, Component, Node, EventHandler, SystemEventType } from 'cc'; const { ccclass, property } = _decorator; @ccclass('EventHelp') export class EventHelp extends Component { @property(EventHandler) beginHandler: EventHandler; @property(EventHandler) moveHandler: EventHandler; @property(EventHandler) endHandler: EventHandler; start() { this.node.on(SystemEventType.TOUCH_START, (e: TouchType) => { this.beginHandler && this.beginHandler.emit([e]); }, this); this.node.on(SystemEventType.TOUCH_MOVE, (e: TouchType) => { this.beginHandler && this.moveHandler.emit([e]); }, this); this.node.on(SystemEventType.TOUCH_END, (e: TouchType) => { this.beginHandler && this.endHandler.emit([e]); }, this); } }