properly offline mode (with AFrame 1.6 bump)

game-multiple-levels
Fabien Benetou 2 months ago
parent 0741953057
commit 23be37ff89
  1. 25
      index.html

@ -3,14 +3,18 @@
<title>SpaSca : Spatial Scaffolding</title>
<head>
<!-- Suggestions? https://git.benetou.fr/utopiah/text-code-xr-engine/issues/ -->
<script src='dependencies/aframe.offline.min.js'></script>
<!--<script src='dependencies/aframe.offline.min.js'></script>-->
<script>
window.AFRAME_CDN_ROOT='../content/cdn/'
</script>
<script src='dependencies/aframe-1.6.0-offline.min.js'></script>
<script src="dependencies/a-console.js"></script>
<script src='dependencies/aframe-troika-text.min.js'></script>
<script src='dependencies/aframe-troika-text-remote.min.js'></script>
<script src='dependencies/webdav.js'></script>
<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-extras@7.1.0/dist/aframe-extras.min.js"></script>
<script src="dependencies/aframe-extras.min.js"></script>
<script src="dependencies/aframe-physics-system.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-physics-system@v4.2.2/dist/aframe-physics-system.min.js"></script>
<script src='jxr-core.js?12345'></script>
<script src='jxr-postitnote.js?13235'></script>
<script src='jxr-core.js'></script>
</head>
<body>
<script>
@ -54,8 +58,9 @@ AFRAME.registerComponent('startfunctions', {
let untestedGames = ["checkers", "carcassone"]
//addGame("voxelpaint")
//addGame("simon")
//addGame("physics-construct")
addGame("manipulable-arithemtic", true)
addGame("physics-construct")
//addGame("manipulable-arithmetic")
// TODO add new games (e.g manipulable vector) to menu
//addGames()
}
@ -96,7 +101,7 @@ function addGames(){
setTimeout( _ => {
let newEl = document.createElement("a-image")
newEl.setAttribute("src", imgPath+g.id+imgExtension)
//newEl.setAttribute("position", "-1 0 0")
newEl.setAttribute("position", "-1 0 0")
newEl.setAttribute("target", "true") // now works despite relative position... but weird
newEl.setAttribute("onreleased", "showOnlyThisGame('"+g.id+"')")
n.appendChild( newEl )
@ -122,10 +127,11 @@ const fishTemplate = '<a-gltf-model onreleased="snapRightOf()" target scale=".00
const functionAdderTemplate = '<a-troika-text value="x" onreleased="snapRightOf()" target scale=".1 .1 .1" position="0.1 1 -1"></a-troika-text>'
const functionNumberTemplate = '<a-troika-text value="2" onreleased="snapRightOf()" target scale=".1 .1 .1" position="0.2 1 -1"></a-troika-text>'
AFRAME.registerComponent('manipulable-arithemtic', {
AFRAME.registerComponent('manipulable-arithmetic', {
init: function(){
let generatorName = this.attrName
let el = this.el
el.classList.add('game')
let templatesToAdd = [ fishTemplate, functionAdderTemplate ]
let numbers = Array(10).fill(functionNumberTemplate)
let numbersEl = addFromTemplateList( numbers, el )
@ -839,6 +845,7 @@ function checkDistanceToDedicatedTargetSpot(generatorName){
//___________________________________________________________________________________________________________________________________
// should moved to e.g src='jxr-game-maze.js'
AFRAME.registerComponent('mazemap', {
schema: {type:'string'},
init: function(){
let el = this.el
this.data.split("\n").filter(l=>l.length>0).map( (line,i) => {

Loading…
Cancel
Save