diff options
author | BlueRaja <BlueRaja.admin@gmail.com> | 2013-03-07 05:05:28 -0600 |
---|---|---|
committer | BlueRaja <BlueRaja.admin@gmail.com> | 2013-03-07 05:05:28 -0600 |
commit | 81e9645b8b036d9040bd1d02617b029b294809de (patch) | |
tree | 1ac415d112b11a8de8a11fbc5ea16691ef368dd4 /pages/mapeditor.php | |
parent | c62d777cd17e72dd7068547d2e8aa47354387f1e (diff) | |
parent | ecb87bd22022a140df7e0d1843494ff065d55c1c (diff) | |
download | pathery-81e9645b8b036d9040bd1d02617b029b294809de.tar.xz |
Merge branch 'master' of git.raylu.net:pathery
Diffstat (limited to 'pages/mapeditor.php')
-rw-r--r-- | pages/mapeditor.php | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/pages/mapeditor.php b/pages/mapeditor.php index 87fef32..0d6cf94 100644 --- a/pages/mapeditor.php +++ b/pages/mapeditor.php @@ -51,13 +51,28 @@ testMap.name = 'Testmap'; testMap.walls = 5; setTimeout("reloadMap();", 500); +setTimeout("start();", 500); function start() { - $('#testMapDisplay').html(mapAsHTML(testMap)); + //$('#testMapDisplay').html(mapAsHTML(testMap)); + + $(window).mousedown(function(){ + mouseIsDown = true; + + }); + + $(window).mouseup(function(){ + mouseIsDown = false; + }); + } +var mouseIsDown = false; -var grid_clickOverride = true; -function mapClick(obj) { +var mapHasChanged = false; +function mapEditOver(obj) { + if (mouseIsDown == true) mapEditClick(obj); +} +function mapEditClick(obj) { console.log("Map Click"); tmp = obj.id.split(','); @@ -69,9 +84,19 @@ function mapClick(obj) { testMap.tiles[y][x] = Array(palleteType, palleteValue); y++; $(obj).attr('class', 'mapcell '+palleteType+palleteValue); - loadPlayableMap(); + mapHasChanged = true; +} + +getMapTimer(); +function getMapTimer() { + setTimeout("getMapTimer()", 3000); + if (mapHasChanged) { + loadPlayableMap(); + mapHasChanged = false; + } } + var palleteType = 's'; var palleteValue = ''; function paletteSelect(type, value) { @@ -120,8 +145,12 @@ function reloadMap() { loadPlayableMap(); } +var isLoadingMap = false; function loadPlayableMap() { + if (isLoadingMap == true) return; + isLoadingMap = true; + var URLString = 'mapeditor?mapByMap='+JSON.stringify(testMap); $.ajax({ type: "GET", @@ -135,6 +164,7 @@ function loadPlayableMap() { playableMap.ID = -1; $('#playableMapDisplay').html(mapAsHTML(playableMap, 960)); $('#playableMapCodeDisplay').val(playableMap.code); + isLoadingMap = false; } }); } @@ -268,10 +298,10 @@ function constructTiles(width, height, baseMap) { </div></form> <div style='clear:both;'></div> - <div class="divide"></div> + <div class="divide"><strong>Playable Map</strong></div> <div style='clear:both;'></div> <div class='wrapper'> - <input id='playableMapCodeDisplay' size="100" type="text" value="" class="forminput"/> + MapCode: <input id='playableMapCodeDisplay' size="100" type="text" value="" class="forminput"/> </div> <div id='playableMapDisplay' style='float:left;'> Returned map goes here. |