summaryrefslogtreecommitdiffstats
path: root/js/mapspecs.js
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2012-07-31 22:34:08 -0700
committerPatrick Davison <snapwilliam@gmail.com>2012-07-31 22:34:08 -0700
commit2d290b23c402561ef30c1de665895c120dd79483 (patch)
tree8bde5ebd953f3dd375abe88e61e40571df313b1f /js/mapspecs.js
parent628c2e712e39fe85762583fd1ddc12609746fc58 (diff)
downloadpathery-2d290b23c402561ef30c1de665895c120dd79483.tar.xz
Everything related to the scoreboard.
New feedback page. Changed the speed of the pauses on checkpoints during a path animation. Changed how notifications are recieved.
Diffstat (limited to 'js/mapspecs.js')
-rw-r--r--js/mapspecs.js76
1 files changed, 10 insertions, 66 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js
index 6d3e4af..87bc173 100644
--- a/js/mapspecs.js
+++ b/js/mapspecs.js
@@ -27,7 +27,6 @@ var blocks = new Array();
var count = new Array();
var mapdata = new Array();
var mapjson = new Array();
-var htmlscores = '';
var htmlnotification = '';
var jsonmapdata = new Object;
//var jsonmapdata.solutions = new Array();
@@ -256,7 +255,8 @@ function resetwalls(mapid) {
function request_path_done() {
var JO = decryptJSON(ajax.response);
- mapjson[JO.mapid] = JO;
+ var mapid = JO.mapid;
+ mapjson[mapid] = JO;
var speedbox = document.getElementById(mapid+',speed'),
speed = speedbox.options[speedbox.selectedIndex].text,
@@ -273,9 +273,6 @@ function request_path_done() {
'response time': responseTime
});
- if (JO.scores)
- updateDsp(JO.mapid, 'dspScore', JO.scores);
-
for(var i in JO.error)
console.error('\n JO error ' + JO.error[i]);
@@ -288,34 +285,7 @@ function request_path_done() {
updateDsp(JO.mapid, 'dspID', disptext);
animatePath(JO.path, JO.mapid, JO.start);
-
- //Get score update.
- ajax.requestFile = "do.php?checkachieve=true&r=getscores&mapid="+JO.mapid; //prepare strdata
- ajax.onCompletion = request_scores_done; // Specify function to be executed on response.
- ajax.runAJAX();// Do it!
-}
-
-// Used at the start
-// Force score update.
-function updateScoresReq(mapid, type) {
- //Get score update.
- ajax.requestFile = "do.php?r=getscores&mapid="+mapid; //prepare strdata
- ajax.onCompletion = updateScoresGet; // Specify function to be executed on response.
- ajax.runAJAX();// Do it!
- mapType = type;
}
-function updateScoresGet() {
- var JO = decryptJSON(ajax.response);
- updateDsp(JO.mapid, 'dspScore', JO.scores);
-}
-
-function reqScoresDone() {
-
- var JO = decryptJSON(ajax.response);
- updateDsp(JO.mapid, 'dspScore', JO.scores);
-}
-//function addscorepage
-
function decryptJSON(text) {
if (typeof(JSON) == 'undefined') {
@@ -343,40 +313,14 @@ function animatePath(path, mapid, start) {
}
function animatePathDone(mapid) {
+ // console.log('Animate Path Done', mapid);
+ scoresRequestPage(mapid, currentPage[mapid]);
document.getElementById(mapid+',btn').disabled = false;
- if (htmlscores) {
- updateDsp(mapid, 'dspScore', htmlscores);
- htmlscores = '';
- }
- if (htmlnotification) {
- //setTimeout("showNotification('"+htmlnotification+"');", 300);
- showNotification(htmlnotification);
- if (checkSound(mapid)) {
- soundManager.setVolume('achieve', 50);
- setTimeout("soundManager.play('achieve');", 350);
- }
- htmlnotification = '';
- }
if (isChallenge == true) {
challengeGo(mapid);
}
}
-function request_scores_done() {
-
- //Get scores.
- if (typeof(JSON) == 'undefined') {
- text = ajax.response;
- var JO = !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g, ''))) && eval('(' + text + ')');
- //mapdata[mapid] = eval(document.getElementById(mapid+',mapdata').innerHTML);
- } else {
- var JO = JSON.parse(ajax.response);
- }
- htmlscores = JO.scores;
- htmlnotification = JO.notificationtext;
-}
-
-
function checkSound(mapid) {
if (document.getElementById(mapid+',mute').checked) {
return false;
@@ -632,25 +576,25 @@ function doanimate(x, y, p, c, mapid) {
snake[mapid]['color'] = '#F777FF';
break;
case 'b':
- rs = rs + 500;
+ rs = rs + 410;
snake[mapid]['color'] = '#FFFF11';
//handle.style.backgroundColor = "#000000";
break;
case 'c':
- rs = rs + 500;
+ rs = rs + 410;
snake[mapid]['color'] = '#FF4466';
break;
case 'd':
- rs = rs + 500;
+ rs = rs + 410;
snake[mapid]['color'] = '#ff9911';
break;
case 'e':
- rs = rs + 500;
+ rs = rs + 410;
snake[mapid]['color'] = '#00FFFF';
break;
//Finish target
case 'f':
- rs = rs + 500;
+ rs = rs + 410;
snake[mapid]['color'] = '#ccc';
break;
@@ -681,7 +625,7 @@ function doanimate(x, y, p, c, mapid) {
//The path once teleported - and an r to indicate to gray the teleport-out too.
p = 'q'+tmp[2];
//Slow down
- rs = rs + 1500;
+ rs = rs + 1200;
setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"',"+mapid+")",rs);
return;
break;