From 45009ddd7cb311b1a2b87aec7601f91e81f073e0 Mon Sep 17 00:00:00 2001 From: oc Date: Wed, 21 Nov 2018 23:21:26 +0800 Subject: [PATCH] bgmap --- libs/maps.js | 22 +++++++++++++--------- libs/ui.js | 18 ++++++++++++++---- 更新说明.txt | 19 ++++++++++++++++++- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/libs/maps.js b/libs/maps.js index 071f9dad..20d50ef3 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -409,18 +409,12 @@ maps.prototype.drawBgFgMap = function (floorId, canvas, name) { var width = core.floors[floorId].width || 13; var height = core.floors[floorId].height || 13; - var groundId = (core.status.maps||core.floors)[floorId].defaultGround || "ground"; - var blockIcon = core.material.icons.terrains[groundId]; - var blockImage = core.material.images.terrains; - if (!core.isset(core.status[name+"maps"])) core.status[name+"maps"] = {}; var arr = this.getBgFgMapArray(floorId, name); for (var x = 0; x < width; x++) { for (var y = 0; y < height; y++) { - if (name=='bg') - canvas.drawImage(blockImage, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32); if (arr[y][x]>0) { var block = core.maps.initBlock(x, y, arr[y][x]); if (core.isset(block.event)) { @@ -454,9 +448,16 @@ maps.prototype.drawMap = function (mapName, callback) { core.removeGlobalAnimate(null, null, true); var drawBg = function(){ + var width = core.floors[mapName].width || 13; + var height = core.floors[mapName].height || 13; - core.maps.drawBgFgMap(mapName, core.canvas.bg, "bg"); - core.maps.drawBgFgMap(mapName, core.canvas.fg, "fg"); + var groundId = (core.status.maps||core.floors)[mapName].defaultGround || "ground"; + var blockIcon = core.material.icons.terrains[groundId]; + for (var x = 0; x < width; x++) { + for (var y = 0; y < height; y++) { + core.canvas.bg.drawImage(core.material.images.terrains, 0, blockIcon * 32, 32, 32, x * 32, y * 32, 32, 32); + } + } var images = []; if (core.isset(core.status.maps[mapName].images)) { @@ -497,7 +498,10 @@ maps.prototype.drawMap = function (mapName, callback) { 32*dx, 32*dy + image.height - 32, image.width, 32); } } - }) + }); + + core.maps.drawBgFgMap(mapName, core.canvas.bg, "bg"); + core.maps.drawBgFgMap(mapName, core.canvas.fg, "fg"); } if (main.mode=='editor'){ diff --git a/libs/ui.js b/libs/ui.js index 135c1841..befe8172 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2075,8 +2075,13 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, cente tempCanvas.canvas.height = tempHeight; tempCanvas.clearRect(0, 0, tempWidth, tempHeight); - // background map - core.maps.drawBgFgMap(floorId, tempCanvas, "bg"); + var groundId = (core.status.maps||core.floors)[floorId].defaultGround || "ground"; + var blockIcon = core.material.icons.terrains[groundId]; + for (var i = 0; i < mw; i++) { + for (var j = 0; j < mh; j++) { + tempCanvas.drawImage(core.material.images.terrains, 0, blockIcon * 32, 32, 32, i * 32, j * 32, 32, 32); + } + } // background image var images = []; @@ -2100,6 +2105,10 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, cente 32 * dx, 32 * dy + image.height - 32, image.width, 32); } }) + + // background map + core.maps.drawBgFgMap(floorId, tempCanvas, "bg"); + // draw block var mapArray = core.maps.getMapArray(blocks,mw,mh); for (var b in blocks) { @@ -2135,8 +2144,6 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, cente var height = core.material.images.images[heroIcon].height/4; tempCanvas.drawImage(core.material.images.images[heroIcon], icon.stop * 32, icon.loc * height, 32, height, 32*heroLoc.x, 32*heroLoc.y+32-height, 32, height); } - // foreground map - core.maps.drawBgFgMap(floorId, tempCanvas, "fg"); // draw fg images.forEach(function (t) { @@ -2153,6 +2160,9 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, cente } }) + // foreground map + core.maps.drawBgFgMap(floorId, tempCanvas, "fg"); + // draw damage if (core.status.event.id=='viewMaps' && (core.status.event.data||{}).damage) core.control.updateDamage(floorId, tempCanvas); diff --git a/更新说明.txt b/更新说明.txt index 806a3184..dd2273f8 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -1,4 +1,21 @@ -HTML5魔塔样板V2.5 +HTML5魔塔样板V2.5.1 + +新增事件type:insert,可以插入另一个地点的事件执行(公共事件) +可以使用\v来控制剧情文本部分文字的颜色 +新增事件type:switch,多重分歧 +绘制前景/背景层时淡化其他图层 +追加素材的自动调整(如白底、不规范的素材) +浏览地图时:左上角/V开启显伤;右上角/Z查看当前层大地图 +允许在受到领域夹击等伤害后禁用快捷商店 +升级的扣除模式,即不显示经验值,只显示升级的所需剩余值 +装备增加可装备条件判定 +未开启状态的快捷商店用灰色显示 +修复不能在背景/前景层绘图的Bug +部分其他细节优化 + +----------------------------------------------------------------------- + +HTML5魔塔样板V2.5 添加绘图模式支持;可以用户手动绘图和保存 内置主动技能:二倍斩的支持,可以仿照制作其他主动技能