summaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
Diffstat (limited to 'pages')
-rw-r--r--pages/challengeeditor.php20
-rw-r--r--pages/challengelist.php88
2 files changed, 88 insertions, 20 deletions
diff --git a/pages/challengeeditor.php b/pages/challengeeditor.php
index 33a9511..9b1371f 100644
--- a/pages/challengeeditor.php
+++ b/pages/challengeeditor.php
@@ -55,15 +55,15 @@ function addNewChallengeMap($mapCode, $tier, $subOrder, $name) {
}
//Returns challenge ID
-function addNewChallenge($mapID, $inequality, $goal, $ordering, $hint,
+function addNewChallenge($mapID, $inequality, $goal, $ordering, $hint, $dialogStart, $dialogFail, $dialogSuccess,
$restrictWallCount = 'null', $restrictWallPlacement = 'null', $restrictTeleportCount = 'null',
$restrictTeleportsUsed = 'null', $restrictStartPoint = 'null', $restrictEndPoint = 'null') {
$sql = "INSERT INTO `challenges` (
- `mapID`, `inequality`, `goal`, `ordering`, `hint`
+ `mapID`, `inequality`, `goal`, `ordering`, `hint`, `dialogStart`, `dialogFail`, `dialogSuccess`
)
VALUES (
- '$mapID', '$inequality', $goal, $ordering, '$hint'
+ '$mapID', '$inequality', $goal, $ordering, '$hint', '$dialogStart', '$dialogFail', '$dialogSuccess'
)";
// `restrictWallCount`, `restrictWallPlacement`, `restrictTeleportCount`,
@@ -96,7 +96,16 @@ if (isset($_POST['challengeMapID'])) {
$goal = $_POST['goal'];
$ordering = $_POST['ordering'];
$hint = $_POST['hint'];
- $challengeID = addNewChallenge($mapID, $inequality, $goal, $ordering, $hint);
+
+ $dialogStart = $_POST['dialogStart'];
+ $dialogFail = $_POST['dialogFail'];
+ $dialogSuccess = $_POST['dialogSuccess'];
+
+ $challengeID = addNewChallenge(
+ $mapID, $inequality, $goal,
+ $ordering, $hint, $dialogStart,
+ $dialogFail, $dialogSuccess
+ );
$infoDisplayText = "Challenge Added!: $challengeID";
}
@@ -153,6 +162,9 @@ topbar($Links);
<br />Goal:<input name='goal' size="5" type="number" value="" class="forminput"/>
<br /><b>"inequality" </b><br />E.G. greater than, less than, equal: <input name='inequality' size="15" type="text" value="" class="forminput"/>
<br />hint <input name='hint' size="15" type="hint" value="" class="forminput"/>
+ <br />dialogStart <input name='dialogStart' size="20" type="hint" value="" class="forminput"/>
+ <br />dialogFail <input name='dialogFail' size="20" type="hint" value="" class="forminput"/>
+ <br />dialogSuccess <input name='dialogSuccess' size="20" type="hint" value="" class="forminput"/>
<br />Order:<input name='ordering' size="5" type="text" value="" class="forminput"/>
<br /><input type="submit" value="Add Challenge" class="forminput"/>
</div>
diff --git a/pages/challengelist.php b/pages/challengelist.php
index d460ef5..db5608e 100644
--- a/pages/challengelist.php
+++ b/pages/challengelist.php
@@ -33,8 +33,10 @@ function challengeGo() {}
//Temporary hack..
isChallenge = true;
-function navShowChallengeTiers() {
+var viewTier;
+var viewDepth;
+function navShowChallengeTiers() {
}
function navShowLevels(tier) {
@@ -45,6 +47,7 @@ function navShowLevels(tier) {
var urlString = 'ajax/challenges.ajax.php?getChallengeIDs=true';
urlString += "&userID="+userObj.ID;
+ urlString += "&tier="+tier;
$.ajax({
type: "GET",
url: urlString,
@@ -52,25 +55,34 @@ function navShowLevels(tier) {
data: '',
fail: function() { alert("ajax error - if this persists check your connection."); },
complete: function(data) {showLevelsResponse(data.responseText);}
- });
+ });
+ viewTier = tier;
}
function showLevelsResponse(response) {
var json = decryptJSON(response);
+ var speedDelay = 100;
$.each(json, function(key, challengeObj) {
- console.log("tests", key, challengeObj);
+ console.log("tests", speedDelay, key, challengeObj);
//$("#thumb_"+mapID).html(formatMapThumbForNav(data.responseText)).show();
- $("#mainDisplay").append(formatChallengeThumbnail(challengeObj.mapObject)).show();
- mapdata[key] = challengeObj.mapObject;
+
+ //var randomSpeed = 500 + Math.floor((Math.random()*300)+1);
+ //var speedDelay = 100 + (parseInt(challengeObj.mapObject.ID) * 100);
+ speedDelay = speedDelay + 200;
+
+ $("#mainDisplay").append(formatChallengeThumbnail(challengeObj.mapObject));
+ $('#challengeMapThumb_'+challengeObj.mapObject.ID).hide().fadeIn(speedDelay);
+
+ mapdata[challengeObj.mapObject.ID] = challengeObj.mapObject;
});
- $("#mainDisplay").append('<div style="float:left; margin:8px; width:200px; height:180px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
- $("#mainDisplay").append('<div style="float:left; margin:8px; width:200px; height:180px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
- $("#mainDisplay").append('<div style="float:left; margin:8px; width:200px; height:180px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
- $("#mainDisplay").append('<div style="float:left; margin:8px; width:200px; height:180px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
+ //$("#mainDisplay").append('<div style="float:left; margin:8px; width:200px; height:180px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
+ //$("#mainDisplay").append('<div style="float:left; margin:8px; width:200px; height:180px;" class="mapThumbnail">Grayed out Obscured Map Here.</div>').show();
+ viewDepth = 1;
+ $('#dialogBox').html("Choose a level");
}
function formatChallengeThumbnail(map) {
- var r = '<div onclick="displayChallengeMap('+map.ID+')"';
+ var r = '<div id="challengeMapThumb_'+map.ID+'" onclick="displayChallengeMap('+map.ID+')"';
r+= 'style="float:left; margin:8px;width:200px;height:180px;" class="mapThumbnail">';
r+= mapThumbnailHTML(map,200, 160)+'</div>';
return r;
@@ -94,6 +106,7 @@ function displayChallengeMap(challengeMapID) {
});
$("#mainDisplay").append(challengeNextBtn(challengeMapID));
$("#mainDisplay").append(challengePrevBtn(challengeMapID));
+ viewDepth = 2;
}
function challengeNextBtn(challengeMapID) {
@@ -106,6 +119,11 @@ function challengePrevBtn(challengeMapID) {
}
+function back() {
+ if (viewDepth == 2) navShowLevels(viewTier);
+ if (viewDepth == 1) showChallengeTiers();
+}
+
function challengesHTML(response, challengeMapID) {
var json = decryptJSON(response);
@@ -118,8 +136,16 @@ function challengesHTML(response, challengeMapID) {
var cssClass;
$.each(json, function(key, challenge) {
console.log('d', key, challenge);
- if (challenge.dateSolved) cssClass = 'challenge_complete';
- else cssClass = 'challenge_incomplete';
+ if (challenge.dateSolved) {
+ cssClass = 'challenge_complete';
+ } else {
+ cssClass = 'challenge_incomplete';
+ }
+ //TODO: for first incomplete challenge
+ //if (challenge.dialogStart) {
+ $('#dialogBox').html(challenge.dialogStart);
+ //}
+
var loadSolutionString = " <a href='javascript:requestChallengeSolution(\""+challengeMapID+"\", \""+challenge.challengeID+"\");'> Load this solution</a>";
r += "<li class='"+cssClass+"' id='challenge_id_"+challenge.challengeID+"'>"
r += getChallengeDisplayString(challenge) + loadSolutionString + "</li>";
@@ -227,20 +253,50 @@ function showNav() {
}
+function showChallengeTiers() {
+ $('#dialogBox').html("Choose a tier to play");
+ var tmp = " <div onclick='navShowLevels(0);' style='float:left; margin:20px; border:20px solid white;padding:40px'>";
+ tmp += " <h2>Easy</h2>";
+ tmp += "</div>";
+ tmp += "<div onclick='navShowLevels(1);' style='float:left; margin:20px; border:20px solid white;padding:40px'>";
+ tmp += " <h2>Normal</h2>";
+ tmp += "</div>";
+ tmp += "<div style='float:left; margin:10px; border:10px solid gray;padding:20px'>";
+ tmp += " Hard";
+ tmp += "</div>";
+
+ $('#mainDisplay').html(tmp);
+}
</script>
+<style>
+
+#dialogBox {
+ width:96%;
+ height:22px;
+ background-color:gray;
+ color:orange;
+ border-radius:10px;
+ padding:4px;
+ font-size:13pt;
+ margin-bottom:10px;
+}
+
+</style>
+
<div id="challengelist_wrapper" class="wrapper" style='overflow: auto;'>
<h3>Challenges - I'z working on this stuff.</h3>
-<div id='backBtn'><a href='' class='next'>Back Btn</a></div>
+<div id='backBtn' style='float:left;'><a href='javascript:back();' class='next'>Back</a></div>
+<div id='dialogBox'>Greetings tester of test-needed things.</div>
<div id='mainDisplay' style='width:99%;overflow: hidden;'>
- <div onclick='navShowLevels(1);' style='float:left; margin:20px; border:20px solid white;padding:40px'>
+ <div onclick='navShowLevels(0);' style='float:left; margin:20px; border:20px solid white;padding:40px'>
<h2>Easy</h2>
</div>
- <div style='float:left; margin:10px; border:10px solid gray;padding:20px'>
- Normal
+ <div onclick='navShowLevels(1);' style='float:left; margin:20px; border:20px solid white;padding:40px'>
+ <h2>Normal</h2>
</div>
<div style='float:left; margin:10px; border:10px solid gray;padding:20px'>
Hard