Javascript 如何在phaser.js中捕获全局触摸事件

Javascript 如何在phaser.js中捕获全局触摸事件,javascript,touch,phaser-framework,Javascript,Touch,Phaser Framework,触摸屏幕的任何部分后,我都需要做一些动作。此时此刻,我正在使用这样的方法: update: function() { if (this.game.input.activePointer.isDown) { this.game.input.keyboard.onDownCallback = null; this.start(); } } 但我觉得这样做不对,我可能可以像使用键盘一样使用回调: this.game.input.keyboard.on

触摸屏幕的任何部分后,我都需要做一些动作。此时此刻,我正在使用这样的方法:

update: function() {
    if (this.game.input.activePointer.isDown) {
        this.game.input.keyboard.onDownCallback = null;
        this.start();
    }
}
但我觉得这样做不对,我可能可以像使用键盘一样使用回调:

 this.game.input.keyboard.onDownCallback = function(e){
        this.game.input.keyboard.onDownCallback = null;
        self.start();
    }
有没有什么方法可以在触摸时使用回调而不是签入更新

this.game.input.onDown.add(function() {
    console.log("input captured");
});

就这么简单。它适用于鼠标和触摸。

谢谢!其实很简单。