summaryrefslogtreecommitdiffstats
path: root/js/mapspecs.js
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-03-24 11:33:41 -0700
committerPatrick Davison <snapwilliam@gmail.com>2013-03-24 11:33:41 -0700
commitfff387ad8f7d470d6bef696629a0dfa110467705 (patch)
treef16044532db03640aba6dcb293a992fbf6c4bfce /js/mapspecs.js
parente82855b44ce6db41112eabfe3ffda1bba40b113e (diff)
downloadpathery-fff387ad8f7d470d6bef696629a0dfa110467705.tar.xz
Finished wallOrientation setting
Diffstat (limited to 'js/mapspecs.js')
-rw-r--r--js/mapspecs.js46
1 files changed, 19 insertions, 27 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js
index cf2450a..d8b4ed3 100644
--- a/js/mapspecs.js
+++ b/js/mapspecs.js
@@ -91,6 +91,16 @@ function linkEmblem(emblem, orientation) {
if (orientation == 0) return url+emblem;
return url+'rotate.php?r='+orientation+'&emblem='+emblem;
}
+function setWallStyle(playerObject) {
+
+ if (typeof playerObject !== 'object') return;
+
+ wallColor = playerObject.wallColor;
+ wallEmblem = playerObject.wallEmblem;
+ wallOrientation = playerObject.wallOrientation;
+}
+
+
function grid_click(obj) {
@@ -136,30 +146,10 @@ function grid_click(obj) {
//childdiv.removeAttribute("class");
childdiv.setAttribute("class", "child w");
- if (wallColor == false) {
- if (typeof playerWallColor === 'undefined' || playerWallColor == '') {
- wallColor = '#666666';
- playerWallColor = '#666666';
- } else {
- wallColor = playerWallColor;
- }
- }
- if (wallEmblem == false) {
- if (typeof playerWallEmblem !== 'undefined' && playerWallEmblem !== '') {
- wallEmblem = playerWallEmblem;
- }
- }
- //TODO: Copy below - above w/ userObj
- if (wallOrientation == false) {
- if (typeof userObj !== 'undefined' && userObj.wallOrientation !== '') {
- wallOrientation = userObj.wallOrientation;
- }
- }
+ if (wallColor == false) setWallStyle(userObj);
obj.style.backgroundColor = wallColor;
- if (wallEmblem !== false) {
- //obj.style.backgroundImage="url(images/marks/"+wallEmblem+")";
- //obj.style.backgroundImage="url(images/marks/rotate.php?r=1&emblem="+wallEmblem+")";
+ if (wallEmblem) {
obj.style.backgroundImage="url("+linkEmblem(wallEmblem, wallOrientation)+")";
}
@@ -774,14 +764,14 @@ function contains(a, obj) {
//Shows a solution temporarly
-function useSolution(mapid, inputSolution, moves, tempWallColor, tempWallEmblem, solutionID) {
+function useSolution(mapid, inputSolution, moves, tempWallColor, tempWallEmblem, tempWallOrientation, solutionID) {
$('.solutionSelected').removeClass('solutionSelected');
$('#solution_'+solutionID).addClass('solutionSelected');
solution[mapid] = inputSolution;
- var animateA = "showTempSolution(\""+mapid+"\", \""+inputSolution+"\", \""+moves+"\", \""+tempWallColor+"\", \""+tempWallEmblem+"\");";
- var animateB = "showTempSolution(\""+mapid+"\", \""+inputSolution+"\", \""+moves+"\", false, false);";
+ var animateA = "showTempSolution(\""+mapid+"\", \""+inputSolution+"\", \""+moves+"\", \""+tempWallColor+"\", \""+tempWallEmblem+"\", \""+tempWallOrientation+"\");";
+ var animateB = "showTempSolution(\""+mapid+"\", \""+inputSolution+"\", \""+moves+"\", false, false, false);";
//TODO: Sticky colors for the placed walls by the user would be cool.
//var animateC = "wallColor = false; wallEmblem = false;";
setTimeout(animateA, 50);
@@ -792,7 +782,7 @@ function useSolution(mapid, inputSolution, moves, tempWallColor, tempWallEmblem,
setTimeout(animateB, 550);
}
//Shows a solution for temporary use, see 'RestoreSolution'
-function showTempSolution(mapid, tempSolution, moves, tempWallColor, tempWallEmblem) {
+function showTempSolution(mapid, tempSolution, moves, tempWallColor, tempWallEmblem, tempWallOrientation) {
//console.log('showTempSolution', mapid, solution, moves, tempWallColor, tempWallEmblem);
var savedSolution = '';
@@ -801,8 +791,10 @@ function showTempSolution(mapid, tempSolution, moves, tempWallColor, tempWallEmb
if (typeof solution[mapid] !== 'undefined') {
savedSolution = solution[mapid];
}
- wallEmblem = tempWallEmblem;
+
wallColor = tempWallColor;
+ wallEmblem = tempWallEmblem;
+ wallOrientation = tempWallOrientation;
position = tempSolution.split('.');