1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| var messageQueue = [];
ws.onmessage = function(event) { var data = event.data; console.log("Received data: " + data); messageQueue.push(data); };
setInterval(function() { if (messageQueue.length > 0) { var data = messageQueue.shift(); console.log("Processing data: " + data); this._view._TextC_broadcast.string = data; let broadMessage = instantiate(this._view._TextC_broadcast.node); tween(broadMessage).to(broadTime*1.5, { position: new Vec3(x, 0, 0) }).call(()=>{ broadMessage.destroy(); }).start(); } }, 1000);
|