From b71442b0997a65a56808ff722369f2adaa608343 Mon Sep 17 00:00:00 2001 From: oc Date: Thu, 17 May 2018 23:37:52 +0800 Subject: [PATCH] drawmap --- libs/events.js | 42 +++++++++++++++++++----------------------- libs/maps.js | 11 +++++------ project/items.js | 14 +++++++------- 更新说明.txt | 2 ++ 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/libs/events.js b/libs/events.js index 0027129c..a0018f7b 100644 --- a/libs/events.js +++ b/libs/events.js @@ -407,8 +407,6 @@ events.prototype.doAction = function() { } if (floorId==core.status.floorId) { core.drawMap(floorId); - core.drawHero(); - core.updateStatusBar(); } } this.doAction(); @@ -1094,29 +1092,27 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback }) } core.drawMap(floorId, function () { - setTimeout(function() { - if (core.isset(heroLoc.direction)) - core.setHeroLoc('direction', heroLoc.direction); - core.setHeroLoc('x', heroLoc.x); - core.setHeroLoc('y', heroLoc.y); - core.drawHero(); - core.updateStatusBar(); + if (core.isset(heroLoc.direction)) + core.setHeroLoc('direction', heroLoc.direction); + core.setHeroLoc('x', heroLoc.x); + core.setHeroLoc('y', heroLoc.y); + core.clearMap('hero', 0, 0, 416, 416); + core.drawHero(); - var changed = function () { - core.unLockControl(); - core.status.replay.animate=false; - core.events.afterChangeFloor(floorId); - if (core.isset(callback)) callback(); - } - if (displayAnimate) { - core.hide(core.dom.floorMsgGroup, time/4, function () { - changed(); - }); - } - else { + var changed = function () { + core.unLockControl(); + core.status.replay.animate=false; + core.events.afterChangeFloor(floorId); + if (core.isset(callback)) callback(); + } + if (displayAnimate) { + core.hide(core.dom.floorMsgGroup, time/4, function () { changed(); - } - }, 25) + }); + } + else { + changed(); + } }); } core.playSound('floor.mp3'); diff --git a/libs/maps.js b/libs/maps.js index 39a0e306..00ca6627 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -389,8 +389,10 @@ maps.prototype.drawMap = function (mapName, callback) { } } else { drawEvent(); + core.setGlobalAnimate(core.values.animateSpeed); + core.drawHero(); + core.updateStatusBar(); } - core.setGlobalAnimate(core.values.animateSpeed); if (core.isset(callback)) callback(); } @@ -398,7 +400,7 @@ maps.prototype.drawMap = function (mapName, callback) { ////// 绘制Autotile ////// maps.prototype.drawAutotile = function(ctx, mapArr, block, size, left, top){ var indexArrs = [ //16种组合的图块索引数组; // 将autotile分割成48块16*16的小块; 数组索引即对应各个小块 - // +----+----+----+----+----+----+ + // +----+----+----+----+----+----+ [10, 9, 4, 3 ], //0 bin:0000 | 1 | 2 | 3 | 4 | 5 | 6 | [10, 9, 4, 13], //1 bin:0001 +----+----+----+----+----+----+ [10, 9, 18, 3 ], //2 bin:0010 | 7 | 8 | 9 | 10 | 11 | 12 | @@ -899,8 +901,5 @@ maps.prototype.drawAnimate = function (name, x, y, callback) { maps.prototype.resetMap = function() { var floorId = core.status.floorId; core.status.maps[floorId] = this.loadFloor(floorId); - this.drawMap(floorId, function() { - core.drawHero(); - core.updateStatusBar(); - }) + this.drawMap(floorId) } \ No newline at end of file diff --git a/project/items.js b/project/items.js index 475f59cb..94a57ff9 100644 --- a/project/items.js +++ b/project/items.js @@ -278,13 +278,13 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "useItemEffect": { "book": "core.ui.drawBook(0);", "fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));", - "earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", - "pickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", - "icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero(), 'stop');\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", - "snow": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", - "bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", - "bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});", - "hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawHero();\n core.updateFg();\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});", + "earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", + "pickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", + "icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", + "snow": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", + "bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", + "bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});", + "hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});", "centerFly": "core.clearMap('hero', 0, 0, 416, 416);\ncore.setHeroLoc('x', core.status.event.data.x);\ncore.setHeroLoc('y', core.status.event.data.y);\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');", "upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});", "downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});", diff --git a/更新说明.txt b/更新说明.txt index db473dce..604ffcee 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -9,7 +9,9 @@ 最大存档个数提到main处理 √ 新建地图可以保留楼层属性 √ 道具描述过长时可以自动换行 √ +除Autotile外均可自动注册 重写大部分教程,新增大量拓展描述 √ +便捷PS工具修复宽大于高时的闪退问题 修复转向触发事件的朝向Bug √ 修复flyRange的顺序问题 √ 部分细节优化 √