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