From f136ce833f2ecd3273b87af3d9ede0471a5adf56 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Fri, 28 Aug 2015 17:35:29 +0200 Subject: [PATCH] Lol --- js/l3d/apps/prototype/Coin.js | 4 ++++ js/l3d/apps/prototype/interactive/main.js | 16 ++++++++++------ js/l3d/apps/prototype/tutorial/main.js | 11 +++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/js/l3d/apps/prototype/Coin.js b/js/l3d/apps/prototype/Coin.js index ce22280..75caeed 100644 --- a/js/l3d/apps/prototype/Coin.js +++ b/js/l3d/apps/prototype/Coin.js @@ -183,6 +183,10 @@ Coin.prototype.get = function() { if (!this.got) { this.got = true; + if (typeof Coin.onCoinGot === 'function') { + Coin.onCoinGot(Coin.total + 1); + } + // Call the callback if any if (this.callback) this.callback(); diff --git a/js/l3d/apps/prototype/interactive/main.js b/js/l3d/apps/prototype/interactive/main.js index f1d5c07..d18cf4d 100644 --- a/js/l3d/apps/prototype/interactive/main.js +++ b/js/l3d/apps/prototype/interactive/main.js @@ -27,12 +27,16 @@ window.onbeforeunload = function() { }; -setTimeout(function() { - $('#next').show(); - $('#next').click(function() { - window.location = '/prototype/games'; - }); -}, 3*60*1000); +Coin.onCoinGot = function(coin) { + if (coin === 6) { + setTimeout(function() { + $('#next').show(); + $('#next').click(function() { + window.location = '/prototype/games'; + }); + }, 60*1000); + } +}; function main() { diff --git a/js/l3d/apps/prototype/tutorial/main.js b/js/l3d/apps/prototype/tutorial/main.js index e2f3091..905efc4 100644 --- a/js/l3d/apps/prototype/tutorial/main.js +++ b/js/l3d/apps/prototype/tutorial/main.js @@ -18,6 +18,17 @@ var pointer; var startCanvas; var tutorial; +Coin.onCoinGot = function(val) { + if (val === 6) { + setTimeout(function() { + $('#next').show(); + $('#next').click(function() { + window.location = '/prototype/games'; + }); + }, 60*1000); + } +}; + function main() { // Main container that holds everything