diff --git a/src/components/song.js b/src/components/song.js index 5d6f931..6b40b1f 100644 --- a/src/components/song.js +++ b/src/components/song.js @@ -26,7 +26,7 @@ AFRAME.registerComponent('song', { // Base volume. this.audioAnalyser.gainNode.gain.value = BASE_VOLUME; - this.el.addEventListener('pausemenurestart', this.onRestart.bind(this)); + this.el.addEventListener('gamemenurestart', this.onRestart.bind(this)); this.el.addEventListener('wallhitstart', this.onWallHitStart.bind(this)); this.el.addEventListener('wallhitend', this.onWallHitEnd.bind(this)); }, diff --git a/src/index.html b/src/index.html index c910c92..e545b35 100644 --- a/src/index.html +++ b/src/index.html @@ -38,8 +38,8 @@ pool__wall="mixin: wall; size: 10; container: #beatContainer" proxy-event__menuleft="event: menuchallengeunselect; to: .menuAnimation" proxy-event__menuright="event: menuchallengeselect; to: .menuAnimation" - proxy-event__cleargame1="event: pausemenuexit; as: cleargame; to: a-scene" - proxy-event__cleargame2="event: pausemenurestart; as: cleargame; to: a-scene" + proxy-event__cleargame1="event: gamemenuexit; as: cleargame; to: a-scene" + proxy-event__cleargame2="event: gamemenurestart; as: cleargame; to: a-scene" search stage-colors="color: blue" fog="color: #a00; density: 0.035; type: exponential" diff --git a/src/state/index.js b/src/state/index.js index 678f350..27e1342 100644 --- a/src/state/index.js +++ b/src/state/index.js @@ -110,6 +110,27 @@ AFRAME.registerState({ state.challenge.isLoading = true; }, + gamemenuresume: (state) => { + state.isPaused = false; + }, + + gamemenurestart: (state) => { + resetScore(state); + state.isBeatsPreloaded = false; + state.isGameOver = false; + state.isPaused = false; + }, + + gamemenuexit: (state) => { + resetScore(state); + state.isBeatsPreloaded = false; + state.isGameOver = false; + state.isPaused = false; + state.isVictory = false; + state.menu.active = true; + state.challenge.id = ''; + }, + keyboardclose: (state) => { state.keyboardActive = false; }, @@ -153,27 +174,6 @@ AFRAME.registerState({ state.isPaused = true; }, - pausemenuresume: (state) => { - state.isPaused = false; - }, - - pausemenurestart: (state) => { - resetScore(state); - state.isBeatsPreloaded = false; - state.isGameOver = false; - state.isPaused = false; - }, - - pausemenuexit: (state) => { - resetScore(state); - state.isBeatsPreloaded = false; - state.isGameOver = false; - state.isPaused = false; - state.isVictory = false; - state.menu.active = true; - state.challenge.id = ''; - }, - /** * Start challenge. * Transfer staged challenge to the active challenge. diff --git a/src/templates/inGameMenu.html b/src/templates/inGameMenu.html index 4893e19..34ab43c 100644 --- a/src/templates/inGameMenu.html +++ b/src/templates/inGameMenu.html @@ -23,7 +23,7 @@ mixin="dialogButton" bind-toggle__raycastable="isPaused" position="0 0.35 0" - proxy-event="event: click; to: a-scene; as: pausemenuresume" + proxy-event="event: click; to: a-scene; as: gamemenuresume" bind__visible="!isGameOver"> @@ -32,7 +32,7 @@ id="restartButton" bind-toggle__raycastable="isPaused || isGameOver" mixin="dialogButton" - proxy-event="event: click; to: a-scene; as: pausemenurestart"> + proxy-event="event: click; to: a-scene; as: gamemenurestart"> @@ -41,7 +41,7 @@ mixin="dialogButton" bind-toggle__raycastable="isPaused || isGameOver || isVictory" position="0 -0.35 0" - proxy-event="event: click; to: a-scene; as: pausemenuexit"> + proxy-event="event: click; to: a-scene; as: gamemenuexit">