pause btn

This commit is contained in:
Kevin Ngo
2018-07-22 23:58:29 +02:00
parent 98c57f7b24
commit a3a11e9207
6 changed files with 32 additions and 18 deletions

16
package-lock.json generated
View File

@@ -62,7 +62,8 @@
},
"aframe": {
"version": "0.8.2",
"resolved": "github:aframevr/aframe#2afb6ac191f1a44edbbfe6f0e733380356a9e0c8",
"resolved": "https://registry.npmjs.org/aframe/-/aframe-0.8.2.tgz",
"integrity": "sha512-kp0c3f17moiilChTsD95q+USB7/12LuusGERSmO2X7Cgq6q6evVv9Oe7qRMZ6Baf26gS0T9Z7umc/e1alqcEVA==",
"requires": {
"@tweenjs/tween.js": "^16.8.0",
"browserify-css": "^0.8.2",
@@ -75,7 +76,7 @@
"present": "0.0.6",
"promise-polyfill": "^3.1.0",
"style-attr": "^1.0.2",
"three": "0.94.0",
"three": "github:supermedium/three.js#5ef2887ab3621cae54fa129a500424d6caa25b62",
"three-bmfont-text": "^2.1.0",
"webvr-polyfill": "^0.10.5"
}
@@ -119,9 +120,9 @@
"integrity": "sha512-ZZxD95DeMN7/NpLOe7Es3WCXNB37aIqttqI3meaTm00+OY0Q5q/1NkVsupthIlECO99iQg1evBhzRBfxj4wFWg=="
},
"aframe-layout-component": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/aframe-layout-component/-/aframe-layout-component-5.0.1.tgz",
"integrity": "sha512-vL7xsIMl0sm3hs4AT6WsLkUI+zvnPpHehQQR0uPNmQRMpxDiOl+wzXCCKINeuqlczjNDDRMMJZb8qrnn1Ziucg==",
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/aframe-layout-component/-/aframe-layout-component-5.2.0.tgz",
"integrity": "sha512-XbkMasvaTs/fc7h+dk9r9/y47nOE9FDE9kVP/byaO0i67z4uFuDaOtsAf7Gbwc04HB/7NsIEONMzSwZ3nru+iQ==",
"requires": {
"aframe": "^0.8.2",
"karma-chrome-launcher": "^2.2.0"
@@ -10105,9 +10106,8 @@
"dev": true
},
"three": {
"version": "0.94.0",
"resolved": "https://registry.npmjs.org/three/-/three-0.94.0.tgz",
"integrity": "sha1-TObbfyv795wtc0RKpuPPwIoy12I="
"version": "github:supermedium/three.js#5ef2887ab3621cae54fa129a500424d6caa25b62",
"from": "github:supermedium/three.js#r90fixMTLLoader"
},
"three-bmfont-text": {
"version": "2.3.0",

View File

@@ -13,7 +13,7 @@
"aframe-event-set-component": "^4.0.1",
"aframe-gltf-part-component": "1.1.0",
"aframe-haptics-component": "^1.4.1",
"aframe-layout-component": "^5.0.1",
"aframe-layout-component": "^5.2.0",
"aframe-orbit-controls": "^1.2.0",
"aframe-particle-system-component": "^1.0.11",
"aframe-proxy-event-component": "^1.1.1",

View File

@@ -2,6 +2,10 @@
* Pivot the scene when user enters VR to face the links.
*/
AFRAME.registerComponent('recenter', {
schema: {
enabled: {default: true}
},
init: function() {
var sceneEl = this.el.sceneEl;
this.matrix = new THREE.Matrix4();
@@ -18,9 +22,11 @@ AFRAME.registerComponent('recenter', {
});
// User can also recenter the menu manually.
sceneEl.addEventListener('menudown', () => {
if (!this.data.enabled) { return; }
this.recenter();
});
sceneEl.addEventListener('thumbstickdown', () => {
if (!this.data.enabled) { return; }
this.recenter();
});
},

View File

@@ -47,7 +47,7 @@ AFRAME.registerComponent('song-preview-system', {
this.audioStore[challengeId] = audio;
if (this.preloadQueue.length === 0) {
preloadMetatata(audio);
this.preloadMetadata(audio);
} else {
this.preloadQueue.push(audio);
}
@@ -56,7 +56,7 @@ AFRAME.registerComponent('song-preview-system', {
preloadMetadata: function (audio) {
audio.addEventListener('loadedmetadata', () => {
if (this.preloadQueue.length) {
preloadMetadata(this.preloadQueue[0]);
this.preloadMetadata(this.preloadQueue[0]);
}
});
audio.preload = 'metadata';

View File

@@ -23,7 +23,7 @@
<a-mixin id="textFont" text="font: exo2semibold; letterSpacing: -1"></a-mixin>
</a-assets>
<a-entity id="container" recenter>
<a-entity id="container" bind__recenter="enabled: menu.active">
{% include './templates/environment.html' %}
{% include './templates/gameUi.html' %}
{% include './templates/menu.html' %}
@@ -31,8 +31,16 @@
<a-entity id="cameraRig">
<a-entity id="camera" camera look-controls="enabled: false" orbit-controls="target: 0 1.6 -0.5; maxDistance: 20; initialPosition: 0 1.6 0"></a-entity>
<a-entity id="leftHand" controller="hand: left"></a-entity>
<a-entity id="rightHand" controller="hand: right"></a-entity>
<a-entity id="leftHand"
controller="hand: left"
proxy-event__pause="event: menudown; to: a-scene; as: pause"
proxy-event__pauserifta="event: abuttondown; to: a-scene; as: pause"
proxy-event__pauseriftb="event: bbuttondown; to: a-scene; as: pause"></a-entity>
<a-entity id="rightHand"
controller="hand: right"
proxy-event__pause="event: menudown; to: a-scene; as: pause"
proxy-event__pauseriftx="event: xbuttondown; to: a-scene; as: pause"
proxy-event__pauserifty="event: ybuttondown; to: a-scene; as: pause"></a-entity>
</a-entity>
<a-entity id="mouseCursor" mixin="raycaster" cursor="rayOrigin: mouse" debug-cursor

View File

@@ -82,6 +82,10 @@ AFRAME.registerState({
state.menuSelectedChallenge.difficulty = difficulty;
},
pause: (state) => {
state.menu.active = true;
},
/**
* Start challenge.
* Transfer staged challenge to the active challenge.
@@ -131,10 +135,6 @@ AFRAME.registerState({
computeSearchPagination(state);
},
togglemenu: (state) => {
state.menu.active = !state.menu.active;
},
'enter-vr': (state) => {
state.inVR = true;
},