diff --git a/_server/editor.js b/_server/editor.js index 54b24e35..252b8e4b 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -608,6 +608,16 @@ editor.prototype.addUsedFlags = function (s) { s.replace(/flag:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, function (s0, s1) { editor.used_flags[s1] = true; return s0; }); + s.replace(/flags\.([a-zA-Z_]\w*)/g, function (s0, s1) { + editor.used_flags[s1] = true; return s0; + }); + if (window.flags) { + for (var s in editor.used_flags) { + if (!(s in window.flags)) { + window.flags[s] = null; + } + } + } } editor.prototype.listen = function () { diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 4b607d10..29630e30 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -687,7 +687,7 @@ function omitedcheckUpdateFunction(event) { var previewBlock = function (b) { var types = [ "previewUI_s", "clearMap_s", "clearMap_1_s", "setAttribute_s", "fillText_s", - "fillBoldText_s", "drawTextContent_s", "fillRect_s", "strokeRect_s", "drawLine_s", + "fillBoldText_s", "fillRect_s", "strokeRect_s", "drawLine_s", "drawArrow_s", "fillPolygon_s", "strokePolygon_s", "fillCircle_s", "strokeCircle_s", "drawImage_s", "drawImage_1_s", "drawIcon_s", "drawBackground_s", "drawSelector_s", "drawSelector_1_s" ]; @@ -965,6 +965,16 @@ function omitedcheckUpdateFunction(event) { } } + // 提供 flags.xxx 补全 + index = content.lastIndexOf("flags."); + if (index >= 0) { + var token = content.substring(index+6); + return Object.keys(editor.used_flags || {}).filter(function (one) { + return one != token && one.startsWith(token) + && /^[a-zA-Z_]\w*$/.test(one); + }).sort(); + } + return []; } diff --git a/_server/editor_file_unsorted.js b/_server/editor_file_unsorted.js index 42509f14..c11bd4d8 100644 --- a/_server/editor_file_unsorted.js +++ b/_server/editor_file_unsorted.js @@ -146,11 +146,15 @@ editor_file = function (editor, callback) { var templateActions = []; var image = info.images; + var bindFaceIds = false; if (image=='autotile') { callback('不能对自动元件进行自动注册!'); return; } + if (image=='npc48' && confirm("你想绑定npc48的朝向么?\n如果是,则会连续四个一组的对npc48的faceIds进行自动绑定。")) { + bindFaceIds = true; + } var c=image.toUpperCase().charAt(0); // terrains id @@ -162,15 +166,20 @@ editor_file = function (editor, callback) { var allIds = []; editor.ids.forEach(function (v) { if (v.images==image) { - allIds[v.y]=true; + allIds[v.y]=v; } }) var per_height = image.endsWith('48')?48:32; + var faceIds = []; // down, left, right, up + var idnum=300; for (var y=0; y