keep preview playing if searching
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user