2018-07-20 20:47:42 +02:00
|
|
|
var bindEvent = require('aframe-event-decorators').bindEvent;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Select difficulty.
|
|
|
|
|
*/
|
|
|
|
|
AFRAME.registerComponent('menu-difficulty-select', {
|
2018-07-21 20:53:24 +02:00
|
|
|
init: function () {
|
|
|
|
|
this.el.sceneEl.addEventListener('menuchallengeselect', () => {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.el.components.layout.update();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
2018-07-20 20:47:42 +02:00
|
|
|
click: bindEvent(function (evt) {
|
2018-07-21 23:00:19 +02:00
|
|
|
this.el.sceneEl.emit(
|
|
|
|
|
'menudifficultyselect',
|
|
|
|
|
evt.target.closest('.difficultyOption').dataset.difficulty,
|
|
|
|
|
false);
|
2018-07-20 20:47:42 +02:00
|
|
|
})
|
|
|
|
|
});
|