summaryrefslogtreecommitdiffstats
path: root/pages/mapeditor.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/mapeditor.php')
-rw-r--r--pages/mapeditor.php42
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.