diff --git a/index.html b/index.html index 4efa466..2d81b5d 100644 --- a/index.html +++ b/index.html @@ -99,8 +99,14 @@ function manualAnimate(selector="#biggu"){ } // see https://biggu-backend-collab.glitch.me/ to insure steps are done correctly -function shareLiveEvent(eventName, server='https://biggu-backend-collab.glitch.me/'){ - if (eventName.length > 0) fetch(server+'/newevent/'+eventName) +function shareLiveEvent(eventName, eventData, server='https://biggu-backend-collab.glitch.me/'){ + if (!eventName) return + let data = {} + data.eventName = eventName + if (eventData) data.eventData = eventData + let playername = AFRAME.utils.getUrlParameter('playername') + if (playername) data.playername = playername + fetch(server+'/newevent/'+JSON.stringify(data)) } // should then become a container hosted on benetou.fr @@ -141,7 +147,7 @@ function checkExerciseCompletion(targetNumber=2){ } else { document.getElementById("biggucontinu").play() instructions.emit('failed', {counter:counter}) - shareLiveEvent('failed'+' '+counter) + shareLiveEvent('failed', {counter:counter}) animateThenIdle(mainCharacter, 'bigguaction_yes') // anims = [ "bigguaction_no", "Bigguaction_pl", "bigguaction_pr", "bigguaction_talk", "bigguaction_win", "bigguaction_win", "bigguaction_yes" ] } @@ -194,7 +200,8 @@ AFRAME.registerComponent('start-with-supervision', { source.addEventListener('message', message => { console.log('Got', message); - if (message.data == '"start-with-supervision"') startExercise() + let json = JSON.parse(message.data) + if (json && json.eventName == 'start-with-supervision') startExercise() }) } })