diff --git a/assets/img/keyboard/keyboard-hover.png b/assets/img/keyboard/keyboard-hover.png index ff12653..5a59ff6 100644 Binary files a/assets/img/keyboard/keyboard-hover.png and b/assets/img/keyboard/keyboard-hover.png differ diff --git a/assets/img/keyboard/keyboard-hover.png.bkup b/assets/img/keyboard/keyboard-hover.png.bkup new file mode 100644 index 0000000..ff12653 Binary files /dev/null and b/assets/img/keyboard/keyboard-hover.png.bkup differ diff --git a/assets/img/keyboard/keyboard.png b/assets/img/keyboard/keyboard.png index 5ad2643..fc34f11 100644 Binary files a/assets/img/keyboard/keyboard.png and b/assets/img/keyboard/keyboard.png differ diff --git a/assets/img/keyboard/keyboard.png.bkup b/assets/img/keyboard/keyboard.png.bkup new file mode 100644 index 0000000..5ad2643 Binary files /dev/null and b/assets/img/keyboard/keyboard.png.bkup differ diff --git a/src/components/recenter.js b/src/components/recenter.js index ca078d7..a2e4ac4 100644 --- a/src/components/recenter.js +++ b/src/components/recenter.js @@ -16,6 +16,7 @@ AFRAME.registerComponent('recenter', { }); this.el.addEventListener('recenter', this.recenter); + this.el.sceneEl.addEventListener('recenter', this.recenter); }, recenter: (function () { diff --git a/src/components/search.js b/src/components/search.js index 0aba4d5..375c2eb 100644 --- a/src/components/search.js +++ b/src/components/search.js @@ -54,19 +54,20 @@ AFRAME.registerComponent('search', { const zipFileReader = new zip.BlobReader(zipBlob); const zipReader = new zip.ZipReader(zipFileReader); const files = await zipReader.getEntries(); - const info = _.find(files, {filename: "Info.dat"}); - //const infoStream = new TransformStream(); - //const infoPromise = new Response(infoStream.readable).text(); + console.log(files); + const info = _.find(files, {filename: "Info.dat"}) || _.find(files, {filename: "info.dat"}); const infoBlob = await info.getData(new zip.BlobWriter()); const infoJson = JSON.parse(await infoBlob.text()); console.log(infoJson); const songFile = _.find(files, {filename: infoJson._songFilename}); const songBlob = await songFile.getData(new zip.BlobWriter()); const songUrl = URL.createObjectURL(songBlob); - console.log(songUrl); const coverFile = _.find(files, {filename: infoJson._coverImageFilename}); - const coverBlob = await coverFile.getData(new zip.BlobWriter()); - const coverUrl = URL.createObjectURL(coverBlob); + let coverUrl=""; + if(coverFile){ + const coverBlob = await coverFile.getData(new zip.BlobWriter()); + coverUrl = URL.createObjectURL(coverBlob); + } const difficultyInfo = infoJson._difficultyBeatmapSets[0]._difficultyBeatmaps; const difficultyFiles = {}; difficultyInfo.forEach(async (d) => { diff --git a/src/components/super-keyboard.js b/src/components/super-keyboard.js index ee1947d..3c17e73 100644 --- a/src/components/super-keyboard.js +++ b/src/components/super-keyboard.js @@ -1,6 +1,6 @@ /* global AFRAME */ var KEYBOARDS = { - supersaber: {wrapCount: 20, inputOffsetY: 0.008, inputOffsetX: 0.08, img: 'keyboard.png', hoverImg: 'keyboard-hover.png', layout: [{"key":"1", "x":0.014, "y":0.024, "w":0.094, "h":0.183}, {"key":"2", "x":0.108, "y":0.024, "w":0.094, "h":0.183}, {"key":"3", "x":0.203, "y":0.024, "w":0.095, "h":0.183}, {"key":"4", "x":0.299, "y":0.024, "w":0.094, "h":0.183}, {"key":"5", "x":0.394, "y":0.024, "w":0.093, "h":0.183}, {"key":"6", "x":0.487, "y":0.024, "w":0.095, "h":0.183}, {"key":"7", "x":0.583, "y":0.024, "w":0.093, "h":0.183}, {"key":"8", "x":0.677, "y":0.024, "w":0.095, "h":0.183}, {"key":"9", "x":0.772, "y":0.024, "w":0.093, "h":0.183}, {"key":"0", "x":0.866, "y":0.024, "w":0.093, "h":0.183}, {"key":"q", "x":0.014, "y":0.215, "w":0.094, "h":0.183}, {"key":"w", "x":0.108, "y":0.215, "w":0.094, "h":0.183}, {"key":"e", "x":0.203, "y":0.215, "w":0.095, "h":0.183}, {"key":"r", "x":0.299, "y":0.215, "w":0.094, "h":0.183}, {"key":"t", "x":0.394, "y":0.215, "w":0.093, "h":0.183}, {"key":"y", "x":0.487, "y":0.215, "w":0.095, "h":0.183}, {"key":"i", "x":0.677, "y":0.215, "w":0.095, "h":0.183}, {"key":"u", "x":0.583, "y":0.215, "w":0.093, "h":0.183}, {"key":"o", "x":0.772, "y":0.215, "w":0.093, "h":0.183}, {"key":"p", "x":0.866, "y":0.215, "w":0.093, "h":0.183}, {"key":"a", "x":0.063, "y":0.405, "w":0.094, "h":0.183}, {"key":"s", "x":0.158, "y":0.405, "w":0.094, "h":0.183}, {"key":"d", "x":0.253, "y":0.405, "w":0.095, "h":0.183}, {"key":"f", "x":0.349, "y":0.405, "w":0.094, "h":0.183}, {"key":"g", "x":0.443, "y":0.405, "w":0.093, "h":0.183}, {"key":"h", "x":0.537, "y":0.405, "w":0.095, "h":0.183}, {"key":"j", "x":0.633, "y":0.405, "w":0.092, "h":0.183}, {"key":"k", "x":0.726, "y":0.405, "w":0.095, "h":0.183}, {"key":"l", "x":0.821, "y":0.405, "w":0.093, "h":0.183}, {"key":"z", "x":0.111, "y":0.598, "w":0.093, "h":0.181}, {"key":"x", "x":0.205, "y":0.598, "w":0.095, "h":0.181}, {"key":"c", "x":0.301, "y":0.598, "w":0.095, "h":0.181}, {"key":"v", "x":0.396, "y":0.598, "w":0.093, "h":0.181}, {"key":"b", "x":0.49, "y":0.598, "w":0.094, "h":0.181}, {"key":"n", "x":0.585, "y":0.598, "w":0.094, "h":0.181}, {"key":"m", "x":0.68, "y":0.598, "w":0.093, "h":0.181}, {"key":"Delete", "x":0.777, "y":0.598, "w":0.137, "h":0.181}, {"key":" ", "x":0.297, "y":0.788, "w":0.381, "h":0.201}, {"key":"Escape", "x":0.013, "y":0.797, "w":0.137, "h":0.181}, {"key":"Insert", "x":0.014, "y":-0.001, "w":0.01, "h":0.005}]} + supersaber: {wrapCount: 20, inputOffsetY: 0.008, inputOffsetX: 0.08, img: 'keyboard.png', hoverImg: 'keyboard-hover.png', layout: [{"key":"1", "x":0.014, "y":0.024, "w":0.094, "h":0.183}, {"key":"2", "x":0.108, "y":0.024, "w":0.094, "h":0.183}, {"key":"3", "x":0.203, "y":0.024, "w":0.095, "h":0.183}, {"key":"4", "x":0.299, "y":0.024, "w":0.094, "h":0.183}, {"key":"5", "x":0.394, "y":0.024, "w":0.093, "h":0.183}, {"key":"6", "x":0.487, "y":0.024, "w":0.095, "h":0.183}, {"key":"7", "x":0.583, "y":0.024, "w":0.093, "h":0.183}, {"key":"8", "x":0.677, "y":0.024, "w":0.095, "h":0.183}, {"key":"9", "x":0.772, "y":0.024, "w":0.093, "h":0.183}, {"key":"0", "x":0.866, "y":0.024, "w":0.093, "h":0.183}, {"key":"q", "x":0.014, "y":0.215, "w":0.094, "h":0.183}, {"key":"w", "x":0.108, "y":0.215, "w":0.094, "h":0.183}, {"key":"e", "x":0.203, "y":0.215, "w":0.095, "h":0.183}, {"key":"r", "x":0.299, "y":0.215, "w":0.094, "h":0.183}, {"key":"t", "x":0.394, "y":0.215, "w":0.093, "h":0.183}, {"key":"y", "x":0.487, "y":0.215, "w":0.095, "h":0.183}, {"key":"i", "x":0.677, "y":0.215, "w":0.095, "h":0.183}, {"key":"u", "x":0.583, "y":0.215, "w":0.093, "h":0.183}, {"key":"o", "x":0.772, "y":0.215, "w":0.093, "h":0.183}, {"key":"p", "x":0.866, "y":0.215, "w":0.093, "h":0.183}, {"key":"a", "x":0.063, "y":0.405, "w":0.094, "h":0.183}, {"key":"s", "x":0.158, "y":0.405, "w":0.094, "h":0.183}, {"key":"d", "x":0.253, "y":0.405, "w":0.095, "h":0.183}, {"key":"f", "x":0.349, "y":0.405, "w":0.094, "h":0.183}, {"key":"g", "x":0.443, "y":0.405, "w":0.093, "h":0.183}, {"key":"h", "x":0.537, "y":0.405, "w":0.095, "h":0.183}, {"key":"j", "x":0.633, "y":0.405, "w":0.092, "h":0.183}, {"key":"k", "x":0.726, "y":0.405, "w":0.095, "h":0.183}, {"key":"l", "x":0.821, "y":0.405, "w":0.093, "h":0.183}, {"key":"z", "x":0.111, "y":0.598, "w":0.093, "h":0.181}, {"key":"x", "x":0.205, "y":0.598, "w":0.095, "h":0.181}, {"key":"c", "x":0.301, "y":0.598, "w":0.095, "h":0.181}, {"key":"v", "x":0.396, "y":0.598, "w":0.093, "h":0.181}, {"key":"b", "x":0.49, "y":0.598, "w":0.094, "h":0.181}, {"key":"n", "x":0.585, "y":0.598, "w":0.094, "h":0.181}, {"key":"m", "x":0.68, "y":0.598, "w":0.093, "h":0.181}, {"key":"Delete", "x":0.777, "y":0.598, "w":0.137, "h":0.181}, {"key":" ", "x":0.297, "y":0.788, "w":0.381, "h":0.201}, {"key":"Escape", "x":0.013, "y":0.797, "w":0.137, "h":0.181}, {"key":"Enter", "x":0.850, "y":0.797, "w":0.137, "h":0.181}, {"key":"Insert", "x":0.014, "y":-0.001, "w":0.01, "h":0.005}]} }; if (typeof AFRAME === 'undefined') { @@ -425,7 +425,10 @@ AFRAME.registerComponent('super-keyboard', { switch (this.keyHover.key) { case 'Enter': { - this.accept(); + //this.accept(); + console.log("Enter Search", this.changeEventDetail); + this.el.emit('superkeyboardchange', this.changeEventDetail); + //this.dismiss(); break; } case 'Insert': { @@ -437,7 +440,7 @@ AFRAME.registerComponent('super-keyboard', { this.el.setAttribute('super-keyboard', 'value', newValue); this.updateTextInput(newValue); this.changeEventDetail.value = newValue; - this.el.emit('superkeyboardchange', this.changeEventDetail); + //this.el.emit('superkeyboardchange', this.changeEventDetail); break; } case 'Shift': { @@ -458,7 +461,7 @@ AFRAME.registerComponent('super-keyboard', { this.el.setAttribute('super-keyboard', 'value', newValue); this.updateTextInput(newValue); this.changeEventDetail.value = newValue; - this.el.emit('superkeyboardchange', this.changeEventDetail); + // this.el.emit('superkeyboardchange', this.changeEventDetail); break; } } diff --git a/src/index.html b/src/index.html index 4c518cc..a1b4771 100644 --- a/src/index.html +++ b/src/index.html @@ -234,8 +234,8 @@ scale="1.3 1.3 1.3"> {% endmacro %} - {{ saber('left', 'right', '#850e3e', 'pink') }} {{ saber('right', 'left', '#256c43', 'cyan') }} + {{ saber('left', 'right', '#850e3e', 'pink') }}