From 51d99728286212717003009dd5706bb74edcb272 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Wed, 1 May 2013 01:54:08 -0700 Subject: Challengesss Challenges... DB Updates. Challenges --- pages/challengeeditor.php | 20 ++++++++--- pages/challengelist.php | 88 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 88 insertions(+), 20 deletions(-) (limited to 'pages') 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);
Goal:
"inequality"
E.G. greater than, less than, equal:
hint +
dialogStart +
dialogFail +
dialogSuccess
Order:
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('
Grayed out Obscured Map Here.
').show(); - $("#mainDisplay").append('
Grayed out Obscured Map Here.
').show(); - $("#mainDisplay").append('
Grayed out Obscured Map Here.
').show(); - $("#mainDisplay").append('
Grayed out Obscured Map Here.
').show(); + //$("#mainDisplay").append('
Grayed out Obscured Map Here.
').show(); + //$("#mainDisplay").append('
Grayed out Obscured Map Here.
').show(); + viewDepth = 1; + $('#dialogBox').html("Choose a level"); } function formatChallengeThumbnail(map) { - var r = '
'; 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 = " Load this solution"; r += "
  • " r += getChallengeDisplayString(challenge) + loadSolutionString + "
  • "; @@ -227,20 +253,50 @@ function showNav() { } +function showChallengeTiers() { + $('#dialogBox').html("Choose a tier to play"); + var tmp = "
    "; + tmp += "

    Easy

    "; + tmp += "
    "; + tmp += "
    "; + tmp += "

    Normal

    "; + tmp += "
    "; + tmp += "
    "; + tmp += " Hard"; + tmp += "
    "; + + $('#mainDisplay').html(tmp); +} + +

    Challenges - I'z working on this stuff.

    - + +
    Greetings tester of test-needed things.
    -
    +

    Easy

    -
    - Normal +
    +

    Normal

    Hard -- cgit v1.2.3