여기에 JSFiddle입니다.Phaser JS 이벤트를 중지하는 방법 textButton.events.onInputDown 이벤트에서 game.input.onDown 이벤트로 전파 (실행) 하시겠습니까?
두 가지 이벤트가 있습니다.
- 일부 로직 (내 예 입자 생성) textButton 다른 논리 않는하는 Phaser.Text 객체 인스턴스이다
- 가
textButton.events.onInputDown
인가하지game.input.onDown
이다.
문제는 : 나는 두 이벤트가 1 및 2을 해고 내 textButton 클릭 할 때.
문제는 어떻게이 textButton를 클릭하면 발사에서 이벤트 1을 방지하기 위해인가? 코드의
부 :
...
//This event is fired on click anywhere event # 1
game.input.onDown.add(particleBurst, this);
//This is Clickable text
textButton = game.add.text(game.world.width - 5, 5, "CLICK ME", fontStyle);
textButton.anchor.setTo(1, 0);
textButton.inputEnabled = true;
//This event is fired on click on text event # 2
textButton.events.onInputDown.add(function() {
console.log("button is Clicked");
}, this, 2);
...
감사합니다. @lpiepiora. 이것은 확실히 좋은 해결 방법으로 IMHO 작동합니다. 그러나 글로벌 게임 입력을위한 솔루션이 있는지 궁금합니다. 나는 내 자신의 우선 순위를 시도했지만 그 경우에는 작동하지 않습니다. –
@AlexanderArutinyants 나는 기꺼이 그것을 직접 알게되면 나는 더 좋은 길을 모른다.) – lpiepiora