From 55b25d5e66710298a50ecdcc8fb8db8cb3b2fb8a Mon Sep 17 00:00:00 2001 From: raylu Date: Tue, 15 Nov 2011 23:09:44 -0800 Subject: change locking --- pages/tutorial.php | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'pages/tutorial.php') diff --git a/pages/tutorial.php b/pages/tutorial.php index d3a1aa0..36d6721 100644 --- a/pages/tutorial.php +++ b/pages/tutorial.php @@ -18,7 +18,7 @@ function challengeGo(mapid) { switch (mapid) { case '1': - tv.unlock(2); + tv.unlock(); flashelement('nextbtn', 15, null, 400); updateDsp(1, 'instructions', "Now that you see what's going on, let's move on to some puzzles."); break; @@ -27,7 +27,7 @@ function challengeGo(mapid) { if (moves >= 18) { flashelement('nextbtn', 15, null, 400); updateDsp(1, 'instructions', "Great, that's 18 moves!
Lets move on to the next shall we?"); - tv.unlock(3); + tv.unlock(); } else { updateDsp(1, 'instructions', "The goal for this map is 18 moves.
Place 2 walls to make the path longer"); var tiles = ["2,3,5","2,4,6"]; @@ -39,7 +39,7 @@ function challengeGo(mapid) { if (moves >= 64) { flashelement('nextbtn', 15, null, 400); updateDsp(1, 'instructions', '

I almost confused you! hehe.

Next?

'); - tv.unlock(4); + tv.unlock(); } else { updateDsp(1, 'instructions', '

The path can travel over the start and end tiles too.


'); var tiles = ["3,3,6","3,4,7","3,3,2","3,2,1"]; @@ -51,7 +51,7 @@ function challengeGo(mapid) { if (moves >= 45) { flashelement('nextbtn', 15, null, 400); updateDsp(1, 'instructions', "Figure out how that teleport worked?
Play with it if you didn't"); - tv.unlock(5); + tv.unlock(); } else { updateDsp(1, 'instructions', "Let's use that teleport to block the way to the A!
We can also make it take longer to get to A in the process."); var tiles = ["4,1,5","4,2,6","4,3,7","4,5,9"]; @@ -104,8 +104,6 @@ function challengeLoad() {} function challenge() { //this. } -challenge.prototype.unlock = function(id) { -} //var ch = new challenge(); @@ -141,8 +139,6 @@ function TutorialView(low, high) { this.low = low; this.high = high; this.cur = low; - //Lock them all. - this.locked = low; this.nextbtn = document.getElementById('nextbtn'); this.prevbtn = document.getElementById('prevbtn'); } @@ -154,22 +150,19 @@ TutorialView.prototype.showTutorial = function(num) { } var elem = document.getElementById("tut-" + num); elem.className = elem.className.replace('hidden', ''); - //Is the map after this disabled? - this.nextbtn.className = this.nextbtn.className.replace('disabled', ''); - if (this.locked <= this.cur) - this.nextbtn.className += ' disabled'; startChallenge(num); } TutorialView.prototype.next = function() { - //Is the next map locked? - if (this.locked <= this.cur) + if (this.nextbtn.className.indexOf(' disabled') > -1) return; this.showTutorial(++this.cur); if (this.cur == this.high) { if (this.nextbtn.className.indexOf('hidden') < 0) this.nextbtn.className += ' hidden'; - } else + } else { this.nextbtn.className = this.nextbtn.className.replace('hidden', ''); + this.nextbtn.className += ' disabled'; + } this.prevbtn.className = this.prevbtn.className.replace('hidden', ''); } TutorialView.prototype.prev = function() { @@ -181,12 +174,8 @@ TutorialView.prototype.prev = function() { this.prevbtn.className = this.prevbtn.className.replace('hidden', ''); this.nextbtn.className = this.nextbtn.className.replace('hidden', ''); } -TutorialView.prototype.unlock = function(num) { - if (num > this.locked) { - this.locked = num; - if (this.locked >= this.cur) - this.nextbtn.className = this.nextbtn.className.replace('disabled', ''); - } +TutorialView.prototype.unlock = function(n) { + this.nextbtn.className = this.nextbtn.className.replace('disabled', ''); } -- cgit v1.2.3