ondrop timing fix

game-remote-save
Fabien Benetou 1 month ago
parent 898464c29b
commit 1caa31f9b7
  1. 8
      index.html
  2. 3
      jxr.js

@ -31,7 +31,7 @@
<!-- still experimenting, see webdav.html -->
<script src='dependencies/webdav.js'></script>
<script src='jxr.js?212345'></script>
<script src='jxr.js?12345'></script>
<!-- replacing with local copies as CDNs are like unpkg tend to be slow
<script type="module" src="https://unpkg.com/immers-client/dist/destination.bundle.js"></script>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
@ -134,6 +134,9 @@ function animateThenIdle(mainCharacter, animationName, timeScale='1'){
}
function checkExerciseCompletion(targetNumber=2){
console.log('checkExerciseCompletion', targetNumber)
// does not seem to happen...
// does ondrop work still?
const instructions = document.querySelector("#instructions>a-troika-text")
let counter = 0
const mainCharacter = document.getElementById("biggu")
@ -213,6 +216,8 @@ function startExercise(){
for (let i=0;i<maxFishes;i++){
let gltfEl = document.createElement('a-gltf-model')
gltfEl.setAttribute("ondrop","checkExerciseCompletion()")
// setOnDropFromAttribute()
// might be problematic due to timing somehow...
gltfEl.setAttribute("target","true")
gltfEl.setAttribute("scale",".001 .001 .001")
gltfEl.setAttribute("src","../content/winterset/Fish.glb")
@ -223,6 +228,7 @@ function startExercise(){
//console.log("position",`${x} ${y} ${z}`)
document.querySelector("#fishes").appendChild(gltfEl)
} // might want to appear from the start
setTimeout( _ => setOnDropFromAttribute(), 500)
// audio does not match asset, should be a white bowl, not black
document.getElementById("exerciseA").setAttribute("visible", false)

@ -3713,6 +3713,7 @@ function setOnDropFromAttribute(){
// add to file descriptor from offtopus
// could also be prototyped with a URL instead, doesn't need offtopus even cached version
// could also prototype by doing so via https://webdav.benetou.fr/fot-demo-day/mobydick-extract.txt
console.log('setOnDropFromAttribute')
targets.map( el => {
if ( el.getAttribute('ondrop')?.length > 0 )
el.addEventListener('released', e => {
@ -3733,7 +3734,7 @@ function setOnDropFromAttribute(){
// does indeed create problems, namely other pages relying on it do get this testing behavior
AFRAME.registerComponent('startfunctions', {
init: function () {
console.log('startfunctions')
setOnDropFromAttribute()
/* class clonableasset : Crystal.glb Fish.glb Mountains.glb Penguin.glb Pinetree.glb
consider also

Loading…
Cancel
Save