From e927c9ea9ce6e968797cd46332d9cee8016de362 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Thu, 27 Sep 2018 14:41:59 +0800 Subject: [PATCH] Number 17: Airwall --- _server/blockly/MotaAction.g4 | 16 ++++++++-------- libs/maps.js | 13 ++++++++++--- libs/ui.js | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index 48850a17..d6e6efbe 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -802,7 +802,7 @@ return code; */; viberate_s - : '画面震动' '时间' Int '异步' Bool Newline + : '画面震动' '时间' Int '不等待执行完毕' Bool Newline /* viberate_s @@ -817,7 +817,7 @@ return code; */; animate_s - : '显示动画' IdString '位置' EvalString? '异步' Bool Newline + : '显示动画' IdString '位置' EvalString? '不等待执行完毕' Bool Newline /* animate_s @@ -867,7 +867,7 @@ return code; */; animateImage_0_s - : '图片淡入' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int '异步' Bool Newline + : '图片淡入' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int '不等待执行完毕' Bool Newline /* animateImage_0_s @@ -881,7 +881,7 @@ return code; */; animateImage_1_s - : '图片淡出' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int '异步' Bool Newline + : '图片淡出' EvalString '起点像素位置' 'x' PosString 'y' PosString '动画时间' Int '不等待执行完毕' Bool Newline /* animateImage_1_s @@ -921,7 +921,7 @@ return code; moveImage_0_s : '图片移动' EvalString '起点像素位置' 'x' PosString 'y' PosString BGNL - '终点像素位置' 'x' PosString 'y' PosString '移动时间' Int '异步' Bool Newline + '终点像素位置' 'x' PosString 'y' PosString '移动时间' Int '不等待执行完毕' Bool Newline /* moveImage_0_s @@ -935,7 +935,7 @@ return code; */; setFg_0_s - : '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? '异步' Bool Newline + : '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? '不等待执行完毕' Bool Newline /* setFg_0_s @@ -959,7 +959,7 @@ return code; */; setFg_1_s - : '恢复画面色调' '动画时间' Int? '异步' Bool Newline + : '恢复画面色调' '动画时间' Int? '不等待执行完毕' Bool Newline /* setFg_1_s @@ -1110,7 +1110,7 @@ return code; */; setVolume_s - : '设置音量' Int '渐变时间' Int? '异步' Bool Newline + : '设置音量' Int '渐变时间' Int? '不等待执行完毕' Bool Newline /* setVolume_s diff --git a/libs/maps.js b/libs/maps.js index 71e9cd30..c40f254c 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -59,7 +59,10 @@ maps.prototype.initBlock = function (x, y, id) { var tmp = {'x': x, 'y': y, 'id': id}; if (disable!=null) tmp.disable = disable; - if (id in this.blocksInfo) tmp.event = JSON.parse(JSON.stringify(this.blocksInfo[id])); + if (id==17) { + tmp.event = {"cls": "terrains", "id": "airwall", "noPass": true}; + } + else if (id in this.blocksInfo) tmp.event = JSON.parse(JSON.stringify(this.blocksInfo[id])); else { var tilesetOffset = core.icons.getTilesetOffset(id); if (tilesetOffset != null) { @@ -338,9 +341,13 @@ maps.prototype.canMoveDirectly = function (destX,destY) { } maps.prototype.drawBlock = function (block, animate, dx, dy) { + // none:空地;17:空气墙 + if (block.event.id=='none' || block.id==17) return; + var cls = block.event.cls, height = block.event.height || 32; var image, x, y; + if (cls == 'tileset') { var offset = core.icons.getTilesetOffset(block.event.id); if (offset == null) return; @@ -393,7 +400,7 @@ maps.prototype.drawBgFgMap = function (floorId, canvas, name) { 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) { + if (arr[y][x]>0 && arr[y][x]!=17) { var block = core.maps.initBlock(x, y, arr[y][x]); if (core.isset(block.event)) { var id = block.event.id, cls = block.event.cls; @@ -492,7 +499,7 @@ maps.prototype.drawMap = function (mapName, callback) { if (block.event.cls == 'autotile') { core.drawAutotile(core.canvas.event, mapArray, block, 32, 0, 0); } - else if (block.event.id!='none') { + else { core.drawBlock(block); core.addGlobalAnimate(block); } diff --git a/libs/ui.js b/libs/ui.js index afa4fb39..d728c1a1 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2057,7 +2057,7 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, cente } } else { - if (block.event.id!='none') { + if (block.event.id!='none' && block.id!=17) { var blockIcon = core.material.icons[block.event.cls][block.event.id]; var blockImage = core.material.images[block.event.cls]; var height = block.event.height || 32;