From 394cda8a3cf73ac0374696041b2226b178ee4540 Mon Sep 17 00:00:00 2001
From: unanmed <1319491857@qq.com>
Date: Sat, 31 Dec 2022 21:44:33 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A8=E7=94=BB=E7=9A=84bu?=
 =?UTF-8?q?g?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 public/project/plugins.js       | 30 ++++++++++++++----------------
 src/data/settings.json          | 11 ++++++++++-
 src/plugin/animateController.ts |  2 +-
 src/plugin/pop.ts               |  6 +++++-
 src/plugin/ui/fly.ts            |  9 +++++++++
 5 files changed, 39 insertions(+), 19 deletions(-)
 create mode 100644 src/plugin/ui/fly.ts
diff --git a/public/project/plugins.js b/public/project/plugins.js
index f2684cb..c920c64 100644
--- a/public/project/plugins.js
+++ b/public/project/plugins.js
@@ -4560,13 +4560,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
             var damage = core.status.checkBlock.damage[loc];
             if (damage) {
                 if (!main.replayChecking)
-                    core.addPop(
-                        x * 32 + 12,
-                        y * 32 + 20,
-                        damage,
-                        '#f00',
-                        '#000'
-                    );
+                    core.addPop(x * 32 + 12, y * 32 + 20, damage);
                 core.status.hero.hp -= damage;
                 var text =
                     Object.keys(core.status.checkBlock.type[loc] || {}).join(
@@ -5246,10 +5240,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
                 core.extractBlocks(data);
                 if (data === core.status.floorId) {
                     core.drawMap(data);
-                    core.setWeather(
-                        core.animateFrame.weather.type,
-                        core.animateFrame.weather.level
-                    );
+                    let weather = core.getFlag('__weather__', null);
+                    if (!weather && core.status.thisMap.weather)
+                        weather = core.status.thisMap.weather;
+                    if (weather) core.setWeather(weather[0], weather[1]);
+                    else core.setWeather();
                 }
                 core.updateStatusBar(true, true);
             }
@@ -5435,15 +5430,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
         }
 
         ui.prototype.drawBook = function () {
-            return (core.plugin.bookOpened.value = true);
+            if (!main.replayChecking)
+                return (core.plugin.bookOpened.value = true);
         };
 
         ui.prototype._drawToolbox = function () {
-            return (core.plugin.toolOpened.value = true);
+            if (!core.isReplaying())
+                return (core.plugin.toolOpened.value = true);
         };
 
         ui.prototype._drawEquipbox = function () {
-            return (core.plugin.equipOpened.value = true);
+            if (!core.isReplaying())
+                return (core.plugin.equipOpened.value = true);
         };
 
         control.prototype.updateStatusBar_update = function () {
@@ -5489,13 +5487,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
         };
 
         this.showChapter = function (chapter) {
-            if (main.replayChecking) return;
+            if (core.isReplaying()) return;
             core.plugin.chapterContent.value = chapter;
             core.plugin.chapterShowed.value = true;
         };
 
         this.openSkill = function () {
-            if (main.replayChecking) return;
+            if (core.isReplaying()) return;
             core.plugin.skillOpened.value = true;
         };
     },
diff --git a/src/data/settings.json b/src/data/settings.json
index 7e1237b..2b39f99 100644
--- a/src/data/settings.json
+++ b/src/data/settings.json
@@ -18,6 +18,15 @@
     },
     "autoScale": {
         "text": "自动放缩",
-        "desc": ["开启后,每次进入游戏时会自动缩放游戏画面至合适值。"]
+        "desc": [
+            "开启后,每次进入游戏时会自动缩放游戏画面至合适值。该项只对电脑端有效。",
+            "
",
+            "
",
+            "缩放原则如下:",
+            "
",
+            "1. 首先尝试缩放至最大缩放比例",
+            "
",
+            "2. 如果缩放后游戏画面高度高于页面高度的95%,那么缩小一个缩放比例,否则保持最大比例"
+        ]
     }
 }
diff --git a/src/plugin/animateController.ts b/src/plugin/animateController.ts
index 72c583b..c5beb57 100644
--- a/src/plugin/animateController.ts
+++ b/src/plugin/animateController.ts
@@ -3,7 +3,7 @@ const animation: ((time: number) => void)[] = [];
 let animateTime = 0;
 
 export default function init() {
-    core.registerAnimationFrame('animate', true, time => {
+    core.registerAnimationFrame('animateController', true, time => {
         if (time - animateTime <= core.values.animateSpeed) return;
         for (const fn of animation) {
             fn(time);
diff --git a/src/plugin/pop.ts b/src/plugin/pop.ts
index f828b3c..07d5fb4 100644
--- a/src/plugin/pop.ts
+++ b/src/plugin/pop.ts
@@ -2,6 +2,8 @@
 
 let pop: any[] = [];
 
+let time = 0;
+
 // 插件必须有默认导出,并返回所有外部会用到的函数,所有返回的函数会被转发到core上
 // 并且在这里面完成所有的初始化,函数外部也可以进行初始化,但完全不能涉及到样板相关内容
 export default function init() {
@@ -14,7 +16,8 @@ export default function init() {
 /**
  * 弹出文字
  */
-function popValue() {
+function popValue(t: number) {
+    if (t - time < 15) return;
     let ctx = core.getContextByName('pop')!;
     if (!ctx) ctx = core.createCanvas('pop', 0, 0, core._PX_, core._PY_, 90);
     core.clearMap(ctx);
@@ -41,6 +44,7 @@ function popValue() {
         if (one.frame >= 90) count++;
     });
     if (count > 0) pop.splice(0, count);
+    time = t;
 }
 
 /**
diff --git a/src/plugin/ui/fly.ts b/src/plugin/ui/fly.ts
new file mode 100644
index 0000000..6f13864
--- /dev/null
+++ b/src/plugin/ui/fly.ts
@@ -0,0 +1,9 @@
+export default function init() {
+    return { splitArea };
+}
+
+function splitArea() {}
+
+function getMapData(floorId: FloorIds) {}
+
+function bfs(floorId: FloorIds) {}