diff --git a/_server/editor.js b/_server/editor.js
index d19e2281..4929f74d 100644
--- a/_server/editor.js
+++ b/_server/editor.js
@@ -188,6 +188,11 @@ editor.prototype.init = function (callback) {
for (var floorId in editor.main.floors) {
editor.addUsedFlags(JSON.stringify(editor.main.floors[floorId]));
}
+ if (events_c12a15a8_c380_4b28_8144_256cba95f760.commonEvent) {
+ for (var name in events_c12a15a8_c380_4b28_8144_256cba95f760.commonEvent) {
+ editor.addUsedFlags(JSON.stringify(events_c12a15a8_c380_4b28_8144_256cba95f760.commonEvent[name]));
+ }
+ }
if (editor.useCompress == null) editor.useCompress = useCompress;
if (Boolean(callback)) callback();
diff --git a/_server/editor_ui.js b/_server/editor_ui.js
index ba99f788..589b19d0 100644
--- a/_server/editor_ui.js
+++ b/_server/editor_ui.js
@@ -484,7 +484,7 @@ editor_ui_wrapper = function (editor) {
uievent.mode = 'searchUsedFlags';
uievent.elements.selectPoint.style.display = 'none';
uievent.elements.yes.style.display = 'none';
- uievent.elements.title.innerText = '搜索变量出现的位置';
+ uievent.elements.title.innerText = '搜索变量';
uievent.elements.selectBackground.style.display = 'none';
uievent.elements.selectFloor.style.display = 'none';
uievent.elements.selectPointBox.style.display = 'none';
@@ -495,7 +495,7 @@ editor_ui_wrapper = function (editor) {
// build flags
var html = "";
- Object.keys(editor.used_flags).forEach(function (v) {
+ Object.keys(editor.used_flags).sort().forEach(function (v) {
v = "flag:" + v;
html += "";
});
@@ -508,13 +508,59 @@ editor_ui_wrapper = function (editor) {
var flag = uievent.elements.usedFlags.value;
var html = "
该变量出现的所有位置如下:
";
- for (var i = 0; i <= 100; ++i) {
- html += "- MT1层(0,0)的events
";
- }
+ var list = uievent._searchUsedFlags(flag);
+ list.forEach(function (v) {
+ var x = "- ";
+ if (v[0] != null) x += v[0] + "层 ";
+ else x += "公共事件 ";
+ x += v[1];
+ if (v[2] != null) x += " 的 (" + v[2] + ") 点";
+ x += "
";
+ html += x;
+ });
html += "
";
uievent.elements.usedFlagList.innerHTML = html;
}
+ var hasUsedFlags = function (obj, flag) {
+ if (obj == null) return false;
+ if (typeof obj != 'string') return hasUsedFlags(JSON.stringify(obj), flag);
+
+ var index = -1, length = flag.length;
+ while (true) {
+ index = obj.indexOf(flag, index + 1);
+ if (index < 0) return false;
+ if (!/^[a-zA-Z0-9_\u4E00-\u9FCC]$/.test(obj.charAt(index + length))) return true;
+ }
+ }
+
+ uievent._searchUsedFlags = function (flag) {
+ var list = [];
+ var events = ["events", "autoEvent", "changeFloor", "afterBattle", "afterGetItem", "afterOpenDoor"]
+ for (var floorId in core.floors) {
+ var floor = core.floors[floorId];
+ if (hasUsedFlags(floor.firstArrive, flag)) list.push([floorId, "firstArrive"]);
+ if (hasUsedFlags(floor.eachArrive, flag)) list.push([floorId, "eachArrive"]);
+ events.forEach(function (e) {
+ if (floor[e]) {
+ for (var loc in floor[e]) {
+ if (hasUsedFlags(floor[e][loc], flag)) {
+ list.push([floorId, e, loc]);
+ }
+ }
+ }
+ });
+ }
+ // 公共事件
+ if (core.events.commonEvent) {
+ for (var name in core.events.commonEvent) {
+ if (hasUsedFlags(core.events.commonEvent[name], flag))
+ list.push([null, name]);
+ }
+ }
+ return list;
+ }
+
editor.constructor.prototype.uievent=uievent;
}
\ No newline at end of file
diff --git a/editor-mobile.html b/editor-mobile.html
index 30b67da4..c059d451 100644
--- a/editor-mobile.html
+++ b/editor-mobile.html
@@ -218,7 +218,8 @@
-
+
+
@@ -538,6 +539,7 @@
+
@@ -545,6 +547,7 @@
diff --git a/editor.html b/editor.html
index 7412a96c..b90c5625 100644
--- a/editor.html
+++ b/editor.html
@@ -521,7 +521,7 @@
-
+
@@ -529,7 +529,7 @@
diff --git a/project/events.js b/project/events.js
index d8559846..57aec84c 100644
--- a/project/events.js
+++ b/project/events.js
@@ -4,7 +4,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
"加点事件": [
{
"type": "comment",
- "text": "通过传参,flag:arg1表示当前应该的加点数值"
+ "text": "通过传参,flag:arg1 表示当前应该的加点数值"
},
{
"type": "choices",
@@ -45,7 +45,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
"毒衰咒处理": [
{
"type": "comment",
- "text": "获得毒衰咒效果,flag:arg1为要获得的类型"
+ "text": "获得毒衰咒效果,flag:arg1 为要获得的类型"
},
{
"type": "switch",