editor.used_flags
This commit is contained in:
parent
90fc42fc31
commit
b138d0a157
@ -98,6 +98,12 @@ editor.prototype.init = function (callback) {
|
||||
editor_multi = editor_multi();
|
||||
editor_blockly = editor_blockly();
|
||||
|
||||
// --- 所有用到的flags
|
||||
editor.used_flags = {};
|
||||
for (var floorId in editor.main.floors) {
|
||||
editor.addUsedFlags(JSON.stringify(editor.main.floors[floorId]));
|
||||
}
|
||||
|
||||
if (editor.useCompress == null) editor.useCompress = useCompress;
|
||||
if (Boolean(callback)) callback();
|
||||
|
||||
@ -574,5 +580,10 @@ editor.prototype.clearPos = function (clearPos, pos, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
editor = new editor();
|
||||
@ -814,12 +814,13 @@ function omitedcheckUpdateFunction(event) {
|
||||
}
|
||||
else if (before.endsWith("item")) {
|
||||
return Object.keys(core.material.items).filter(function (one) {
|
||||
return one.startsWith(token);
|
||||
return one != token && one.startsWith(token);
|
||||
}).sort();
|
||||
}
|
||||
else if (before.endsWith("flag")) {
|
||||
// TODO:提供 flag:xxx 的补全
|
||||
return [];
|
||||
return Object.keys(editor.used_flags || {}).filter(function (one) {
|
||||
return one != token && one.startsWith(token);
|
||||
}).sort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ editor_file = function (editor, callback) {
|
||||
datastr = datastr.join('');
|
||||
alertWhenCompress();
|
||||
fs.writeFile(filename, encode(datastr), 'base64', function (err, data) {
|
||||
editor.addUsedFlags(datastr);
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user