From 13485d8e6c385968378e2a790a44b36b5cfc798b Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Tue, 2 Jun 2015 14:14:32 +0200 Subject: [PATCH] Removed useless buttons from replays... --- .../prototype/views/prototype_replays.jade | 16 ++++++++---- js/prototype/Coin.js | 20 +++++++------- js/prototype/replay.js | 26 +++++++++---------- 3 files changed, 35 insertions(+), 27 deletions(-) diff --git a/controllers/prototype/views/prototype_replays.jade b/controllers/prototype/views/prototype_replays.jade index 4a9fc92..9f1f4dc 100644 --- a/controllers/prototype/views/prototype_replays.jade +++ b/controllers/prototype/views/prototype_replays.jade @@ -1,11 +1,17 @@ -extends ./prototype +extends ../../../views/withjs block title - title #{title} - Prototype - Replay + title #{title} - Prototype -block configjs +block extrajs + script(src="/static/js/prototypetools.min.js") script RecommendedCamera = FixedCamera; script var params = params || {}; params.get = params.get || {}; params.get.id = #{id}; - -block mainjs script(src="/static/js/replay.min.js") + +block extrahead + link(rel="stylesheet" href="/static/css/prototype.css") + +block content + #main-div.panel-group(style={'margin-top':'10px', 'margin-bottom':'10px'}) + #container(style={'padding': '0px', 'margin': '0px'}, tabindex="1") diff --git a/js/prototype/Coin.js b/js/prototype/Coin.js index cd8c51d..b03d76d 100644 --- a/js/prototype/Coin.js +++ b/js/prototype/Coin.js @@ -54,16 +54,18 @@ Coin.prototype.get = function() { if (Coin.total === 9) { // You got the last coin var music = document.getElementById('music'); - var wasPlaying = !music.paused; - music.pause(); - setTimeout(function() { - Coin.lastSound.play(); + if (music !== null) { + var wasPlaying = !music.paused; + music.pause(); setTimeout(function() { - if (wasPlaying) { - music.play(); - } - }, Coin.lastSound.duration*1000); - }, Coin.nextSound.duration*1000); + Coin.lastSound.play(); + setTimeout(function() { + if (wasPlaying) { + music.play(); + } + }, Coin.lastSound.duration*1000); + }, Coin.nextSound.duration*1000); + } } else { Coin.nextSound = new Audio('/static/data/music/redcoins/' + Coin.total + Coin.extension); Coin.nextSound.preload = "auto"; diff --git a/js/prototype/replay.js b/js/prototype/replay.js index 2c43941..90847ce 100644 --- a/js/prototype/replay.js +++ b/js/prototype/replay.js @@ -92,10 +92,10 @@ function initListeners() { // document.addEventListener('keydown', function(event) { if (event.keyCode == 27) { stopFullscreen();} }, false); // HTML Bootstrap buttons - buttonManager = new ButtonManager(cameras); + // buttonManager = new ButtonManager(cameras); // Camera selecter for hover and clicking recommendations - cameraSelecter = new CameraSelecter(renderer, scene, cameras, buttonManager); + // cameraSelecter = new CameraSelecter(renderer, scene, cameras, buttonManager); } function fullscreen() { @@ -155,19 +155,19 @@ function stopFullscreen() { } function render() { - cameraSelecter.update(); + // cameraSelecter.update(); // Update recommendations (set raycastable if shown) - var transform = buttonManager.showArrows ? show : hide; - cameras.map(function(camera) { - if (camera instanceof RecommendedCamera) { - transform(camera); + // var transform = buttonManager.showArrows ? show : hide; + // cameras.map(function(camera) { + // if (camera instanceof RecommendedCamera) { + // transform(camera); - camera.traverse(function(elt) { - elt.raycastable = buttonManager.showArrows; - }); - } - }); + // camera.traverse(function(elt) { + // elt.raycastable = buttonManager.showArrows; + // }); + // } + // }); // Update coins coins.forEach(function(coin) { coin.update(); }); @@ -191,7 +191,7 @@ function render() { renderer.render(scene, cameras.mainCamera()); // Hide arrows in recommendation - cameras.map(function(camera) { if (camera instanceof RecommendedCamera) hide(camera); }); + // cameras.map(function(camera) { if (camera instanceof RecommendedCamera) hide(camera); }); } function animate() {