diff --git a/_server/editor_file_unsorted.js b/_server/editor_file_unsorted.js index c068a8c4..42509f14 100644 --- a/_server/editor_file_unsorted.js +++ b/_server/editor_file_unsorted.js @@ -452,7 +452,8 @@ editor_file = function (editor, callback) { checkCallback(callback); if (isset(actionList) && actionList.length > 0) { actionList.forEach(function (value) { - value[1] = value[1] + "['" + x + "," + y + "']"; + if(/\['autoEvent'\]\['\d+'\]$/.test(value[1]))value[1]=value[1].replace(/\['\d+'\]$/,function(v){return "['" + x + "," + y + "']"+v}) + else value[1] = value[1] + "['" + x + "," + y + "']"; }); saveSetting('floorloc', actionList, function (err) { callback([err]); @@ -821,7 +822,13 @@ editor_file = function (editor, callback) { if (file == 'floorloc') { actionList.forEach(function (value) { // 检测null/undefined - if (value[2]==null) + if(/\['autoEvent'\]\['\d+,\d+'\]\['\d+'\]$/.test(value[1])){ + var tempvalue=value[1].replace(/\['\d+'\]$/,'') + tempvalue="editor.currentFloorData" +tempvalue + tempvalue=tempvalue+'='+tempvalue+'||{}' + eval(tempvalue) + } + if (value[2]==null && value[0]!=='add') eval("delete editor.currentFloorData" + value[1]); else eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2])); diff --git a/_server/editor_game.js b/_server/editor_game.js index 278dd67e..791c959f 100644 --- a/_server/editor_game.js +++ b/_server/editor_game.js @@ -146,6 +146,9 @@ editor_game_wrapper = function (editor, main, core) { }); editor.currentFloorId = core.status.floorId; editor.currentFloorData = core.floors[core.status.floorId]; + // 补出缺省的数据 + editor.currentFloorData.autoEvent = editor.currentFloorData.autoEvent || {}; + // for (var ii = 0, name; name = ['bgmap', 'fgmap'][ii]; ii++) { var mapArray = editor.currentFloorData[name]; if (!mapArray || JSON.stringify(mapArray) == JSON.stringify([])) {//未设置或空数组 diff --git a/_server/editor_table.js b/_server/editor_table.js index 7d5e07de..1278b30d 100644 --- a/_server/editor_table.js +++ b/_server/editor_table.js @@ -145,6 +145,7 @@ editor_table_wrapper = function (editor) { if (key === '_data') continue; if (cobj[key] instanceof Function) cobj[key] = cobj[key](args); } + vobj = args.vobj; // 标记为_hide的属性不展示 if (cobj._hide) continue; if (!cobj._leaf) { @@ -340,9 +341,19 @@ editor_table_wrapper = function (editor) { var mode = editor.dom.editModeSelect.value; // 1.输入id - var newid = prompt('请输入新项的ID(仅公共事件支持中文ID)'); - if (newid == null || newid.length == 0) { - return; + var newid = '3'; + if (mode == 'loc') { + var ae = editor.currentFloorData.autoEvent[editor_mode.pos.x + ',' + editor_mode.pos.x]; + if (ae != null) { + var testid; + for (testid = 3; Object.hasOwnProperty.call(ae, testid); testid++); // 从3开始是因为comment中设置了始终显示012 + newid = testid + ''; + } + } else { + newid = prompt('请输入新项的ID(仅公共事件支持中文ID)'); + if (newid == null || newid.length == 0) { + return; + } } // 检查commentEvents diff --git a/_server/table/comment.js b/_server/table/comment.js index abbf3b7d..6760fe7b 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -464,6 +464,23 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "textarea", "_range": "thiseval==null||(thiseval instanceof Array)", "_data": "该点不可通行的方向 \n 可以在这里定义该点不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表该点不能往上和左走" + }, + "autoEvent": { + "_type": "object", + "_leaf": false, + "_action": function (args) { + args.vobj=args.vobj||{}; + for(var ii=0;ii<3;ii++){ + args.vobj[ii]=null; + } + }, + "_data": function (key) { + return { + "_leaf": true, + "_type": "textarea", + "_data": "自动事件" + } + } } } } diff --git a/editor-mobile.html b/editor-mobile.html index bd934fde..62e3ec09 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -101,7 +101,7 @@
0,0
diff --git a/editor.html b/editor.html index 6b94af81..bb73df5a 100644 --- a/editor.html +++ b/editor.html @@ -97,7 +97,7 @@0,0