diff --git a/_docs/element.md b/_docs/element.md index 22e2a058..f392ff0d 100644 --- a/_docs/element.md +++ b/_docs/element.md @@ -308,7 +308,7 @@ V2.8.1新增了怪物的大贴图绑定,编辑器1:1模式下大贴图会被 4. **额外素材:**`project/tilesets`中的文件名(需要后缀,只支持png)。 * 注册方法同上,最大的区别在于这个数组的顺序必须保持好。如果随意调换其中的顺序,或注销不在数组末尾的图片,就会导致地图上最终呈现的素材发生错位。因此,新勾选的图片总会被自动追加到数组的末尾。 * 比起常规素材,额外素材最大的好处有几点: - 1. 图片没有数量限制。常规素材的总数量最多只允许不到一万个,而额外素材每张图片上的图块数量最多允许一千个。 + 1. 图片没有数量限制。常规素材的总数量最多只允许不到10000个,而额外素材每张图片上的图块数量最多允许3000个。 2. 查看和绘制更为方便。常规素材每个图块独占一行,每列为一帧,导致不方便观察,且用多个图块拼图必须逐图块绘制。额外素材都是静止的,所以每个图块只占一格,多个图块可以在准备素材时就直接以相邻的样子绘制在同一张图片上,绘制地图时直接从素材区拖动来批量框选,再在地图区单击成片绘制或拖动平铺。 3. 批量替换也更为方便。譬如您如果想制作形如“一场大战/天灾过后/多年以后,村庄/城镇化为了一片废墟”的效果,可以预先准备两张甚至更多张相同规格的额外素材图片,然后在适当的时候遍历某个/某些楼层的图块ID,将以“X1”开头的图块统一替换为“X2”开头等。发布单机版游戏时,您也可以提供多张相同规格的额外素材图片供玩家直接替换皮肤风格。 5. **使用动画:**`project/animates`文件夹中的文件名(不含后缀,请注意与`animates.png`相区分)。 diff --git a/_server/editor_datapanel.js b/_server/editor_datapanel.js index 3ae713c3..9e064cff 100644 --- a/_server/editor_datapanel.js +++ b/_server/editor_datapanel.js @@ -301,6 +301,13 @@ editor_datapanel_wrapper = function (editor) { printe('不合法的id,请使用字母、数字或下划线,且不能以数字开头'); return; } + if (id == 'hero' || id == 'this' || id == 'none' || id == 'airwall') { + printe('不得使用保留关键字作为id!'); + return; + } + if (core.statusBar.icons[id] != null) { + alert('警告!此ID在状态栏图标中被注册;仍然允许使用,但是\\i[]等绘制可能出现冲突。'); + } editor.file.changeIdAndIdnum(id, idnum, editor_mode.info, function (err) { if (err) { printe(err); @@ -358,6 +365,9 @@ editor_datapanel_wrapper = function (editor) { printe('额外素材不可修改id!'); return; } + if (core.statusBar.icons[id] != null) { + alert('警告!此ID在状态栏图标中被注册;仍然允许使用,但是\\i[]等绘制可能出现冲突。'); + } editor.file.changeIdAndIdnum(id, null, editor_mode.info, function (err) { if (err) { printe(err); diff --git a/_server/table/data.comment.js b/_server/table/data.comment.js index 6a2031b9..4a2d26ea 100644 --- a/_server/table/data.comment.js +++ b/_server/table/data.comment.js @@ -490,10 +490,10 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_leaf": true, "_type": "select", "_select": { - "values": [1, 2, 3, 4] + "values": [1, 2, 3, 4, 5] }, "_docs": "竖状态栏自绘行数", - "_data": "竖屏模式下,顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度,如果设置则不小于1且不大于4。\n仅在statusCanvas开启时才有效" + "_data": "竖屏模式下,顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度,如果设置则不小于1且不大于5。\n仅在statusCanvas开启时才有效" }, "floorChangeTime": { "_leaf": true, diff --git a/libs/control.js b/libs/control.js index 60aa20ed..4a5aa417 100644 --- a/libs/control.js +++ b/libs/control.js @@ -2674,10 +2674,9 @@ control.prototype._weather_snow = function (level) { control.prototype._weather_fog = function (level) { if (!core.animateFrame.weather.fog) return; - var number = level * parseInt(20*core.bigmap.width*core.bigmap.height/(core.__SIZE__*core.__SIZE__)); core.animateFrame.weather.nodes = [{ 'image': core.animateFrame.weather.fog, - 'level': number, + 'level': 40 * level, 'x': 0, 'y': -core.__PIXELS__ / 2, 'dx': -Math.random() * 1.5, @@ -2688,10 +2687,9 @@ control.prototype._weather_fog = function (level) { control.prototype._weather_cloud = function (level) { if (!core.animateFrame.weather.cloud) return; - var number = level * parseInt(20*core.bigmap.width*core.bigmap.height/(core.__SIZE__*core.__SIZE__)); core.animateFrame.weather.nodes = [{ 'image': core.animateFrame.weather.cloud, - 'level': number, + 'level': 40 * level, 'x': 0, 'y': -core.__PIXELS__ / 2, 'dx': -Math.random() * 1.5, @@ -3229,9 +3227,9 @@ control.prototype.resize = function() { var statusDisplayArr = this._shouldDisplayStatus(), count = statusDisplayArr.length; var statusCanvas = core.flags.statusCanvas, statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3; var col = statusCanvas ? statusCanvasRows : Math.ceil(count / 3); - if (col > 4) { - if (statusCanvas) alert("自绘状态栏的在竖屏下的行数应不超过4!"); - else alert("当前状态栏数目("+count+")大于12,请调整到不超过12以避免手机端出现显示问题。"); + if (col > 5) { + if (statusCanvas) alert("自绘状态栏的在竖屏下的行数应不超过5!"); + else alert("当前状态栏数目("+count+")大于15,请调整到不超过15以避免手机端出现显示问题。"); } var globalAttribute = core.status.globalAttribute || core.initStatus.globalAttribute; @@ -3241,7 +3239,7 @@ control.prototype.resize = function() { CANVAS_WIDTH: CANVAS_WIDTH, BORDER: BORDER, BAR_WIDTH: BAR_WIDTH, - TOOLBAR_HEIGHT: extendToolbar ? 38 : 44, + TOOLBAR_HEIGHT: 38, outerSize: CANVAS_WIDTH * core.domStyle.scale + 2 * BORDER, globalAttribute: globalAttribute, border: '3px ' + core.arrayToRGBA(globalAttribute.borderColor) + ' solid', @@ -3249,7 +3247,7 @@ control.prototype.resize = function() { count: count, col: col, statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 2 * BORDER : 0, - toolbarHeightInVertical: core.domStyle.isVertical ? 44 * core.domStyle.scale + 2 * BORDER : 0, + toolbarHeightInVertical: core.domStyle.isVertical ? 38 * core.domStyle.scale + 2 * BORDER : 0, extendToolbar: extendToolbar, is15x15: core.__SIZE__ == 15 }; @@ -3456,7 +3454,7 @@ control.prototype._resize_tools = function (obj) { var style = core.dom.tools[i].style; style.height = toolsHeight + "px"; style.marginLeft = toolsMarginLeft + "px"; - style.marginTop = (obj.extendToolbar ? 3 : 6) * core.domStyle.scale + "px" + style.marginTop = 3 * core.domStyle.scale + "px" } core.dom.hard.style.lineHeight = toolsHeight + "px"; if (core.domStyle.isVertical || obj.extendToolbar) { diff --git a/libs/events.js b/libs/events.js index 57ffff6c..7fe9678c 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1682,12 +1682,12 @@ events.prototype._precompile_scaleImage = function (data) { events.prototype._action_setCurtain = function (data, x, y, prefix) { if (data.async) { - core.setCurtain(data.color, data.time, data.moveMode); + core.setCurtain(data.color || core.status.thisMap.color, data.time, data.moveMode); if (data.color == null || data.keep) core.setFlag('__color__', data.color || null); core.doAction(); } else { - core.setCurtain(data.color, data.time, data.moveMode, function () { + core.setCurtain(data.color || core.status.thisMap.color, data.time, data.moveMode, function () { if (data.color == null || data.keep) core.setFlag('__color__', data.color || null); core.doAction(); }); @@ -3073,7 +3073,7 @@ events.prototype.setGlobalFlag = function (name, value) { core.setFlag("globalFlags", flags); core.resize(); if (name == 'blurFg') - core.drawMap(); + core.redrawMap(); } ////// 设置文件别名 ////// diff --git a/libs/maps.js b/libs/maps.js index e292dec2..e1d6094b 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -385,7 +385,7 @@ maps.prototype.setBlockOpacity = function (opacity, x, y, floorId) { block.opacity = opacity; if (floorId == core.status.floorId && !block.disable) { if (block.event.cls == 'autotile') { - core.drawMap(); + core.redrawMap(); } else { core.drawBlock(block); core.addGlobalAnimate(block); @@ -416,7 +416,7 @@ maps.prototype.setBlockFilter = function (filter, x, y, floorId) { block.filter = core.clone(filter); if (floorId == core.status.floorId && !block.disable) { if (block.event.cls == 'autotile') { - core.drawMap(); + core.redrawMap(); } else { core.drawBlock(block); core.addGlobalAnimate(block); @@ -2057,7 +2057,7 @@ maps.prototype.showBlock = function (x, y, floorId) { // 在本层,添加动画 if (floorId == core.status.floorId) { if (block.event.cls == 'autotile') { - core.drawMap(); + core.redrawMap(); } else { core.drawBlock(block); core.addGlobalAnimate(block); @@ -2107,7 +2107,7 @@ maps.prototype._removeBlockFromMap = function (floorId, block) { if (floorId != core.status.floorId) return; var filter = block.filter || {}; if (block.event.cls == 'autotile' || filter.blur > 0 || filter.shadow > 0) { - core.drawMap(); + core.redrawMap(); } else { var x = block.x, y = block.y; var px = 32 * x - core.bigmap.posX * 32; @@ -2196,7 +2196,7 @@ maps.prototype._triggerBgFgMap = function (type, name, loc, floorId, callback) { core.status[name + "maps"][floorId] = null; if (floorId == core.status.floorId) { - core.drawMap(floorId); + core.redrawMap(); } if (callback) callback(); } @@ -2228,7 +2228,7 @@ maps.prototype._triggerFloorImage = function (type, loc, floorId, callback) { }) if (floorId == core.status.floorId) { - core.drawMap(floorId); + core.redrawMap(); } if (callback) callback(); } @@ -2267,7 +2267,7 @@ maps.prototype.setBlock = function (number, x, y, floorId) { if (floorId == core.status.floorId) { // 有任何一个是autotile直接重绘地图 if ((originEvent != null && originEvent.cls == 'autotile') || block.event.cls == 'autotile') { - core.drawMap(); + core.redrawMap(); } else { if (originEvent != null) { this._removeBlockFromMap(floorId, {x: x, y: y, event: originEvent}); @@ -2418,7 +2418,7 @@ maps.prototype.replaceBlock = function (fromNumber, toNumber, floorId) { this._updateMapArray(floorId, block.x, block.y); } }, this); - if (floorId == core.status.floorId) core.drawMap(); + if (floorId == core.status.floorId) core.redrawMap(); } ////// 改变前景背景的图块 ////// @@ -2464,7 +2464,7 @@ maps.prototype.resetMap = function (floorId) { delete (core.status.mapBlockObjs || {})[t]; if (t == core.status.floorId) needRefresh = true; }); - if (needRefresh) this.drawMap(); + if (needRefresh) this.redrawMap(); core.drawTip("地图重置成功"); } diff --git a/libs/utils.js b/libs/utils.js index b02b874f..1601ca05 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -1243,10 +1243,10 @@ utils.prototype.same = function (a, b) { return true; } if (a instanceof Object && b instanceof Object) { - for (var i in a) { - if (!this.same(a[i], b[i])) return false; - } - for (var i in b) { + var obj = {}; + for (var i in a) obj[i] = true; + for (var i in b) obj[i] = true; + for (var i in obj) { if (!this.same(a[i], b[i])) return false; } return true; diff --git a/project/floors/sample1.js b/project/floors/sample1.js index a9280e0b..2d3f74a0 100644 --- a/project/floors/sample1.js +++ b/project/floors/sample1.js @@ -7,7 +7,14 @@ main.floors.sample1= "canFlyFrom": true, "canUseQuickShop": true, "defaultGround": "grass", - "images": null, + "images": [ + { + "name": "bg.jpg", + "canvas": "bg", + "x": 0, + "y": 0 + } + ], "weather": [ "snow", 6 diff --git a/project/items.js b/project/items.js index 639bb668..3406d3f4 100644 --- a/project/items.js +++ b/project/items.js @@ -410,7 +410,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "cls": "tools", "name": "地震卷轴", "text": "可以破坏当前层的所有墙", - "useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap();\n\tcore.playSound('炸弹');\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();", + "useItemEffect": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.redrawMap();\n\tcore.playSound('炸弹');\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();", "canUseItemEffect": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();" }, "poisonWine": { diff --git a/project/materials/keyboard.png b/project/materials/keyboard.png index 5928c832..55d5b2dc 100644 Binary files a/project/materials/keyboard.png and b/project/materials/keyboard.png differ