diff --git a/src/components/intro-song.js b/src/components/intro-song.js index 3155360..2aa8993 100644 --- a/src/components/intro-song.js +++ b/src/components/intro-song.js @@ -1,6 +1,7 @@ AFRAME.registerComponent('intro-song', { schema: { - isPlaying: {default: true} + isPlaying: {default: true}, + isSearching: {default: false} }, init: function () { @@ -14,6 +15,8 @@ AFRAME.registerComponent('intro-song', { if (!this.el.sceneEl.isPlaying) { return; } + if (!oldData.isSearching && this.data.isSearching) { return; } + // Play. if (!oldData.isPlaying && this.data.isPlaying) { this.analyserEl.components.audioanalyser.resumeContext(); diff --git a/src/components/song-preview.js b/src/components/song-preview.js index 9e37b19..a7d45be 100644 --- a/src/components/song-preview.js +++ b/src/components/song-preview.js @@ -9,6 +9,7 @@ AFRAME.registerComponent('song-preview-system', { schema: { challengeId: {default: ''}, debug: {default: false}, + isSearching: {default: false}, isSongLoading: {default: false}, // Continue to play preview song during loading. selectedChallengeId: {type: 'string'} }, @@ -37,7 +38,7 @@ AFRAME.registerComponent('song-preview-system', { } // Unselect. - if (oldData.selectedChallengeId && !data.selectedChallengeId) { + if (oldData.selectedChallengeId && !data.selectedChallengeId && !data.isSearching) { this.stopSong(); } diff --git a/src/index.html b/src/index.html index 4992bf4..1fae2ea 100644 --- a/src/index.html +++ b/src/index.html @@ -17,10 +17,10 @@ mixin="gameoverAnimation fogAnimation" bind__beat-loader="challengeId: challenge.id; difficulty: challenge.difficulty; isPlaying: isPlaying" bind__gameover="isGameOver: isGameOver" - bind__intro-song="isPlaying: menuActive && !menuSelectedChallenge.id" + bind__intro-song="isPlaying: menuActive && !menuSelectedChallenge.id; isSearching: isSearching" bind__overlay="enabled: !isPlaying" bind__song="challengeId: challenge.id; isPlaying: isPlaying; isBeatsPreloaded: challenge.isBeatsPreloaded; isGameOver: isGameOver" - bind__song-preview-system="challengeId: challenge.id; isSongLoading: isSongLoading; selectedChallengeId: menuSelectedChallenge.id" + bind__song-preview-system="challengeId: challenge.id; isSearching: isSearching; isSongLoading: isSongLoading; selectedChallengeId: menuSelectedChallenge.id" animation__gameover="property: object3D.background; type: color; to: #750000; startEvents: gameover" animation__gameoverfog="property: components.fog.el.object3D.fog.color; type: color; to: #330000; startEvents: gameover; dur: 500; easing: easeInQuad" console-shortcuts