diff --git a/_docs/personalization.md b/_docs/personalization.md
index ac7ff766..356bb46a 100644
--- a/_docs/personalization.md
+++ b/_docs/personalization.md
@@ -236,7 +236,7 @@ ID必须由数字字母下划线组成,数字在1000以内,且均不能和
除此之外,额外素材在游戏中的使用和正式素材都是一致的,也能在前景或背景图层绘制。
-额外素材可以使用“tileset贴图”的方式进行绘制,一次绘制一个矩形区域。
+额外素材可以使用“tileset平铺”的方式进行绘制,一次绘制一个矩形区域。
“辅助工具”中提供了“额外素材合并”,如果使用此功能,请不要对额外素材进行基于ID、索引和数字的判定和读写等操作,如确有此需求,可以创建一些玩家不可达也不可预览的隐藏样板层,然后用等量代换的办法去从样板层取用。
## 自定义道具效果
diff --git a/_server/MotaActionParse.js b/_server/MotaActionParse.js
index 3a639310..5c9ab9c1 100644
--- a/_server/MotaActionParse.js
+++ b/_server/MotaActionParse.js
@@ -1022,9 +1022,9 @@ ActionParser.prototype.matchEvalCompare=function(args, isShadow){
// 按优先级依次寻找以下符号
var oplist=['<','<=','>','>=','==','!=','&&','||'].reverse()
for (var index = 0,op; op=oplist[index]; index++) {
- var match=new RegExp('(?<= )'+(op=='||'?'\\|\\|':op)+'(?= )').exec(str)
+ var match=new RegExp(' '+(op=='||'?'\\|\\|':op)+' ').exec(str)
if (!match) continue;
- args=[this.expandEvalBlock([raw.slice(0,match.index)],isShadow),op.replace(/&/g,'&').replace(//g,'>'),this.expandEvalBlock([raw.slice(match.index+op.length)],isShadow)]
+ args=[this.expandEvalBlock([raw.slice(0,match.index+1)],isShadow),op.replace(/&/g,'&').replace(//g,'>'),this.expandEvalBlock([raw.slice(match.index+1+op.length)],isShadow)]
return {ret:true,xml:xml,args:args}
}
return {ret:false}
diff --git a/_server/editor.js b/_server/editor.js
index 31d1f954..c2843696 100644
--- a/_server/editor.js
+++ b/_server/editor.js
@@ -105,6 +105,7 @@ function editor() {
// tile
tileSize: [1,1],
+ startLoc: null,
lockMode: false,
// 最近使用的图块
@@ -282,6 +283,7 @@ editor.prototype.changeFloor = function (floorId, callback) {
editor.viewportLoc = editor.viewportLoc || {};
var loc = editor.viewportLoc[floorId] || [], x = loc[0] || 0, y = loc[1] || 0;
editor.setViewport(x, y);
+ editor.uifunctions.unhighlightSaveFloorButton();
editor.config.set('editorLastFloorId', floorId, function() {
if (callback) callback();
@@ -682,6 +684,7 @@ editor.prototype.setSelectBoxFromInfo=function(thisevent, scrollTo){
editor.dom.dataSelection.style.left = pos.x * 32 + 'px';
editor.dom.dataSelection.style.top = pos.y * ysize + 'px';
editor.dom.dataSelection.style.height = ysize - 6 + 'px';
+ editor.dom.dataSelection.style.width = 32 - 6 + 'px';
setTimeout(function(){
selectBox.isSelected(true);
editor.updateLastUsedMap();
diff --git a/_server/editor_listen.js b/_server/editor_listen.js
index f5994f4e..7a3b83b1 100644
--- a/_server/editor_listen.js
+++ b/_server/editor_listen.js
@@ -24,6 +24,8 @@ editor_listen_wrapper = function (editor) {
editor.dom.iconExpandBtn.onclick = editor.uifunctions.fold_material_click
editor.dom.iconLib.onmousedown = editor.uifunctions.material_ondown
+ editor.dom.iconLib.onmousemove = editor.uifunctions.material_onmove
+ editor.dom.iconLib.onmouseup = editor.uifunctions.material_onup
editor.dom.iconLib.oncontextmenu = function (e) { e.preventDefault() }
editor.dom.extraEvent.onmousedown = editor.uifunctions.extraEvent_click
@@ -132,6 +134,14 @@ editor_listen_wrapper = function (editor) {
editor.dom.moveLoc.onmousedown = null
editor.dom.clearLoc.ontouchstart = editor.dom.clearLoc.onmousedown
editor.dom.clearLoc.onmousedown = null
+
+ // 不使用以下6语句, 会使得素材区手机无法拖动, 手机的框选素材只能放弃, 要通过弹框实现框选
+ // editor.dom.iconLib.ontouchstart = editor.dom.iconLib.onmousedown
+ // editor.dom.iconLib.onmousedown = null
+ // editor.dom.iconLib.ontouchmove = editor.dom.iconLib.onmousemove
+ // editor.dom.iconLib.onmousemove = null
+ // editor.dom.iconLib.ontouchend = editor.dom.iconLib.onmouseup
+ // editor.dom.iconLib.onmouseup = null
}
editor.constructor.prototype.mode_listen = function (callback) {
diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js
index f6c7687c..f2f850ac 100644
--- a/_server/editor_mappanel.js
+++ b/_server/editor_mappanel.js
@@ -202,6 +202,7 @@ editor_mappanel_wrapper = function (editor) {
editor.exchangeBgFg(editor.uivalues.startPos, editor.uivalues.endPos, editor.layerMod);
editor.uivalues.startPos = editor.uivalues.endPos = null;
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
+ editor.uifunctions.unhighlightSaveFloorButton();
return false;
}
editor.uivalues.holdingPath = 0;
@@ -239,12 +240,11 @@ editor_mappanel_wrapper = function (editor) {
var x0 = editor.uivalues.stepPostfix[0].x;
var y0 = editor.uivalues.stepPostfix[0].y;
var idnum = editor.info.idnum;
+ var pmod=function(a,b){return (a%b+b)%b;}
for (var ii = 0; ii < editor.uivalues.stepPostfix.length; ii++) {
- if (editor.uivalues.stepPostfix[ii].y != y0) {
- y0++;
- idnum += imgWidth;
- }
- editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.ids[editor.indexs[idnum + editor.uivalues.stepPostfix[ii].x - x0]];
+ var dx=pmod(editor.uivalues.stepPostfix[ii].x-x0,editor.uivalues.tileSize[0]);
+ var dy=pmod(editor.uivalues.stepPostfix[ii].y-y0,editor.uivalues.tileSize[1]);
+ editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.ids[editor.indexs[idnum + dx+dy*imgWidth]];
}
} else {
// 检测是否是填充模式
@@ -274,6 +274,7 @@ editor_mappanel_wrapper = function (editor) {
editor.uivalues.holdingPath = 0;
editor.uivalues.stepPostfix = [];
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
+ editor.uifunctions.highlightSaveFloorButton();
}
return false;
}
@@ -465,6 +466,7 @@ editor_mappanel_wrapper = function (editor) {
editor.drawEventBlock();
editor_mode.showMode('loc');
printf('添加楼梯事件成功');
+ editor.uifunctions.unhighlightSaveFloorButton();
});
return true;
}
@@ -525,6 +527,7 @@ editor_mappanel_wrapper = function (editor) {
editor.drawPosSelection();
editor_mode.showMode('loc');
printf('绑定机关门事件成功');
+ editor.uifunctions.unhighlightSaveFloorButton();
});
bindSpecialDoor.loc = null;
bindSpecialDoor.enemys = [];
@@ -577,6 +580,7 @@ editor_mappanel_wrapper = function (editor) {
throw (err)
}
; printf('复制事件成功');
+ editor.uifunctions.unhighlightSaveFloorButton();
editor.drawPosSelection();
});
}
@@ -591,6 +595,7 @@ editor_mappanel_wrapper = function (editor) {
editor.savePreMap();
editor_mode.onmode('');
editor.exchangePos(editor.pos, editor.uivalues.lastRightButtonPos[1]);
+ editor.uifunctions.unhighlightSaveFloorButton();
}
/**
@@ -600,6 +605,7 @@ editor_mappanel_wrapper = function (editor) {
editor.uifunctions.clearEvent_click = function (e) {
e.stopPropagation();
editor.clearPos(false);
+ editor.uifunctions.unhighlightSaveFloorButton();
}
/**
@@ -609,6 +615,7 @@ editor_mappanel_wrapper = function (editor) {
editor.uifunctions.clearLoc_click = function (e) {
e.stopPropagation();
editor.clearPos(true);
+ editor.uifunctions.unhighlightSaveFloorButton();
}
/**
@@ -647,13 +654,13 @@ editor_mappanel_wrapper = function (editor) {
* 切换画笔模式
*/
editor.uifunctions.brushMod3_onchange = function () {
- if (!editor.config.get('alertTileMode') &&
- !confirm("从V2.6.6开始,tileset贴图模式已被废弃。\n请右键额外素材,并输入所需要绘制的宽高,然后单击地图以绘制一个区域。\n\n点取消将不再显示此提示。")) {
- editor.config.set('alertTileMode', true);
+ if (!editor.config.get('alertTileModeV2.7') &&
+ !confirm("从V2.7开始,请直接素材区拖框进行绘制区域。\n\n点取消将不再显示此提示。")) {
+ editor.config.set('alertTileModeV2.7', true);
}
// tip.showHelp(5)
tip.isSelectedBlock(false)
- tip.msgs[11] = String('tileset贴图模式下可以按选中tileset素材,并在地图上拖动来一次绘制一个区域');
+ tip.msgs[11] = String('tileset平铺模式下可以按选中tileset素材,并在地图上拖动来一次绘制一个区域');
tip.whichShow(12);
editor.brushMod = editor.dom.brushMod3.value;
}
@@ -765,6 +772,15 @@ editor_mappanel_wrapper = function (editor) {
});
}
+ editor.uifunctions.highlightSaveFloorButton=function(){
+ var saveFloor = document.getElementById('saveFloor');
+ saveFloor.style.background='#FFCCAA';
+ }
+
+ editor.uifunctions.unhighlightSaveFloorButton=function(){
+ var saveFloor = document.getElementById('saveFloor');
+ saveFloor.style.background='';
+ }
editor.uifunctions.saveFloor_func = function () {
var saveFloor = document.getElementById('saveFloor');
@@ -776,6 +792,7 @@ editor_mappanel_wrapper = function (editor) {
throw (err)
}
; printf('保存成功');
+ editor.uifunctions.unhighlightSaveFloorButton()
});
}
saveFloor.onclick = editor_mode.saveFloor;
diff --git a/_server/editor_materialpanel.js b/_server/editor_materialpanel.js
index 51752b9c..8a6704fa 100644
--- a/_server/editor_materialpanel.js
+++ b/_server/editor_materialpanel.js
@@ -62,13 +62,54 @@ editor_materialpanel_wrapper = function (editor) {
}
}
+ var lastmoveE=null;
/**
* editor.dom.iconLib.onmousedown
- * 素材区的单击事件
+ * 素材区的单击/拖拽事件
*/
editor.uifunctions.material_ondown = function (e) {
e.stopPropagation();
e.preventDefault();
+ lastmoveE=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;
+ editor.uivalues.startLoc={
+ 'x': scrollLeft + e.clientX + editor.dom.iconLib.scrollLeft - right.offsetLeft - editor.dom.iconLib.offsetLeft,
+ 'y': scrollTop + e.clientY + editor.dom.iconLib.scrollTop - right.offsetTop - editor.dom.iconLib.offsetTop,
+ 'px': e.clientX,
+ 'py': e.clientY,
+ 'size': 32
+ };
+ }
+
+ /**
+ * editor.dom.iconLib.onmousemove
+ * 素材区的单击/拖拽事件
+ */
+ editor.uifunctions.material_onmove = function (e) {
+ e.stopPropagation();
+ e.preventDefault();
+ lastmoveE=e;
+ if (!editor.uivalues.startLoc) return;
+ var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc);
+
+ editor.dom.dataSelection.style.left = 32 * pos0.x + 'px';
+ editor.dom.dataSelection.style.top = 32 * pos0.y + 'px';
+ editor.dom.dataSelection.style.width = e.clientX - editor.uivalues.startLoc.px + 'px';
+ editor.dom.dataSelection.style.height = e.clientY - editor.uivalues.startLoc.py + 'px';
+ editor.dom.dataSelection.style.display = 'block';
+ }
+
+ /**
+ * editor.dom.iconLib.onmouseup
+ * 素材区的单击/拖拽事件
+ */
+ editor.uifunctions.material_onup = function (ee) {
+ var startLoc = editor.uivalues.startLoc;
+ editor.uivalues.startLoc = null;
+
+ var e=lastmoveE;
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;
@@ -79,6 +120,7 @@ editor_materialpanel_wrapper = function (editor) {
};
editor.loc = loc;
editor.uivalues.tileSize = [1,1];
+ var pos0 = editor.uifunctions.locToPos(startLoc);
var pos = editor.uifunctions.locToPos(loc);
for (var spriter in editor.widthsX) {
if (pos.x >= editor.widthsX[spriter][1] && pos.x < editor.widthsX[spriter][2]) {
@@ -115,6 +157,7 @@ editor_materialpanel_wrapper = function (editor) {
editor.dom.dataSelection.style.left = pos.x * 32 + 'px';
editor.dom.dataSelection.style.top = pos.y * ysize + 'px';
editor.dom.dataSelection.style.height = ysize - 6 + 'px';
+ editor.dom.dataSelection.style.width = 32 - 6 + 'px';
if (pos.x == 0 && pos.y == 0) {
// editor.info={idnum:0, id:'empty','images':'清除块', 'y':0};
@@ -133,21 +176,24 @@ editor_materialpanel_wrapper = function (editor) {
editor.info = { 'images': pos.images, 'y': y }
}
- for (var ii = 0; ii < editor.ids.length; ii++) {
- if ((core.tilesets.indexOf(pos.images) != -1 && editor.info.images == editor.ids[ii].images
- && editor.info.y == editor.ids[ii].y && editor.info.x == editor.ids[ii].x)
- || (Object.prototype.hasOwnProperty.call(autotiles, pos.images) && editor.info.images == editor.ids[ii].id
- && editor.info.y == editor.ids[ii].y)
- || (core.tilesets.indexOf(pos.images) == -1 && editor.info.images == editor.ids[ii].images
- && editor.info.y == editor.ids[ii].y)
+ for (var idindex = 0; idindex < editor.ids.length; idindex++) {
+ if ((core.tilesets.indexOf(pos.images) != -1 && editor.info.images == editor.ids[idindex].images
+ && editor.info.y == editor.ids[idindex].y && editor.info.x == editor.ids[idindex].x)
+ || (Object.prototype.hasOwnProperty.call(autotiles, pos.images) && editor.info.images == editor.ids[idindex].id
+ && editor.info.y == editor.ids[idindex].y)
+ || (core.tilesets.indexOf(pos.images) == -1 && editor.info.images == editor.ids[idindex].images
+ && editor.info.y == editor.ids[idindex].y)
) {
- editor.info = editor.ids[ii];
+ editor.info = editor.ids[idindex];
break;
}
}
- if (editor.info.isTile && e.button == 2) {
+ if (editor.info.isTile && e.button == 2) { //这段改一改之类的应该能给手机用,就不删了
+ // 废弃好了
+ alert('V2.7后右键已被废弃,请直接素材区拖框选中区域。');
+ /*
var v = prompt("请输入该额外素材区域绑定宽高,以逗号分隔", "1,1");
if (v != null && /^\d+,\d+$/.test(v)) {
v = v.split(",");
@@ -157,8 +203,31 @@ editor_materialpanel_wrapper = function (editor) {
alert("不合法的输入范围,已经越界");
} else {
editor.uivalues.tileSize = [x, y];
+ editor.dom.dataSelection.style.left = pos.x * 32 + 'px';
+ editor.dom.dataSelection.style.top = pos.y * ysize + 'px';
+ editor.dom.dataSelection.style.height = ysize*y - 6 + 'px';
+ editor.dom.dataSelection.style.width = 32*x - 6 + 'px';
}
}
+ */
+ }
+ if (editor.info.isTile && e.button != 2) { //左键拖拽框选
+
+ var x = pos.x-pos0.x+1, y = pos.y-pos0.y+1;
+ var widthX = editor.widthsX[editor.info.images];
+ // 懒得仔细处理了, 只允许左上往右下拉
+ if (x <= 0 || y <= 0 || pos0.x < widthX[1]){
+
+ } else {
+ editor.info = editor.ids[idindex-(x-1)-(y-1)*(widthX[2]-widthX[1])];
+ editor.uifunctions.locToPos(startLoc); //重置editor.pos
+ editor.uivalues.tileSize = [x, y];
+ editor.dom.dataSelection.style.left = pos0.x * 32 + 'px';
+ editor.dom.dataSelection.style.top = pos0.y * ysize + 'px';
+ editor.dom.dataSelection.style.height = ysize*y - 6 + 'px';
+ editor.dom.dataSelection.style.width = 32*x - 6 + 'px';
+ }
+
}
}
diff --git a/_server/editor_ui.js b/_server/editor_ui.js
index cc9588ed..3d528f20 100644
--- a/_server/editor_ui.js
+++ b/_server/editor_ui.js
@@ -30,7 +30,7 @@ editor_ui_wrapper = function (editor) {
'双击事件编辑器的图块可以进行长文本编辑/脚本编辑/地图选点/UI绘制预览等操作',
'ESC或点击空白处可以自动保存当前修改',
'H键可以打开操作帮助哦',
- 'tileset贴图模式可以在地图上拖动来一次绘制一个区域;右键额外素材也可以绑定宽高',
+ 'tileset平铺模式可以在地图上拖动来平铺框选的图形',
'可以拖动地图上的图块和事件,或按Ctrl+C, Ctrl+X和Ctrl+V进行复制,剪切和粘贴,Delete删除',
'Alt+数字键保存图块,数字键读取保存的图块',
];
@@ -236,6 +236,7 @@ editor_ui_wrapper = function (editor) {
throw (err)
}
; printf('地图保存成功');
+ editor.uifunctions.unhighlightSaveFloorButton();
});
}
selectBox.isSelected(false);
@@ -318,6 +319,7 @@ editor_ui_wrapper = function (editor) {
editor.bgmap = JSON.parse(JSON.stringify(data.bgmap));
editor.updateMap();
editor.uivalues.postMapData.push(data);
+ editor.uifunctions.highlightSaveFloorButton();
printf("已撤销此操作,你可能需要重新保存地图。");
}
return;
@@ -332,6 +334,7 @@ editor_ui_wrapper = function (editor) {
editor.bgmap = JSON.parse(JSON.stringify(data.bgmap));
editor.updateMap();
editor.uivalues.preMapData.push(data);
+ editor.uifunctions.highlightSaveFloorButton();
printf("已重做此操作,你可能需要重新保存地图。");
}
return;
@@ -349,6 +352,7 @@ editor_ui_wrapper = function (editor) {
editor.uivalues.copyedInfo = editor.copyFromPos();
editor.clearPos(true, null, function () {
printf('该点事件已剪切');
+ editor.uifunctions.unhighlightSaveFloorButton();
})
return;
}
@@ -366,6 +370,7 @@ editor_ui_wrapper = function (editor) {
throw (err)
}
; printf('粘贴事件成功');
+ editor.uifunctions.unhighlightSaveFloorButton();
editor.drawPosSelection();
});
return;
@@ -373,6 +378,7 @@ editor_ui_wrapper = function (editor) {
// DELETE
if (e.keyCode == 46 && !selectBox.isSelected()) {
editor.clearPos(true);
+ editor.uifunctions.unhighlightSaveFloorButton();
return;
}
// ESC
diff --git a/_server/table/plugins.comment.js b/_server/table/plugins.comment.js
index f012cdc1..059b7e5d 100644
--- a/_server/table/plugins.comment.js
+++ b/_server/table/plugins.comment.js
@@ -26,6 +26,12 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_range": "typeof(thiseval)=='string' || thiseval==null",
"_data": "灯光效果"
},
+ "removeMap": {
+ "_leaf": true,
+ "_type": "textarea",
+ "_range": "typeof(thiseval)=='string' || thiseval==null",
+ "_data": "砍层插件"
+ },
"itemShop": {
"_leaf": true,
"_type": "textarea",
diff --git a/editor-mobile.html b/editor-mobile.html
index df00077d..8bc87798 100644
--- a/editor-mobile.html
+++ b/editor-mobile.html
@@ -386,7 +386,7 @@