From 4c94ce4edb9352b03a4726c5e33b1c9d1d1f7d95 Mon Sep 17 00:00:00 2001 From: YouWei Zhao Date: Wed, 20 May 2020 14:49:05 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E9=80=89=E4=B8=AD=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/editor.js | 7 ++-- _server/editor_mappanel.js | 64 ++++++++++++++++++++++++--------- _server/editor_materialpanel.js | 7 ++-- 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index c2843696..bc64fe95 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -69,6 +69,11 @@ function editor() { mouseOutCheck : 2, startPos:null, endPos:null, + lastMoveE:{buttons:0,clientX:0,clientY:0}, + // 材料区拖动有关 + lastMoveMaterE:null, + tileSize: [1,1], + startLoc: null, // 撤销/恢复 preMapData : [], preMapMax: 10, @@ -104,8 +109,6 @@ function editor() { }, // tile - tileSize: [1,1], - startLoc: null, lockMode: false, // 最近使用的图块 diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js index f2f850ac..a397f535 100644 --- a/_server/editor_mappanel.js +++ b/_server/editor_mappanel.js @@ -75,6 +75,7 @@ editor_mappanel_wrapper = function (editor) { * + 绘图时画个矩形在那个位置 */ editor.uifunctions.map_ondown = function (e) { + editor.uivalues.lastMoveE=e; var loc = editor.uifunctions.eToLoc(e); var pos = editor.uifunctions.locToPos(loc, true); if (editor.uivalues.bindSpecialDoor.loc != null) { @@ -89,10 +90,10 @@ editor_mappanel_wrapper = function (editor) { } return false; } - if (e.button == 2) { - editor.uifunctions.showMidMenu(e.clientX, e.clientY); - return false; - } + // if (e.buttons == 2) { // 挪到onup + // editor.uifunctions.showMidMenu(e.clientX, e.clientY); + // return false; + // } if (!selectBox.isSelected()) { editor_mode.onmode('nextChange'); editor_mode.onmode('loc'); @@ -122,6 +123,7 @@ editor_mappanel_wrapper = function (editor) { * + 绘图模式时找到与队列尾相邻的鼠标方向的点画个矩形 */ editor.uifunctions.map_onmove = function (e) { + editor.uivalues.lastMoveE=e; if (!selectBox.isSelected()) { if (editor.uivalues.startPos == null) return; //tip.whichShow(1); @@ -136,9 +138,25 @@ editor_mappanel_wrapper = function (editor) { editor.uivalues.endPos = pos; if (editor.uivalues.startPos != null) { if (editor.uivalues.startPos.x != editor.uivalues.endPos.x || editor.uivalues.startPos.y != editor.uivalues.endPos.y) { - core.drawArrow('eui', - 32 * editor.uivalues.startPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.startPos.y + 16 - core.bigmap.offsetY, - 32 * editor.uivalues.endPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.endPos.y + 16 - core.bigmap.offsetY); + if (e.buttons == 2) { + // 右键拖拽: 画选的区域 + var x0 = editor.uivalues.startPos.x; + var y0 = editor.uivalues.startPos.y; + var x1 = editor.uivalues.endPos.x; + var y1 = editor.uivalues.endPos.y; + if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap + if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap + // draw rect + editor.dom.euiCtx.clearRect(0, 0, editor.dom.euiCtx.canvas.width, editor.dom.euiCtx.canvas.height); + editor.dom.euiCtx.fillStyle = 'rgba(0, 127, 255, 0.4)'; + editor.dom.euiCtx.fillRect(32 * x0 - core.bigmap.offsetX, 32 * y0 - core.bigmap.offsetY, + 32 * (x1 - x0) + 32, 32 * (y1 - y0) + 32); + }else{ + // 左键拖拽: 画箭头 + core.drawArrow('eui', + 32 * editor.uivalues.startPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.startPos.y + 16 - core.bigmap.offsetY, + 32 * editor.uivalues.endPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.endPos.y + 16 - core.bigmap.offsetY); + } } } // editor_mode.onmode('nextChange'); @@ -192,17 +210,31 @@ editor_mappanel_wrapper = function (editor) { * + 非绘图模式时, 交换首末点的内容 * + 绘图模式时, 根据画线/画矩形/画tileset 做对应的绘制 */ - editor.uifunctions.map_onup = function (e) { + editor.uifunctions.map_onup = function (ee) { + console.log(1) + var e=editor.uivalues.lastMoveE; if (!selectBox.isSelected()) { - //tip.whichShow(1); - // editor.movePos(editor.uivalues.startPos, editor.uivalues.endPos); - if (editor.layerMod == 'map') - editor.exchangePos(editor.uivalues.startPos, editor.uivalues.endPos); - else - editor.exchangeBgFg(editor.uivalues.startPos, editor.uivalues.endPos, editor.layerMod); - editor.uivalues.startPos = editor.uivalues.endPos = null; + if (e.buttons == 2) { + if (editor.uivalues.endPos==null || editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y){ + // 右键点击: 弹菜单 + editor.uifunctions.showMidMenu(e.clientX, e.clientY); + } else { + // 右键拖拽: 选中区域 + printf('已经选中该区域') + // 后续的处理 + } + } else { + // 左键拖拽: 交换 + //tip.whichShow(1); + // editor.movePos(editor.uivalues.startPos, editor.uivalues.endPos); + if (editor.layerMod == 'map') + editor.exchangePos(editor.uivalues.startPos, editor.uivalues.endPos); + else + editor.exchangeBgFg(editor.uivalues.startPos, editor.uivalues.endPos, editor.layerMod); + editor.uifunctions.unhighlightSaveFloorButton(); + } editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); - editor.uifunctions.unhighlightSaveFloorButton(); + editor.uivalues.startPos = editor.uivalues.endPos = null; return false; } editor.uivalues.holdingPath = 0; diff --git a/_server/editor_materialpanel.js b/_server/editor_materialpanel.js index 8a6704fa..d7607b82 100644 --- a/_server/editor_materialpanel.js +++ b/_server/editor_materialpanel.js @@ -62,7 +62,6 @@ editor_materialpanel_wrapper = function (editor) { } } - var lastmoveE=null; /** * editor.dom.iconLib.onmousedown * 素材区的单击/拖拽事件 @@ -70,7 +69,7 @@ editor_materialpanel_wrapper = function (editor) { editor.uifunctions.material_ondown = function (e) { e.stopPropagation(); e.preventDefault(); - lastmoveE=e; + editor.uivalues.lastMoveMaterE=e; if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return; var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; @@ -90,7 +89,7 @@ editor_materialpanel_wrapper = function (editor) { editor.uifunctions.material_onmove = function (e) { e.stopPropagation(); e.preventDefault(); - lastmoveE=e; + editor.uivalues.lastMoveMaterE=e; if (!editor.uivalues.startLoc) return; var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc); @@ -109,7 +108,7 @@ editor_materialpanel_wrapper = function (editor) { var startLoc = editor.uivalues.startLoc; editor.uivalues.startLoc = null; - var e=lastmoveE; + var e=editor.uivalues.lastMoveMaterE; if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return; var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; From 6ab04d71c8351f4506a4cb52c3abb99f8c2efd34 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 22 May 2020 10:43:03 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=8B=87=E5=A3=AB=E5=B8=A7=E5=8A=A8?= =?UTF-8?q?=E7=94=BB;ratio;=E4=BC=98=E5=8C=96=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _docs/event.md | 2 +- _docs/personalization.md | 9 ++-- _server/MotaAction.g4 | 2 +- _server/editor_file.js | 4 +- _server/editor_multi.js | 1 - _server/editor_table.js | 8 ++-- _server/table/comment.js | 72 ++++++++++++++--------------- _server/table/data.comment.js | 87 +++++++++++++++++++---------------- libs/actions.js | 14 +++--- libs/control.js | 15 ++++-- libs/items.js | 5 +- libs/ui.js | 17 +++++-- project/data.js | 1 + project/floors/MT0.js | 2 +- project/floors/sample0.js | 2 +- project/floors/sample1.js | 2 +- project/floors/sample2.js | 2 +- project/floors/sample3.js | 2 +- project/items.js | 74 ++++++++++++++--------------- project/maps.js | 8 ++-- runtime.d.ts | 8 ++-- v2.x-final更新.txt | 3 +- v266-v2.7接档说明.txt | 2 + 23 files changed, 178 insertions(+), 164 deletions(-) diff --git a/_docs/event.md b/_docs/event.md index c27e53b2..03d00562 100644 --- a/_docs/event.md +++ b/_docs/event.md @@ -383,7 +383,7 @@ value为必填项,代表要修改到的内容。对于修改名称的,必须 {"type": "setFloor", "name": "title", "value": "'主塔 0 层'" } // 设置当前楼层的中文名为主塔0层 {"type": "setFloor", "name": "canFlyTo", "floorId": "MT2", "value": "false" } // 设置MT2层不可飞行 {"type": "setFloor", "name": "cannotViewMap", "floorId": "MT0", "value": "true" } // 设置MT0层不可被浏览地图 - {"type": "setFloor", "name": "item_ratio", "value": "5" } // 设置当前楼层的宝石血瓶属性加成为5 + {"type": "setFloor", "name": "ratio", "value": "5" } // 设置当前楼层的宝石血瓶属性加成为5 {"type": "setFloor", "name": "images", "value": "[[0,0,'tree.png',2]]" } // 设置当前楼层的楼层贴图 {"type": "setFloor", "name": "upFloor", "value": "[2,3]" } // 设置当前楼层的上楼梯 {"type": "setFloor", "name": "bgm", "floorId": "MT10", "value": "'233.mp3'" } // 设置当前楼层的背景音乐 diff --git a/_docs/personalization.md b/_docs/personalization.md index 356bb46a..c554b497 100644 --- a/_docs/personalization.md +++ b/_docs/personalization.md @@ -249,21 +249,18 @@ ID必须由数字字母下划线组成,数字在1000以内,且均不能和 如果你想要同种宝石在不同层效果不同的话,可以进行如下操作: -1. 在楼层的item_ratio中定义宝石的比率(比如1-10的写1,11-20层写2等) +1. 在楼层的ratio中定义宝石的比率(比如1-10的写1,11-20层写2等) 2. 修改获得道具的itemEffect函数(编辑器中双击进行编辑) ``` js -// ratio为楼层的item_ratio值,可以进行翻倍宝石属性 -core.status.hero.atk += core.values.redGem * ratio +core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio ``` -这里我们可以直接写ratio来取用该楼层中定义的`item_ratio`的值。 - 如果不是倍数增加(比如线性增加)也可以类似来写 ``` js // 一个二倍线性增加的例子 -core.status.hero.atk += core.values.redGem + 2*ratio +core.status.hero.atk += core.values.redGem + 2*core.status.thisMap.ratio ``` ### 消耗类道具(cls: tools);永久类道具(cls: constants) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index b117d948..4e88d5d6 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -3038,7 +3038,7 @@ Event_List Floor_Meta_List : '楼层中文名'|'状态栏名称'|'能否使用楼传'|'能否打开快捷商店'|'是否不可浏览地图'|'是否不可瞬间移动'|'默认地面ID'|'楼层贴图'|'宝石血瓶效果'|'上楼点坐标'|'下楼点坐标'|'背景音乐'|'画面色调'|'天气和强度'|'是否地下层' - /*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'cannotMoveDirectly', 'defaultGround', 'images', 'item_ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/; + /*Floor_Meta_List ['title','name','canFlyTo', 'canUseQuickShop', 'cannotViewMap', 'cannotMoveDirectly', 'defaultGround', 'images', 'ratio', 'upFloor', 'downFloor', 'bgm', 'color', 'weather', 'underGround']*/; Global_Attribute_List : '全局字体'|'横屏左侧状态栏背景'|'竖屏上方状态栏背景'|'竖屏下方道具栏背景'|'边框颜色'|'状态栏文字色'|'楼层转换背景'|'楼层转换文字色'|'装备列表' diff --git a/_server/editor_file.js b/_server/editor_file.js index 4229701e..13a6988b 100644 --- a/_server/editor_file.js +++ b/_server/editor_file.js @@ -212,7 +212,7 @@ editor_file = function (editor, callback) { canUseQuickShop: currData.canUseQuickShop, cannotViewMap: currData.cannotViewMap, cannotMoveDirectly: currData.cannotMoveDirectly, - item_ratio: currData.item_ratio, + ratio: currData.ratio, defaultGround: currData.defaultGround, bgm: currData.bgm, color: currData.color, @@ -260,7 +260,7 @@ editor_file = function (editor, callback) { canUseQuickShop: currData.canUseQuickShop, cannotViewMap: currData.cannotViewMap, cannotMoveDirectly: currData.cannotMoveDirectly, - item_ratio: currData.item_ratio, + ratio: currData.ratio, defaultGround: currData.defaultGround, bgm: currData.bgm, color: currData.color, diff --git a/_server/editor_multi.js b/_server/editor_multi.js index b694bf51..f0234d9a 100644 --- a/_server/editor_multi.js +++ b/_server/editor_multi.js @@ -99,7 +99,6 @@ editor_multi = function () { editor_multi.isString = false; editor_multi.lintAutocomplete = false; if (args.lint === true) editor_multi.lintAutocomplete = true; - if (field.indexOf('Effect') !== -1) editor_multi.lintAutocomplete = true; if ((!input.value || input.value == 'null') && editor_mode.mode == 'plugins') input.value = '"function () {\\n\\t// 在此增加新插件\\n\\t\\n}"'; if (input.value.slice(0, 1) === '"' || args.string) { diff --git a/_server/editor_table.js b/_server/editor_table.js index 1e2e9e93..0da79ddf 100644 --- a/_server/editor_table.js +++ b/_server/editor_table.js @@ -23,8 +23,8 @@ editor_table_wrapper = function (editor) { editor_table.prototype.checkbox = function (value) { return /* html */`\n` } - editor_table.prototype.textarea = function (value, indent) { - return /* html */`\n` + editor_table.prototype.textarea = function (value, indent, disable) { + return /* html */`\n` } editor_table.prototype.checkboxSet = function (value, keys, prefixStrings) { if (value == null) value = []; @@ -76,7 +76,7 @@ editor_table_wrapper = function (editor) { ${shortField} ${shortComment || commentHTMLescape}
${tdstr}
- ${editor.table.editGrid(shortComment, type != 'select' && type != 'checkbox' && type != 'checkboxSet')} + ${editor.table.editGrid(shortComment, type != 'select' && type != 'checkbox' && type != 'checkboxSet' && type != 'disable')} \n` } @@ -283,7 +283,7 @@ editor_table_wrapper = function (editor) { case 'checkboxSet': return editor.table.checkboxSet(thiseval, cobj._checkboxSet.key, cobj._checkboxSet.prefix); default: - return editor.table.textarea(thiseval, cobj.indent || 0); + return editor.table.textarea(thiseval, cobj.indent || 0, cobj._type == 'disable'); } } diff --git a/_server/table/comment.js b/_server/table/comment.js index bdf74943..58c89856 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -26,7 +26,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { ] }, "_docs": "道具类别", - "_data": "只能取items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)" + "_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)" }, "name": { "_leaf": true, @@ -44,8 +44,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "hideInToolbox": { "_leaf": true, "_type": "checkbox", - "_docs": "道具栏中隐藏", - "_data": "是否不显示在道具栏中" + "_docs": "不显示在道具栏", }, "equip": { "_leaf": true, @@ -57,7 +56,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "checkbox", "_docs": "回放不绘制道具栏", - "_data": "是否回放时不绘制道具栏。\n如果此项为true,则在回放录像时使用本道具将不会绘制道具栏页面,而是直接使用。\n此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)" + "_data": "此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)" } } }, @@ -73,7 +72,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "textarea", "_string": true, - "_lint": true, "_docs": "即捡即用提示", "_data": "即捡即用类物品在获得时提示的文字,仅对cls为items有效。" }, @@ -82,7 +80,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "event", "_event": "item", "_docs": "碰触或使用事件", - "_data": "碰触或使用本道具所执行的事件" + "_data": "碰触或使用本道具所执行的事件,对所有cls有效" }, "useItemEffect": { "_leaf": true, @@ -97,7 +95,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "textarea", "_string": true, "_lint": true, - "_docs": "能否使用条件", + "_docs": "能否使用", "_data": "当前能否使用该道具,仅对cls为tools或constants有效。" }, "equipCondition": { @@ -105,7 +103,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "textarea", "_string": true, "_lint": true, - "_docs": "能否装备条件", + "_docs": "能否装备", "_data": "能装备某个装备的条件,仅对cls为equips有效。\n与canUseItemEffect不同,这里null代表可以装备。" } } @@ -128,7 +126,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "textarea", "_string": true, "_docs": "手册映射ID", - "_data": "在怪物手册中映射到的怪物ID。如果此项不为null,则在怪物手册中,将用目标ID来替换该怪物原本的ID。\n此项应被运用在同一个怪物的多朝向上。\n例如,如果想定义同一个怪物的向下和向左的行走图,则需要建立两个属性完全相同的怪物。\n但是这样会导致在怪物手册中同时存在向下和向左的两种怪物的显示。\n可以将朝向左的怪物的displayIdInBook项指定为朝向下的怪物ID,这样在怪物手册中则会归一化,只显示一个。" + "_data": "在怪物手册中映射到的怪物ID。如果此项不为null,则在怪物手册中,将用目标ID来替换该怪物原本的ID。常被运用在同一个怪物的多朝向上。" }, "hp": { "_leaf": true, @@ -182,7 +180,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "value": { "_leaf": true, "_type": "textarea", - "_docs": "特殊属性值", + "_docs": "特殊属性数值", "_data": "特殊属性的数值\n如:领域/阻激/激光怪的伤害值;吸血怪的吸血比例;光环怪增加生命的比例" }, "zoneSquare": { @@ -201,7 +199,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "notBomb": { "_leaf": true, "_type": "checkbox", - "_docs": "是否不可炸", + "_docs": "不可炸", "_data": "该怪物不可被炸" }, "n": { @@ -214,21 +212,21 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "add": { "_leaf": true, "_type": "checkbox", - "_docs": "吸血加自身", + "_docs": "吸血加到自身", "_data": "吸血后是否加到自身;光环是否叠加" }, "atkValue": { "_leaf": true, "_type": "textarea", "_range": "thiseval==~~thiseval||thiseval==null", - "_docs": "退化扣攻击", + "_docs": "退化扣除攻击", "_data": "退化时勇士下降的攻击力点数;光环怪增加攻击的比例" }, "defValue": { "_leaf": true, "_type": "textarea", "_range": "thiseval==~~thiseval||thiseval==null", - "_docs": "退化扣防御", + "_docs": "退化扣除防御", "_data": "退化时勇士下降的防御力点数;光环怪增加防御的比例" }, "damage": { @@ -249,20 +247,20 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_data": { "id": { "_leaf": true, - "_type": "textarea", + "_type": "disable", "_range": "false", "_docs": "图块ID", "_data": "图块唯一ID,可在页面底部修改" }, "idnum": { "_leaf": true, - "_type": "textarea", + "_type": "disable", "_range": "false", "_data": "图块数字" }, "cls": { "_leaf": true, - "_type": "textarea", + "_type": "disable", "_range": "false", "_data": "图块类别" }, @@ -291,7 +289,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "checkbox", "_docs": "可通行性", - "_data": "该图块是否可以通行;true代表可以通行,false代表不可通行" }, "script": { "_leaf": true, @@ -309,7 +306,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "key":["up","down","left","right"] }, "_docs": "不可出方向", - "_data": "该图块的不可出方向\n可以在这里定义在该图块时不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表在该图块时不能往上和左走\n此值对背景层、事件层、前景层上的图块均有效" + "_data": "该图块的不可出方向\n对背景层、事件层、前景层上的图块均有效" }, "cannotIn": { "_leaf": true, @@ -319,7 +316,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "key":["up","down","left","right"] }, "_docs": "不可入方向", - "_data": "该图块的不可入方向\n可以在这里定义不能朝哪个方向进入该图块,可以达到悬崖之类的效果\n例如 [\"down\"] 代表不能从该图块的上方点朝向下进入此图块\n此值对背景层、事件层、前景层上的图块均有效" + "_data": "该图块的不可入方向\n对背景层、事件层、前景层上的图块均有效" }, "canBreak": { "_leaf": true, @@ -329,24 +326,26 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { }, "animate": { "_leaf": true, - "_type": "textarea", - "_range": "thiseval==~~thiseval||thiseval==null", + "_type": "select", + "_select": { + "values": [1,2,3,4], + }, "_docs": "动画帧数", - "_data": "该图块的全局动画帧数。\n如果此项为null,则对于除了npc48外,使用素材默认帧数;npc48默认是1帧(即静止)。" + "_data": "null代表素材默认帧数" }, "doorInfo": { "_leaf": true, "_type": "event", "_event": "doorInfo", "_docs": "门信息", - "_data": "该图块的门信息,是一个四元数组。\n第一项为所需要的钥匙信息,第二项为开关门的毫秒数,第三项为开此门时的音效,第四项为关此门时的音效。仅对animates生效。" + "_data": "该图块的门信息,仅对animates和npc48生效。" }, "faceIds": { "_leaf": true, "_type": "event", "_event": "faceIds", "_docs": "行走图朝向", - "_data": "行走图朝向,仅对NPC有效。可以在这里定义同一个NPC的多个朝向行走图。\n比如 {\"up\":\"N333\",\"down\":\"N334\",\"left\":\"N335\",\"right\":\"N336\"} 就将该素材的上下左右朝向分别绑定到N333,N334,N335和N336四个图块。\n在勇士撞上NPC时,或NPC在移动时,会自动选择最合适的朝向图块(如果存在定义)来进行绘制。" + "_data": "行走图朝向,仅对npc48有效。在勇士撞上NPC时,或NPC在移动时,会自动选择最合适的朝向图块(如果存在定义)来进行绘制。" } } }, @@ -361,15 +360,15 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_data": { "floorId": { "_leaf": true, - "_type": "textarea", + "_type": "disable", "_range": "false", "_docs": "楼层ID", - "_data": "文件名和floorId需要保持完全一致,可在页面底部修改 \n楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 \n推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等" + "_data": "文件名和floorId需要保持完全一致,可在页面底部修改" }, "title": { "_leaf": true, "_type": "textarea", - "_docs": "楼层中文名", + "_docs": "楼层名", "_data": "楼层中文名,将在切换楼层和浏览地图时显示" }, "name": { @@ -380,17 +379,17 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { }, "width": { "_leaf": true, - "_type": "textarea", + "_type": "disable", "_range": "false", "_docs": "宽度", - "_data": "地图x方向大小,请在表格最下方修改,null视为13" + "_data": "地图x方向大小,请在表格最下方修改" }, "height": { "_leaf": true, - "_type": "textarea", + "_type": "disable", "_range": "false", "_docs": "高度", - "_data": "地图y方向大小,请在表格最下方修改,null视为13" + "_data": "地图y方向大小,请在表格最下方修改" }, "canFlyTo": { "_leaf": true, @@ -462,8 +461,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "event", "_event": "floorImage", - "_docs": "楼层贴图", - "_data": "背景/前景图;你可以选择若干张图片来作为背景/前景素材。详细用法请参见文档“自定义素材”中的说明。" + "_docs": "楼层贴图" }, "color": { "_leaf": true, @@ -484,9 +482,9 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "values": [null].concat(Object.keys(editor.core.material.bgms)) }, "_docs": "背景音乐", - "_data": "到达该层后默认播放的BGM。本项可忽略,或者为一个定义过的背景音乐如\"bgm.mp3\"。" + "_data": "到达该层后默认播放的BGM" }, - "item_ratio": { + "ratio": { "_leaf": true, "_type": "textarea", "_range": "(thiseval==~~thiseval && thiseval>=0)||thiseval==null", @@ -583,7 +581,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "cannotViewMap": false, "cannotMoveDirectly": false, "images": [], - "item_ratio": 1, + "ratio": 1, "defaultGround": "ground", "bgm": null, "upFloor": null, diff --git a/_server/table/data.comment.js b/_server/table/data.comment.js index 7b168af0..54b45d53 100644 --- a/_server/table/data.comment.js +++ b/_server/table/data.comment.js @@ -27,7 +27,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { return one; return null; }).toString(), - "_docs": "本塔使用图片", + "_docs": "使用图片", "_data": "在此存放所有可能使用的图片(tilesets除外) \n图片可以被作为背景图(的一部分),也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加", }, "tilesets": { @@ -50,7 +50,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { return j >= 0 ? 1 : -1; }); }).toString(), - "_docs": "本塔额外素材", + "_docs": "额外素材", "_data": "在此存放额外素材的图片名, \n可以自定导入任意张素材图片,无需PS,无需注册,即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数,且图片上的总图块数不超过1000(即最多有1000个32*32的图块在该图片上)" }, "animates": { @@ -62,7 +62,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { if (one.endsWith(".animate")) return one.substring(0, one.lastIndexOf('.')); return null; }).toString(), - "_docs": "本塔使用动画", + "_docs": "使用动画", "_data": "在此存放所有可能使用的动画,必须是animate格式,在这里不写后缀名 \n动画必须放在animates目录下;文件名不能使用中文,不能带空格或特殊字符 \n \"jianji\", \"thunder\" 根据需求自行添加" }, "bgms": { @@ -75,7 +75,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { return one; return null; }).toString(), - "_docs": "本塔使用音乐", + "_docs": "使用音乐", "_data": "在此存放所有的bgm,和文件名一致。 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好" }, "sounds": { @@ -88,7 +88,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { return one; return null; }).toString(), - "_docs": "本塔使用音效", + "_docs": "使用音效", "_data": "在此存放所有的SE,和文件名一致 \n音频名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好" }, "fonts": { @@ -100,13 +100,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { if (one.endsWith(".ttf")) return one.substring(0, one.lastIndexOf('.')); return null; }).toString(), - "_docs": "本塔使用字体", + "_docs": "使用字体", "_data": "在此存放所有可能使用的字体 \n 字体名不能使用中文,不能带空格或特殊字符" }, "nameMap": { "_leaf": true, "_type": "textarea", - "_docs": "文件名映射", + "_docs": "文件映射", "_data": "文件名映射,目前仅对images, animates, bgms, sounds有效。\n例如定义 {\"精灵石.mp3\":\"jinglingshi.mp3\"} 就可以使用\ncore.playBgm(\"精灵石.mp3\") 或对应的事件来播放该bgm。" }, "startBackground": { @@ -157,21 +157,21 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "textarea", "_string": true, - "_docs": "横屏状态栏", + "_docs": "横状态栏", "_data": "横屏时左侧状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图,推荐写法:\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。" }, "statusTopBackground": { "_leaf": true, "_type": "textarea", "_string": true, - "_docs": "竖屏状态栏", + "_docs": "竖状态栏", "_data": "竖屏时上方状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图,推荐写法:\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。" }, "toolsBackground": { "_leaf": true, "_type": "textarea", "_string": true, - "_docs": "竖屏工具栏", + "_docs": "竖工具栏", "_data": "竖屏时下方工具栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图,推荐写法:\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。" }, "borderColor": { @@ -192,14 +192,14 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "textarea", "_string": true, - "_docs": "转场背景色", + "_docs": "转场背景", "_data": "楼层转换界面的背景样式;可以使用纯色(默认值black),也可以使用图片(参见状态栏的图片写法)" }, "floorChangingTextColor": { "_leaf": true, "_type": "textarea", "_string": true, - "_docs": "转场文字色", + "_docs": "转场文字", "_data": "楼层转换界面的文字颜色,默认是白色" }, "font": { @@ -257,7 +257,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { return name.endsWith('.png'); })) }, - "_data": "勇士行走图" + "_data": "行走图" + }, + "animate": { + "_leaf": true, + "_type": "checkbox", + "_docs": "帧动画", + "_data": "是否开启停止状态和对话框的帧动画" }, "name": { "_leaf": true, @@ -344,7 +350,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "textarea", "_range": "thiseval instanceof Object && !(thiseval instanceof Array)", - "_docs": "初始装备个数", + "_docs": "初始拥有装备个数", "_data": "初始装备个数,例如初始送铁剑可以写 {\"sword1\": 1}" } } @@ -385,13 +391,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { }, "followers": { "_leaf": true, - "_type": "textarea", - "_range": "thiseval instanceof Array", - "_data": "跟随者列表" + "_type": "disable", + "_data": "跟随者" }, "steps": { "_leaf": true, - "_type": "textarea", + "_type": "disable", "_data": "行走步数" } } @@ -401,7 +406,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "event", "_event": "firstArrive", "_range": "thiseval==null || thiseval instanceof Array", - "_docs": "标题事件化", + "_docs": "标题事件", "_data": "标题界面事件化,可以使用事件流的形式来绘制开始界面等。\n需要开启startUsingCanvas这个开关。\n详见文档-个性化-标题界面事件化。" }, "startText": { @@ -452,43 +457,43 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "redGem": { "_leaf": true, "_type": "textarea", - "_docs": "红宝石效果", + "_docs": "红宝石值", "_data": "红宝石加攻击的数值" }, "blueGem": { "_leaf": true, "_type": "textarea", - "_docs": "蓝宝石效果", + "_docs": "蓝宝石值", "_data": "蓝宝石加防御的数值" }, "greenGem": { "_leaf": true, "_type": "textarea", - "_docs": "绿宝石效果", + "_docs": "绿宝石值", "_data": "绿宝石加护盾的数值" }, "redPotion": { "_leaf": true, "_type": "textarea", - "_docs": "红血瓶效果", + "_docs": "红血瓶值", "_data": "红血瓶加血数值" }, "bluePotion": { "_leaf": true, "_type": "textarea", - "_docs": "蓝血瓶效果", + "_docs": "蓝血瓶值", "_data": "蓝血瓶加血数值" }, "yellowPotion": { "_leaf": true, "_type": "textarea", - "_docs": "黄血瓶效果", + "_docs": "黄血瓶值", "_data": "黄血瓶加血数值" }, "greenPotion": { "_leaf": true, "_type": "textarea", - "_docs": "绿血瓶效果", + "_docs": "绿血瓶值", "_data": "绿血瓶加血数值" }, "breakArmor": { @@ -518,14 +523,16 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "animateSpeed": { "_leaf": true, "_type": "textarea", - "_docs": "全局动画时间", - "_data": "全局动画时间,即怪物振动频率,一般300比较合适" + "_docs": "全局帧动画时间", + "_data": "全局帧动画时间,即怪物振动频率,一般300比较合适" }, "statusCanvasRowsOnMobile": { "_leaf": true, - "_type": "textarea", - "_range": "thiseval==null || (thiseval>0 && thiseval<=4)", - "_docs": "竖屏自绘行数", + "_type": "select", + "_select": { + "values": [1,2,3,4] + }, + "_docs": "竖状态栏自绘行数", "_data": "竖屏模式下,顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度,如果设置则不小于1且不大于4。\n仅在statusCanvas开启时才有效" }, } @@ -578,36 +585,36 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "enableSkill" ] }, - "_data": "状态栏显示" + "_data": "状态栏显示项" }, "flyNearStair": { "_leaf": true, "_type": "checkbox", - "_docs": "楼传楼梯边", + "_docs": "楼传需在楼梯边", "_data": "传送器是否需要在楼梯边使用;如果flyRecordPosition开启,则此项对箭头也有效。" }, "flyRecordPosition": { "_leaf": true, "_type": "checkbox", - "_docs": "楼传平面模式", + "_docs": "楼传开平面模式", "_data": "传送器平面塔模式;此模式下楼层传送器将飞到上次离开该楼层的位置。" }, "steelDoorWithoutKey": { "_leaf": true, "_type": "checkbox", - "_docs": "铁门不消耗", + "_docs": "铁门不消耗钥匙", "_data": "铁门是否不需要钥匙开启。如果此项为true,则无需钥匙也可以开铁门。" }, "itemFirstText": { "_leaf": true, "_type": "checkbox", - "_docs": "首次道具提示", + "_docs": "首次道具进行提示", "_data": "首次获得道具是否提示" }, "equipboxButton": { "_leaf": true, "_type": "checkbox", - "_docs": "状态栏装备", + "_docs": "状态栏装备按钮", "_data": "状态栏的装备按钮。若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮" }, "enableAddPoint": { @@ -625,7 +632,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "betweenAttackMax": { "_leaf": true, "_type": "checkbox", - "_docs": "夹击不超伤害", + "_docs": "夹击不超伤害值", "_data": "夹击伤害是否不超过怪物伤害值。" }, "useLoop": { @@ -637,13 +644,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "startUsingCanvas": { "_leaf": true, "_type": "checkbox", - "_docs": "标题事件化", + "_docs": "标题开启事件化", "_data": "是否开始菜单canvas化;如果此项为true,则将使用canvas来绘制开始菜单" }, "statusCanvas": { "_leaf": true, "_type": "checkbox", - "_docs": "自绘状态栏", + "_docs": "开启自绘状态栏", "_data": "是否状态栏canvas化,即手动自定义绘制状态栏。\n如果此项开启,则可在脚本编辑的drawStatusBar中自定义绘制菜单栏。" }, "displayEnemyDamage": { diff --git a/libs/actions.js b/libs/actions.js index a05d286a..391ab9f0 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -2068,15 +2068,17 @@ actions.prototype._keyUpSwitchs = function (keycode) { } if (keycode == 37) { switch (core.status.event.selection) { - case 2: return this._clickSwitchs_userVolume(-1); - case 3: return this._clickSwitchs_moveSpeed(-10); - case 4: this._clickSwitchs_floorChangeTime(-100); + case 1: return this._clickSwitchs_userVolume(-1); + case 2: return this._clickSwitchs_moveSpeed(-10); + case 3: return this._clickSwitchs_floorChangeTime(-100); + case 4: return this._clickSwitchs_setSize(-1); } } else if (keycode == 39) { switch (core.status.event.selection) { - case 2: return this._clickSwitchs_userVolume(1); - case 3: return this._clickSwitchs_moveSpeed(10); - case 4: this._clickSwitchs_floorChangeTime(100); + case 1: return this._clickSwitchs_userVolume(1); + case 2: return this._clickSwitchs_moveSpeed(10); + case 3: return this._clickSwitchs_floorChangeTime(100); + case 4: return this._clickSwitchs_setSize(1); } } this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs); diff --git a/libs/control.js b/libs/control.js index e1ea103b..95940fcc 100644 --- a/libs/control.js +++ b/libs/control.js @@ -146,6 +146,11 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) { core.status.autotileAnimateObjs.blocks.forEach(function (block) { core.maps._drawAutotileAnimate(block, core.status.globalAnimateStatus); }); + + // Global hero animate + if ((core.status.hero || {}).animate && core.status.heroMoving == 0) { + core.drawHero('stop', null, core.status.globalAnimateStatus); + } } // Box animate core.drawBoxAnimate(); @@ -768,7 +773,7 @@ control.prototype.tryMoveDirectly = function (destX, destY) { } ////// 绘制勇士 ////// -control.prototype.drawHero = function (status, offset) { +control.prototype.drawHero = function (status, offset, frame) { if (!core.isPlaying() || !core.status.floorId || core.status.gameOver) return; var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction'); status = status || 'stop'; @@ -783,7 +788,7 @@ control.prototype.drawHero = function (status, offset) { core.status.heroCenter.py = 32 * y + offsetY + 32 - core.material.icons.hero.height / 2; if (!core.hasFlag('hideHero')) { - this._drawHero_draw(direction, x, y, status, offset); + this._drawHero_draw(direction, x, y, status, offset, frame); } this._drawHero_updateViewport(); @@ -794,9 +799,9 @@ control.prototype._drawHero_updateViewport = function () { core.setGameCanvasTranslate('hero', 0, 0); } -control.prototype._drawHero_draw = function (direction, x, y, status, offset) { +control.prototype._drawHero_draw = function (direction, x, y, status, offset, frame) { this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) { - core.drawImage('hero', block.img, block.heroIcon[block.status]*block.width, + core.drawImage('hero', block.img, (block.heroIcon[block.status] + (frame || 0))%4*block.width, block.heroIcon.loc * block.height, block.width, block.height, block.posx+(32-block.width)/2, block.posy+32-block.height, block.width, block.height); }); @@ -2691,7 +2696,7 @@ control.prototype.resize = function() { core.domStyle.isVertical = false; core.domStyle.availableScale = []; - [1, 1.25, 1.5, 2].forEach(function (v) { + [1, 1.25, 1.5, 1.75, 2].forEach(function (v) { if (clientWidth - 3 * BORDER >= v*(CANVAS_WIDTH + BAR_WIDTH) && clientHeight - 2 * BORDER >= v * CANVAS_WIDTH) { core.domStyle.availableScale.push(v); // 64x64 } diff --git a/libs/items.js b/libs/items.js index f332c4dd..3a22cac6 100644 --- a/libs/items.js +++ b/libs/items.js @@ -31,7 +31,6 @@ items.prototype.getItemEffect = function (itemId, itemNum) { var itemCls = core.material.items[itemId].cls; // 消耗品 if (itemCls === 'items') { - var ratio = parseInt(core.status.thisMap.item_ratio) || 1; var curr_hp = core.status.hero.hp; if (itemId in this.itemEffect) { try { @@ -64,10 +63,9 @@ items.prototype.getItemEffectTip = function (itemId) { var itemCls = core.material.items[itemId].cls; // 消耗品 if (itemCls === 'items') { - var ratio = parseInt(core.status.thisMap.item_ratio) || 1; if (itemId in this.itemEffectTip) { try { - return eval(this.itemEffectTip[itemId]) || ""; + return core.replaceText(this.itemEffectTip[itemId]) || ""; } catch (e) { main.log(e); return ""; @@ -95,7 +93,6 @@ items.prototype.useItem = function (itemId, noRoute, callback) { items.prototype._useItemEffect = function (itemId) { if (itemId in this.useItemEffect) { try { - var ratio = parseInt(core.status.thisMap.item_ratio) || 1; eval(this.useItemEffect[itemId]); } catch (e) { diff --git a/libs/ui.js b/libs/ui.js index f07c2d3b..014e16ee 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1400,10 +1400,18 @@ ui.prototype._drawTextBox_drawTitleAndIcon = function (titleInfo, hPos, vPos, al core.status.boxAnimateObjs = []; // --- 勇士 if (titleInfo.image == core.material.images.hero) { - core.clearMap('ui', hPos.left + 15, image_top, 32, titleInfo.height); - core.fillRect('ui', hPos.left + 15, image_top, 32, titleInfo.height, core.material.groundPattern); - core.drawImage('ui', titleInfo.image, 0, 0, core.material.icons.hero.width || 32, core.material.icons.hero.height, - hPos.left + 15, image_top, 32, titleInfo.height); + if (core.status.hero.animate) { + core.status.boxAnimateObjs.push({ + 'bgx': hPos.left + 15, 'bgy': image_top, 'bgWidth': 32, 'bgHeight': titleInfo.height, + 'x': hPos.left + 15, 'y': image_top, 'height': titleInfo.height, 'animate': 4, + 'image': titleInfo.image, 'pos': core.material.icons.hero[core.getHeroLoc('direction')].loc * titleInfo.height + }) + } else { + core.clearMap('ui', hPos.left + 15, image_top, 32, titleInfo.height); + core.fillRect('ui', hPos.left + 15, image_top, 32, titleInfo.height, core.material.groundPattern); + core.drawImage('ui', titleInfo.image, 0, 0, core.material.icons.hero.width || 32, core.material.icons.hero.height, + hPos.left + 15, image_top, 32, titleInfo.height); + } } else { core.status.boxAnimateObjs.push({ @@ -2836,7 +2844,6 @@ ui.prototype._drawStatistics_items = function (floorId, floor, id, obj) { if (obj.cls[id]=='items' && id!='superPotion') { var temp = core.clone(core.status.hero); core.setFlag("__statistics__", true); - var ratio = floor.item_ratio||1; try { eval(core.items.itemEffect[id]); } catch (e) {} hp = core.status.hero.hp - temp.hp; diff --git a/project/data.js b/project/data.js index 49707788..52d53fa0 100644 --- a/project/data.js +++ b/project/data.js @@ -90,6 +90,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "floorId": "sample0", "hero": { "image": "hero.png", + "animate": false, "name": "阳光", "lv": 1, "hpmax": 9999, diff --git a/project/floors/MT0.js b/project/floors/MT0.js index 8e98ca33..74b56253 100644 --- a/project/floors/MT0.js +++ b/project/floors/MT0.js @@ -8,7 +8,7 @@ main.floors.MT0= "cannotViewMap": false, "defaultGround": "ground", "images": [], - "item_ratio": 1, + "ratio": 1, "map": [ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], diff --git a/project/floors/sample0.js b/project/floors/sample0.js index 7d70dcd8..cc88bc8d 100644 --- a/project/floors/sample0.js +++ b/project/floors/sample0.js @@ -8,7 +8,7 @@ main.floors.sample0= "defaultGround": "ground", "images": [], "bgm": "bgm.mp3", - "item_ratio": 1, + "ratio": 1, "map": [ [ 0, 0,220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42], [ 0,246, 0,246, 0, 20, 0, 3, 58, 59, 60, 61, 41], diff --git a/project/floors/sample1.js b/project/floors/sample1.js index 14361334..ea62368b 100644 --- a/project/floors/sample1.js +++ b/project/floors/sample1.js @@ -20,7 +20,7 @@ main.floors.sample1= "snow", 6 ], - "item_ratio": 1, + "ratio": 1, "map": [ [ 7,131, 8,152, 9,130, 10,152,166,165,132,165,166], [ 0, 0, 0, 0, 0, 0, 0,152,165,164, 0,162,165], diff --git a/project/floors/sample2.js b/project/floors/sample2.js index a118ee6d..bd142331 100644 --- a/project/floors/sample2.js +++ b/project/floors/sample2.js @@ -8,7 +8,7 @@ main.floors.sample2= "cannotViewMap": false, "defaultGround": "ground", "images": [], - "item_ratio": 1, + "ratio": 1, "map": [ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], diff --git a/project/floors/sample3.js b/project/floors/sample3.js index a1a6e12d..0ae64ca8 100644 --- a/project/floors/sample3.js +++ b/project/floors/sample3.js @@ -18,7 +18,7 @@ main.floors.sample3= 10 ], "bgm": "bgm.mp3", - "item_ratio": 1, + "ratio": 1, "map": [ [ 5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5], [ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5], diff --git a/project/items.js b/project/items.js index 68c39d06..3e245d26 100644 --- a/project/items.js +++ b/project/items.js @@ -22,17 +22,17 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "redGem": { "cls": "items", "name": "红宝石", - "text": "',攻击+${core.values.redGem}'" + "text": "攻击+${core.values.redGem}" }, "blueGem": { "cls": "items", "name": "蓝宝石", - "text": "',防御+${core.values.blueGem}'" + "text": ",防御+${core.values.blueGem}" }, "greenGem": { "cls": "items", "name": "绿宝石", - "text": "',护盾+${core.values.greenGem}'" + "text": ",护盾+${core.values.greenGem}" }, "yellowGem": { "cls": "items", @@ -42,22 +42,22 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "redPotion": { "cls": "items", "name": "红血瓶", - "text": "',生命+${core.values.redPotion}'" + "text": ",生命+${core.values.redPotion}" }, "bluePotion": { "cls": "items", "name": "蓝血瓶", - "text": "',生命+${core.values.bluePotion}'" + "text": ",生命+${core.values.bluePotion}" }, "yellowPotion": { "cls": "items", "name": "黄血瓶", - "text": "',生命+${core.values.yellowPotion'}" + "text": ",生命+${core.values.yellowPotion}" }, "greenPotion": { "cls": "items", "name": "绿血瓶", - "text": "',生命+${core.values.greenPotion}'" + "text": ",生命+${core.values.greenPotion}" }, "sword0": { "cls": "items", @@ -341,14 +341,14 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = } }, "itemEffect": { - "redGem": "core.status.hero.atk += core.values.redGem * ratio", - "blueGem": "core.status.hero.def += core.values.blueGem * ratio", - "greenGem": "core.status.hero.mdef += core.values.greenGem * ratio", + "redGem": "core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio", + "blueGem": "core.status.hero.def += core.values.blueGem * core.status.thisMap.ratio", + "greenGem": "core.status.hero.mdef += core.values.greenGem * core.status.thisMap.ratio", "yellowGem": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;", - "redPotion": "core.status.hero.hp += core.values.redPotion * ratio", - "bluePotion": "core.status.hero.hp += core.values.bluePotion * ratio", - "yellowPotion": "core.status.hero.hp += core.values.yellowPotion * ratio", - "greenPotion": "core.status.hero.hp += core.values.greenPotion * ratio", + "redPotion": "core.status.hero.hp += core.values.redPotion * core.status.thisMap.ratio", + "bluePotion": "core.status.hero.hp += core.values.bluePotion * core.status.thisMap.ratio", + "yellowPotion": "core.status.hero.hp += core.values.yellowPotion * core.status.thisMap.ratio", + "greenPotion": "core.status.hero.hp += core.values.greenPotion * core.status.thisMap.ratio", "sword0": "core.status.hero.atk += 0", "sword1": "core.status.hero.atk += 10", "sword2": "core.status.hero.atk += 20", @@ -366,29 +366,29 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "silverCoin": "core.status.hero.money += 500" }, "itemEffectTip": { - "redGem": "',攻击+'+core.values.redGem * ratio", - "blueGem": "',防御+'+core.values.blueGem * ratio", - "greenGem": "',护盾+'+core.values.greenGem * ratio", - "yellowGem": "',全属性提升'", - "redPotion": "',生命+'+core.values.redPotion * ratio", - "bluePotion": "',生命+'+core.values.bluePotion * ratio", - "yellowPotion": "',生命+'+core.values.yellowPotion * ratio", - "greenPotion": "',生命+'+core.values.greenPotion * ratio", - "sword0": "',攻击+0'", - "sword1": "',攻击+10'", - "sword2": "',攻击+20'", - "sword3": "',攻击+40'", - "sword4": "',攻击+80'", - "sword5": "',攻击+100'", - "shield0": "',防御+0'", - "shield1": "',防御+10'", - "shield2": "',防御+20'", - "shield3": "',防御+40'", - "shield4": "',防御+80'", - "shield5": "',防御+100,护盾+100'", - "bigKey": "',全钥匙+1'", - "superPotion": "',生命值翻倍'", - "silverCoin": "',金币+500'" + "redGem": ",攻击+${core.values.redGem * core.status.thisMap.ratio}", + "blueGem": ",防御+${core.values.blueGem * core.status.thisMap.ratio}", + "greenGem": ",护盾+${core.values.greenGem * core.status.thisMap.ratio}", + "yellowGem": ",全属性提升", + "redPotion": ",生命+${core.values.redPotion * core.status.thisMap.ratio}", + "bluePotion": ",生命+${core.values.bluePotion * core.status.thisMap.ratio}", + "yellowPotion": ",生命+${core.values.yellowPotion * core.status.thisMap.ratio}", + "greenPotion": ",生命+${core.values.greenPotion * core.status.thisMap.ratio}", + "sword0": ",攻击+0", + "sword1": ",攻击+10", + "sword2": ",攻击+20", + "sword3": ",攻击+40", + "sword4": ",攻击+80", + "sword5": ",攻击+100", + "shield0": ",防御+0", + "shield1": ",防御+10", + "shield2": ",防御+20", + "shield3": ",防御+40", + "shield4": ",防御+80", + "shield5": ",防御+100,护盾+100", + "bigKey": ",全钥匙+1", + "superPotion": ",生命值翻倍", + "silverCoin": ",金币+500" }, "useItemEffect": { "book": "core.ui.drawBook(0);", diff --git a/project/maps.js b/project/maps.js index 0883429d..ee368f22 100644 --- a/project/maps.js +++ b/project/maps.js @@ -103,10 +103,10 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = "130": {"cls":"npcs","id":"expShop"}, "131": {"cls":"npcs","id":"moneyShop"}, "132": {"cls":"npcs","id":"princess"}, - "133": {"cls":"npc48","id":"npc0","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}}, - "134": {"cls":"npc48","id":"npc1","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}}, - "135": {"cls":"npc48","id":"npc2","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}}, - "136": {"cls":"npc48","id":"npc3","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}}, + "133": {"cls":"npc48","id":"npc0","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1}, + "134": {"cls":"npc48","id":"npc1","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1}, + "135": {"cls":"npc48","id":"npc2","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1}, + "136": {"cls":"npc48","id":"npc3","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1}, "137": {"cls":"npcs","id":"greenMan"}, "138": {"cls":"npcs","id":"blueTrader"}, "139": {"cls":"npcs","id":"redMSNpc"}, diff --git a/runtime.d.ts b/runtime.d.ts index ee8de756..7bcfad48 100644 --- a/runtime.d.ts +++ b/runtime.d.ts @@ -42,7 +42,7 @@ type Animate = { type Floor = { title: string, - item_ratio: number + ratio: number } type ResolvedMap = { @@ -651,9 +651,9 @@ declare class events { /** * 设置一项楼层属性并刷新状态栏 - * @example core.setFloorInfo('item_ratio', 2, 'MT0'); // 把主塔0层的血瓶和宝石变为双倍效果 - * @param name 'title','name','canFlyTo','canUseQuickShop','cannotViewMap','cannotMoveDirectly','upFloor','downFloor','defaultGround','images','color','weather','bgm','item_ratio','underGround'之一 - * @param values 属性的新值,可选。对'title'、'name'、'defaultGround'和'bgm'需要是字符串,对'underGround'和四个'canXxx'需要是布尔值,对两个'xxxFloor'需要是一行两列的自然数数组,对'item_ratio'需要是数字 + * @example core.setFloorInfo('ratio', 2, 'MT0'); // 把主塔0层的血瓶和宝石变为双倍效果 + * @param name 'title','name','canFlyTo','canUseQuickShop','cannotViewMap','cannotMoveDirectly','upFloor','downFloor','defaultGround','images','color','weather','bgm','ratio','underGround'之一 + * @param values 属性的新值,可选。对'title'、'name'、'defaultGround'和'bgm'需要是字符串,对'underGround'和四个'canXxx'需要是布尔值,对两个'xxxFloor'需要是一行两列的自然数数组,对'ratio'需要是数字 * @param floorId 楼层id,不填视为当前层 * @param prefix 独立开关前缀,一般不需要,下同 */ diff --git a/v2.x-final更新.txt b/v2.x-final更新.txt index 30fc8cbf..13079805 100644 --- a/v2.x-final更新.txt +++ b/v2.x-final更新.txt @@ -64,8 +64,7 @@ (已完成!) 右键图块选择复制/粘贴事件 (已完成!) showImage, drawImage,立绘等加上对称选项 (已完成!) 更多的图块blockly化 -勇士帧抖动 -怪物名和特殊属性自动缩小 +(已完成!) 勇士帧动画 行走动画? diff --git a/v266-v2.7接档说明.txt b/v266-v2.7接档说明.txt index e11099c2..e75cf70a 100644 --- a/v266-v2.7接档说明.txt +++ b/v266-v2.7接档说明.txt @@ -89,4 +89,6 @@ V2.6.6 -> V2.7 接档说明: 其他: Jewel改名Gem +道具效果提示文字replaceText + From a22c80e5bd060fd75fea7c3fff6eff2b774c348f Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 22 May 2020 18:38:10 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=8F=B3=E9=94=AE=E6=8B=89=E6=A1=86?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=89=AA=E5=88=87=E7=B2=98=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/MotaAction.g4 | 2 +- _server/editor.js | 1 + _server/editor_mappanel.js | 78 ++++++++++++++++++++++++++++---------- _server/editor_ui.js | 18 +++++---- v2.x-final更新.txt | 4 +- 5 files changed, 72 insertions(+), 31 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 4e88d5d6..81291140 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -523,7 +523,7 @@ return '{' + [ IdString_1 && ('"down": "' + IdString_1 +'"'), IdString_2 && ('"left": "' + IdString_2 +'"'), IdString_3 && ('"right": "' + IdString_3 +'"'), -].join(', ') + '}\n'; +].filter(function (x) { return x; }).join(', ') + '}\n'; */; diff --git a/_server/editor.js b/_server/editor.js index 2a6fc1b7..ac96b53b 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -70,6 +70,7 @@ function editor() { startPos:null, endPos:null, lastMoveE:{buttons:0,clientX:0,clientY:0}, + selectedArea: null, // 材料区拖动有关 lastMoveMaterE:null, tileSize: [1,1], diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js index 2406177e..8cce7cc2 100644 --- a/_server/editor_mappanel.js +++ b/_server/editor_mappanel.js @@ -75,6 +75,7 @@ editor_mappanel_wrapper = function (editor) { * + 绘图时画个矩形在那个位置 */ editor.uifunctions.map_ondown = function (e) { + editor.uivalues.selectedArea = null; editor.uivalues.lastMoveE=e; var loc = editor.uifunctions.eToLoc(e); var pos = editor.uifunctions.locToPos(loc, true); @@ -211,16 +212,20 @@ editor_mappanel_wrapper = function (editor) { * + 绘图模式时, 根据画线/画矩形/画tileset 做对应的绘制 */ editor.uifunctions.map_onup = function (ee) { - console.log(1) + editor.uivalues.selectedArea = null; + ee.preventDefault(); + ee.stopPropagation(); var e=editor.uivalues.lastMoveE; if (!selectBox.isSelected()) { if (e.buttons == 2) { - if (editor.uivalues.endPos==null || editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y){ + if (editor.uivalues.endPos==null || (editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y)) { // 右键点击: 弹菜单 editor.uifunctions.showMidMenu(e.clientX, e.clientY); + editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); } else { // 右键拖拽: 选中区域 printf('已经选中该区域') + editor.uivalues.selectedArea = Object.assign({}, editor.uivalues.startPos, {x1: editor.uivalues.endPos.x, y1: editor.uivalues.endPos.y}); // 后续的处理 } } else { @@ -232,8 +237,8 @@ editor_mappanel_wrapper = function (editor) { else editor.exchangeBgFg(editor.uivalues.startPos, editor.uivalues.endPos, editor.layerMod); editor.uifunctions.unhighlightSaveFloorButton(); + editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); } - editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__); editor.uivalues.startPos = editor.uivalues.endPos = null; return false; } @@ -876,30 +881,51 @@ editor_mappanel_wrapper = function (editor) { editor.constructor.prototype.copyFromPos = function (pos) { var fields = Object.keys(editor.file.comment._data.floors._data.loc._data); pos = pos || editor.pos; - var map = core.clone(editor.map[pos.y][pos.x]); - var events = {}; - fields.forEach(function(v){ - events[v] = core.clone(editor.currentFloorData[v][pos.x+','+pos.y]); - }) - return {map: map, events: events}; + var x0 = pos.x, y0 = pos.y, x1 = pos.x1, y1 = pos.y1; + if (x1 == null) x1 = x0; + if (y1 == null) y1 = y0; + if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap + if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap + var result = {w: x1 - x0 + 1, h: y1 - y0 + 1, layer: editor.layerMod, data: []}; + for (var i = x0; i <= x1; ++i) { + for (var j = y0; j<= y1; ++j) { + var map = core.clone(editor[editor.layerMod][j][i]); + var events = {}; + fields.forEach(function(v){ + events[v] = core.clone(editor.currentFloorData[v][i+','+j]); + }) + result.data.push({map: map, events: events}); + } + } + return result; } editor.constructor.prototype.pasteToPos = function (info, pos) { if (info == null) return; var fields = Object.keys(editor.file.comment._data.floors._data.loc._data); pos = pos || editor.pos; - editor.map[pos.y][pos.x] = core.clone(info.map); - fields.forEach(function(v){ - if (info.events[v] == null) delete editor.currentFloorData[v][pos.x+","+pos.y]; - else editor.currentFloorData[v][pos.x+","+pos.y] = core.clone(info.events[v]); - }); + var w = info.w || 1, h = info.h || 1, layer = info.layer || 'map'; + var data = core.clone(info.data || []); + for (var i = pos.x; i < pos.x+w; ++i) { + for (var j = pos.y; j < pos.y+h; ++j) { + var one = data.shift(); + if (j >= editor[editor.layerMod].length || i >= editor[editor.layerMod][0].length) continue; + editor[editor.layerMod][j][i] = core.clone(one.map); + if (layer == 'map' && editor.layerMod == 'map') { + fields.forEach(function(v){ + if (one.events[v] == null) delete editor.currentFloorData[v][i+","+j]; + else editor.currentFloorData[v][i+","+j] = core.clone(one.events[v]); + }); + } + } + } } editor.constructor.prototype.movePos = function (startPos, endPos, callback) { if (!startPos || !endPos) return; if (startPos.x == endPos.x && startPos.y == endPos.y) return; var copyed = editor.copyFromPos(startPos); - editor.pasteToPos({map:0, events: {}}, startPos); + editor.pasteToPos({w: 1, h: 1, layer: 'map', data: [{map:0, events: {}}]}, startPos); editor.pasteToPos(copyed, endPos); editor.updateMap(); editor.file.saveFloorFile(function (err) { @@ -986,16 +1012,28 @@ editor_mappanel_wrapper = function (editor) { editor.constructor.prototype.clearPos = function (clearPos, pos, callback) { var fields = Object.keys(editor.file.comment._data.floors._data.loc._data); pos = pos || editor.pos; + var x0 = pos.x, y0 = pos.y, x1 = pos.x1, y1 = pos.y1; + if (x1 == null) x1 = x0; + if (y1 == null) y1 = y0; + if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap + if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap editor.uifunctions.hideMidMenu(); editor.savePreMap(); editor.info = 0; editor_mode.onmode(''); - if (clearPos) - editor.map[pos.y][pos.x]=editor.info; + for (var i = x0; i <= x1; ++i) { + for (var j = y0; j <= y1; ++j) { + if (j >= editor[editor.layerMod].length || i >= editor[editor.layerMod][0].length) continue; + if (clearPos) + editor[editor.layerMod][j][i] = 0; + if (editor.layerMod == 'map') { + fields.forEach(function(v){ + delete editor.currentFloorData[v][i+","+j]; + }); + } + } + } editor.updateMap(); - fields.forEach(function(v){ - delete editor.currentFloorData[v][pos.x+','+pos.y]; - }) editor.file.saveFloorFile(function (err) { if (err) { printe(err); diff --git a/_server/editor_ui.js b/_server/editor_ui.js index 3d528f20..fff57c1b 100644 --- a/_server/editor_ui.js +++ b/_server/editor_ui.js @@ -343,15 +343,15 @@ editor_ui_wrapper = function (editor) { // Ctrl+C, Ctrl+X, Ctrl+V if (e.ctrlKey && e.keyCode == 67 && !selectBox.isSelected()) { e.preventDefault(); - editor.uivalues.copyedInfo = editor.copyFromPos(); - printf('该点事件已复制'); + editor.uivalues.copyedInfo = editor.copyFromPos(editor.uivalues.selectedArea); + printf('该点事件已复制;请注意右键地图拉框可以复制一个区域;若有时复制失灵请多点几下空白处'); return; } if (e.ctrlKey && e.keyCode == 88 && !selectBox.isSelected()) { e.preventDefault(); - editor.uivalues.copyedInfo = editor.copyFromPos(); - editor.clearPos(true, null, function () { - printf('该点事件已剪切'); + editor.uivalues.copyedInfo = editor.copyFromPos(editor.uivalues.selectedArea); + editor.clearPos(true, editor.uivalues.selectedArea, function () { + printf('该点事件已剪切;请注意右键地图拉框可以剪切一个区域;若有时剪切失灵请多点几下空白处'); editor.uifunctions.unhighlightSaveFloorButton(); }) return; @@ -369,7 +369,7 @@ editor_ui_wrapper = function (editor) { printe(err); throw (err) } - ; printf('粘贴事件成功'); + ; printf('粘贴事件成功;若有时粘贴失灵请多点几下空白处'); editor.uifunctions.unhighlightSaveFloorButton(); editor.drawPosSelection(); }); @@ -377,8 +377,10 @@ editor_ui_wrapper = function (editor) { } // DELETE if (e.keyCode == 46 && !selectBox.isSelected()) { - editor.clearPos(true); - editor.uifunctions.unhighlightSaveFloorButton(); + editor.clearPos(true, editor.uivalues.selectedArea, function () { + printf('该点事件已删除;请注意右键地图拉框可以删除一个区域;;若有时删除失灵请多点几下空白处'); + editor.uifunctions.unhighlightSaveFloorButton(); + }) return; } // ESC diff --git a/v2.x-final更新.txt b/v2.x-final更新.txt index 13079805..aadfea45 100644 --- a/v2.x-final更新.txt +++ b/v2.x-final更新.txt @@ -65,8 +65,8 @@ (已完成!) showImage, drawImage,立绘等加上对称选项 (已完成!) 更多的图块blockly化 (已完成!) 勇士帧动画 -行走动画? - +(不处理;现在静止状态可以有帧动画了,所以不考虑行走过程动画) 行走动画 +\t[this], 勇士朝下,flag:arg清理,瞬移扣血 ------------- From c41887bb1908ff2246102f4f1c39da757e5df419 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 22 May 2020 18:44:27 +0800 Subject: [PATCH 4/5] MotaActionParse -> MotaActionParser --- _server/MotaAction.g4 | 2 +- _server/{MotaActionParse.js => MotaActionParser.js} | 2 +- editor-mobile.html | 2 +- editor.html | 2 +- v2.x-final更新.txt | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) rename _server/{MotaActionParse.js => MotaActionParser.js} (99%) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index b257861a..5d4ef2a5 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -3184,6 +3184,6 @@ this.block('idTemp_e').output='idString_e'; /* Functions -MotaActionParse() +MotaActionParser() */ \ No newline at end of file diff --git a/_server/MotaActionParse.js b/_server/MotaActionParser.js similarity index 99% rename from _server/MotaActionParse.js rename to _server/MotaActionParser.js index b251288a..9889e46e 100644 --- a/_server/MotaActionParse.js +++ b/_server/MotaActionParser.js @@ -1,4 +1,4 @@ -MotaActionParse=function(){ +MotaActionParser=function(){ function ActionParser(){ } diff --git a/editor-mobile.html b/editor-mobile.html index a7ce7570..de06dc87 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -614,7 +614,7 @@ - + diff --git a/editor.html b/editor.html index cdaa3916..a03d70db 100644 --- a/editor.html +++ b/editor.html @@ -598,7 +598,7 @@ - + diff --git a/v2.x-final更新.txt b/v2.x-final更新.txt index aadfea45..1c49d733 100644 --- a/v2.x-final更新.txt +++ b/v2.x-final更新.txt @@ -66,6 +66,7 @@ (已完成!) 更多的图块blockly化 (已完成!) 勇士帧动画 (不处理;现在静止状态可以有帧动画了,所以不考虑行走过程动画) 行走动画 +合并main中一些设置内容 \t[this], 勇士朝下,flag:arg清理,瞬移扣血 ------------- From 363d451f50605e9085a03b118976df7d8a69b6a4 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Fri, 22 May 2020 19:45:43 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E9=81=93=E5=85=B7=E4=B8=8E=E6=80=AA?= =?UTF-8?q?=E7=89=A9=E5=90=8D=E7=9A=84=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/MotaAction.g4 | 2 +- _server/MotaActionParser.js | 146 ++++++++++++++++++++---------------- _server/editor_blockly.js | 20 ++++- _server/table/comment.js | 2 +- 4 files changed, 103 insertions(+), 67 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 5d4ef2a5..6bb5db27 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -3108,7 +3108,7 @@ Id_List EnemyId_List : '生命'|'攻击'|'防御'|'金币'|'经验'|'加点'|'属性'|'名称'|'映射名'|'value'|'atkValue'|'defValue'|'notBomb'|'zoneSquare'|'range'|'n'|'add'|'damage' - /*EnemyId_List ['hp','atk','def','money','exp','point','special','name','displayInBook','value','atkValue','defValue','notBomb','zoneSquare','range','n','add','damage']*/; + /*EnemyId_List ['hp','atk','def','money','exp','point','special','name','displayInBook','属性值','退化扣攻','退化扣防','不可炸','九宫格领域','领域范围','连击数','吸血到自身','固伤值']*/; Equip_List : '生命'|'生命上限'|'攻击'|'防御'|'护盾'|'魔力'|'魔力上限' diff --git a/_server/MotaActionParser.js b/_server/MotaActionParser.js index dbe5580d..86b03897 100644 --- a/_server/MotaActionParser.js +++ b/_server/MotaActionParser.js @@ -67,7 +67,7 @@ ActionParser.prototype.parse = function (obj,type) { Object.keys(obj).sort().forEach(function (key) { var one = knownEquipListKeys.indexOf(key) >= 0 ? 'equipKnown' : 'equipUnknown'; text_choices = MotaActionBlocks[one].xmlText([ - key, obj.key, text_choices + key, obj[key], text_choices ]); }) return text_choices; @@ -83,7 +83,7 @@ ActionParser.prototype.parse = function (obj,type) { Object.keys(obj).sort().forEach(function (key) { var one = knownListKeys.indexOf(key) >= 0 ? 'doorKeyKnown' : 'doorKeyUnknown'; text_choices = MotaActionBlocks[one].xmlText([ - key, obj.key, text_choices + one == 'doorKeyUnknown' ? MotaActionFunctions.replaceToName_token(key) : key, obj[key], text_choices ]); }) return text_choices; @@ -474,11 +474,11 @@ ActionParser.prototype.parseAction = function() { break; case "useItem": // 使用道具 this.next = MotaActionBlocks['useItem_s'].xmlText([ - data.id,this.next]); + MotaActionFunctions.replaceToName_token(data.id),this.next]); break; case "loadEquip": // 装上装备 this.next = MotaActionBlocks['loadEquip_s'].xmlText([ - data.id,this.next]); + MotaActionFunctions.replaceToName_token(data.id),this.next]); break; case "unloadEquip": // 卸下装备 this.next = MotaActionBlocks['unloadEquip_s'].xmlText([ @@ -495,7 +495,7 @@ ActionParser.prototype.parseAction = function() { case "battle": // 强制战斗 if (data.id) { this.next = MotaActionBlocks['battle_s'].xmlText([ - data.id,this.next]); + MotaActionFunctions.replaceToName_token(data.id),this.next]); } else { data.loc = data.loc || []; @@ -564,7 +564,7 @@ ActionParser.prototype.parseAction = function() { break; case "setEnemy": this.next = MotaActionBlocks['setEnemy_s'].xmlText([ - data.id, data.name, this.expandEvalBlock([data.value]), this.next]); + MotaActionFunctions.replaceToName_token(data.id), data.name, this.expandEvalBlock([data.value]), this.next]); break; case "setFloor": this.next = MotaActionBlocks['setFloor_s'].xmlText([ @@ -1027,7 +1027,7 @@ ActionParser.prototype.matchEvalAtom = function(args) { var EnemyId_List=MotaActionBlocks['EnemyId_List'].options; // [["生命", "hp"], ...] match=new RegExp("^enemy:([a-zA-Z0-9_]+):(" + EnemyId_List.map(function(v){return v[1]}).join('|') + ")$").exec(args[0]) if(match){ - args=[match[1],match[2]] + args=[MotaActionFunctions.replaceToName_token(match[1]),match[2]] return rt(MotaActionBlocks['enemyattr_e'].xmlText, args); } // 图块ID @@ -1156,6 +1156,7 @@ MotaActionFunctions.IntString_pre = function (IntString) { MotaActionFunctions.IdString_pre = function(IdString){ if (IdString.indexOf('__door__')!==-1) throw new Error('请修改开门变量__door__,如door1,door2,door3等依次向后。请勿存在两个门使用相同的开门变量。'); IdString = MotaActionFunctions.replaceFromName(IdString); + IdString = MotaActionFunctions.replaceFromName_token(IdString); if (IdString && !(MotaActionFunctions.pattern.id.test(IdString)) && !(MotaActionFunctions.pattern.idWithoutFlag.test(IdString))) throw new Error('id: '+IdString+'中包含了0-9 a-z A-Z _ - :之外的字符'); return IdString; @@ -1241,59 +1242,46 @@ MotaActionFunctions.pattern.replaceStatusList = [ ["steps", "步数"], ]; -MotaActionFunctions.pattern.replaceItemList = [ - // 保证顺序! - ["yellowKey", "黄钥匙"], - ["blueKey", "蓝钥匙"], - ["redKey", "红钥匙"], - ["redGem", "红宝石"], - ["blueGem", "蓝宝石"], - ["greenGem", "绿宝石"], - ["yellowGem", "黄宝石"], - ["redPotion", "红血瓶"], - ["bluePotion", "蓝血瓶"], - ["yellowPotion", "黄血瓶"], - ["greenPotion", "绿血瓶"], - ["sword1", "铁剑"], - ["sword2", "银剑"], - ["sword3", "骑士剑"], - ["sword4", "圣剑"], - ["sword5", "神圣剑"], - ["shield1", "铁盾"], - ["shield2", "银盾"], - ["shield3", "骑士盾"], - ["shield4", "圣盾"], - ["shield5", "神圣盾"], - ["superPotion", "圣水"], - ["silverCoin", "银币"], - ["book", "怪物手册"], - ["fly", "楼层传送器"], - ["coin", "幸运金币"], - ["freezeBadge", "冰冻徽章"], - ["cross", "十字架"], - ["dagger", "屠龙匕首"], - ["amulet", "护符"], - ["bigKey", "大黄门钥匙"], - ["greenKey", "绿钥匙"], - ["steelKey", "铁门钥匙"], - ["pickaxe", "破墙镐"], - ["icePickaxe", "破冰镐"], - ["bomb", "炸弹"], - ["centerFly", "中心对称飞行器"], - ["upFly", "上楼器"], - ["downFly", "下楼器"], - ["earthquake", "地震卷轴"], - ["poisonWine", "解毒药水"], - ["weakWine", "解衰药水"], - ["curseWine", "解咒药水"], - ["superWine", "万能药水"], - ["hammer", "圣锤"], - ["lifeWand", "生命魔杖"], - ["jumpShoes", "跳跃靴"], -]; -MotaActionFunctions.pattern.replaceEnemyList = [ +(function() { + // 读道具列表 + MotaActionFunctions.pattern.replaceItemList = []; + for (var id in core.material.items) { + var name = core.material.items[id].name; + if (id && name && name != '新物品') { + var hasPrefix = false; + MotaActionFunctions.pattern.replaceItemList.forEach(function (one) { + if (one[0].startsWith(id) || id.startsWith(one[0]) || one[1].startsWith(name) || name.startsWith(one[1])) { + hasPrefix = true; + } + }); + if (!hasPrefix) { + MotaActionFunctions.pattern.replaceItemList.push([id, name]); + } + } + } + + MotaActionFunctions.pattern.replaceEnemyList = []; + for (var id in core.material.enemys) { + var name = core.material.enemys[id].name; + if (id && name && name != '新敌人') { + var hasPrefix = false; + MotaActionFunctions.pattern.replaceEnemyList.forEach(function (one) { + if (one[0].startsWith(id) || id.startsWith(one[0]) || one[1].startsWith(name) || name.startsWith(one[1])) { + hasPrefix = true; + } + }); + if (!hasPrefix) { + MotaActionFunctions.pattern.replaceEnemyList.push([id, name]); + } + } + } + +})(); + +MotaActionFunctions.pattern.replaceEnemyValueList = [ // 保证顺序! + ["hp", "生命"], ["name", "名称"], ["atk", "攻击"], ["def", "防御"], @@ -1312,6 +1300,7 @@ MotaActionFunctions.replaceToName_token = function (str) { list=list.concat(MotaActionFunctions.pattern.replaceStatusList) list=list.concat(MotaActionFunctions.pattern.replaceItemList) list=list.concat(MotaActionFunctions.pattern.replaceEnemyList) + list=list.concat(MotaActionFunctions.pattern.replaceEnemyValueList) for(var index=0,pair;pair=list[index];index++){ if (pair[0]==str) { return pair[1] @@ -1320,6 +1309,21 @@ MotaActionFunctions.replaceToName_token = function (str) { return str; } +MotaActionFunctions.replaceFromName_token = function (str) { + if (!str || MotaActionFunctions.disableReplace) return str; + var list = []; + list=list.concat(MotaActionFunctions.pattern.replaceStatusList) + list=list.concat(MotaActionFunctions.pattern.replaceItemList) + list=list.concat(MotaActionFunctions.pattern.replaceEnemyList) + list=list.concat(MotaActionFunctions.pattern.replaceEnemyValueList) + for(var index=0,pair;pair=list[index];index++){ + if (pair[1]==str) { + return pair[0] + } + } + return str; +} + MotaActionFunctions.replaceToName = function (str) { if (!str || MotaActionFunctions.disableReplace) return str; var map = {}, list = []; @@ -1338,12 +1342,20 @@ MotaActionFunctions.replaceToName = function (str) { }).replace(/item:/g, "物品:"); str = str.replace(/flag:/g, "变量:").replace(/switch:/g, "独立开关:").replace(/global:/g, "全局存储:").replace(/temp:/g, "临时变量:"); + + MotaActionFunctions.pattern.replaceEnemyValueList.forEach(function (v) { + map[v[0]] = v[1]; list.push(v[0]); + }); + str = str.replace(new RegExp("enemy:([a-zA-Z0-9_]+)[.:](" + list.join("|") + ")", "g"), function (a, b, c) { + return map[c] ? ("enemy:" + b + ":" + map[c]) : c; + }).replace(/(enemy:[a-zA-Z0-9_]+)[.::]/g, '$1:'); + map = {}; list = []; MotaActionFunctions.pattern.replaceEnemyList.forEach(function (v) { map[v[0]] = v[1]; list.push(v[0]); }); - str = str.replace(new RegExp("enemy:([a-zA-Z0-9_]+).(" + list.join("|") + ")", "g"), function (a, b, c) { - return map[c] ? ("怪物:" + b + ":" + map[c]) : c; + str = str.replace(new RegExp("enemy:(" + list.join("|") + ")", "g"), function (a, b) { + return map[b] ? ("怪物:" + map[b]) : b; }).replace(/enemy:/g, "怪物:"); str = str.replace(/blockId:/g, "图块ID:").replace(/blockCls:/g, "图块类别:").replace(/equip:/g, "装备孔:"); @@ -1366,16 +1378,24 @@ MotaActionFunctions.replaceFromName = function (str) { str = str.replace(new RegExp("物品[::](" + list.join("|") + ")", "g"), function (a, b) { return map[b] ? ("item:" + map[b]) : b; }).replace(/物品[::]/g, "item:"); - str = str.replace(/临时变量[::]/g, "temp:").replace(/变量[::]/g, "flag:").replace(/独立开关[::]/g, "switch:").replace(/全局存储[::]/g, "global:"); + str = str.replace(/临时变量[::]/g, "temp d:").replace(/变量[::]/g, "flag:").replace(/独立开关[::]/g, "switch:").replace(/全局存储[::]/g, "global:"); map = {}; list = []; MotaActionFunctions.pattern.replaceEnemyList.forEach(function (v) { map[v[1]] = v[0]; list.push(v[1]); }); - str = str.replace(new RegExp("(enemy:|怪物[::])([a-zA-Z0-9_]+)[::](" + list.join("|") + ")", "g"), function (a, b, c, d) { - return map[d] ? ("enemy:" + c + ":" + map[d]) : d; + str = str.replace(new RegExp("(enemy:|怪物[::])(" + list.join("|") + ")", "g"), function (a, b, c, d) { + return map[c] ? ("enemy:" + map[c]) : c; }).replace(/怪物[::]/g, "enemy:"); + map = {}; list = []; + MotaActionFunctions.pattern.replaceEnemyValueList.forEach(function (v) { + map[v[1]] = v[0]; list.push(v[1]); + }); + str = str.replace(new RegExp("enemy:([a-zA-Z0-9_]+)[::](" + list.join("|") + ")", "g"), function (a, b, c, d) { + return map[c] ? ("enemy:" + b + ":" + map[c]) : c; + }).replace(/(enemy:[a-zA-Z0-9_]+)[::]/g, '$1:'); + str = str.replace(/图块I[dD][::]/g, "blockId:").replace(/图块类别[::]/g, "blockCls:").replace(/装备孔[::]/g, "equip:"); return str; diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 47ca3675..6ed9762f 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -472,7 +472,13 @@ editor_blockly = function () { return one != token && one.startsWith(token); }).sort(); } else if (before.endsWith("怪物") || (ch == ':' && before.endsWith("enemy"))) { - return Object.keys(core.material.enemys).filter(function (one) { + var list = Object.keys(core.material.enemys); + if (before.endsWith("怪物") && MotaActionFunctions) { + list = MotaActionFunctions.pattern.replaceEnemyList.map(function (v) { + return v[1]; + }).concat(list); + } + return list.filter(function (one) { return one != token && one.startsWith(token); }) } else { @@ -483,7 +489,7 @@ editor_blockly = function () { if (before.endsWith("怪物") || (ch == ':' && ch2 == ':' && before.endsWith("enemy"))) { var list = ["name", "hp", "atk", "def", "money", "exp", "point", "special"]; if (before.endsWith("怪物") && MotaActionFunctions) { - list = MotaActionFunctions.pattern.replaceEnemyList.map(function (v) { + list = MotaActionFunctions.pattern.replaceEnemyValueList.map(function (v) { return v[1]; }).concat(list); } @@ -536,7 +542,17 @@ editor_blockly = function () { })); var allImages = Object.keys(core.material.images.images); var allEnemys = Object.keys(core.material.enemys); + if (MotaActionFunctions && !MotaActionFunctions.disableReplace) { + allEnemys = allEnemys.concat(MotaActionFunctions.pattern.replaceEnemyList.map(function (x) { + return x[1]; + })) + } var allItems = Object.keys(core.material.items); + if (MotaActionFunctions && !MotaActionFunctions.disableReplace) { + allItems = allItems.concat(MotaActionFunctions.pattern.replaceItemList.map(function (x) { + return x[1]; + })) + } var allAnimates = Object.keys(core.material.animates); var allBgms = Object.keys(core.material.bgms); var allSounds = Object.keys(core.material.sounds); diff --git a/_server/table/comment.js b/_server/table/comment.js index 58c89856..60af0a61 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -108,7 +108,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { } } }, - "items_template": { 'cls': 'items', 'name': '新物品', 'canPass': true }, + "items_template": { 'cls': 'items', 'name': '新物品' }, // --------------------------- 【怪物】相关的表格配置 --------------------------- //