From fa73b47d02530a73ea29d4db315136dc7ac3825d Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Fri, 2 Feb 2024 17:29:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=8B=87=E5=A3=AB=E5=B1=9E?= =?UTF-8?q?=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/game/enemy/damage.ts | 2 +- src/game/enemy/special.ts | 2 +- src/{plugin => }/game/hero.ts | 9 --------- src/game/system.ts | 4 +++- src/plugin/game/index.ts | 2 +- 5 files changed, 6 insertions(+), 13 deletions(-) rename src/{plugin => }/game/hero.ts (94%) diff --git a/src/game/enemy/damage.ts b/src/game/enemy/damage.ts index 4767583..06b0cec 100644 --- a/src/game/enemy/damage.ts +++ b/src/game/enemy/damage.ts @@ -1,4 +1,4 @@ -import { getHeroStatusOf, getHeroStatusOn } from '@/plugin/game/hero'; +import { getHeroStatusOf, getHeroStatusOn } from '@/game/hero'; import { Range, RangeCollection } from '@/plugin/game/range'; import { checkV2, diff --git a/src/game/enemy/special.ts b/src/game/enemy/special.ts index 2db2068..1001c4a 100644 --- a/src/game/enemy/special.ts +++ b/src/game/enemy/special.ts @@ -1,4 +1,4 @@ -import { getHeroStatusOn } from '@/plugin/game/hero'; +import { getHeroStatusOn } from '@/game/hero'; export interface SpecialDeclaration { code: number; diff --git a/src/plugin/game/hero.ts b/src/game/hero.ts similarity index 94% rename from src/plugin/game/hero.ts rename to src/game/hero.ts index 2aa1c0c..0ae6317 100644 --- a/src/plugin/game/hero.ts +++ b/src/game/hero.ts @@ -111,12 +111,3 @@ function getRealStatus( if (typeof s === 'number') s = Math.floor(s); return s; } - -declare global { - interface PluginDeclaration { - hero: { - getHeroStatusOf: typeof getHeroStatusOf; - getHeroStatusOn: typeof getHeroStatusOn; - }; - } -} diff --git a/src/game/system.ts b/src/game/system.ts index eb4e266..67d7d95 100644 --- a/src/game/system.ts +++ b/src/game/system.ts @@ -516,7 +516,9 @@ function rewrite, T = O>( /** * 在渲染进程包裹下执行一段代码,该段代码不会在录像验证中执行,因此里面的内容一定不会引起录像报错 - * 一般特效,或者是ui显示、内容显示、交互监听等内容应当在渲染进程包裹下执行 + * 一般特效,或者是ui显示、内容显示、交互监听等内容应当在渲染进程包裹下执行。 + * 无法获取到执行内容的返回值,因为渲染进程中的值不应当直接出现在游戏进程中,否则很可能导致录像出错, + * 如果需要其返回值,应当直接在函数后面新增内容,而不是在游戏进程中使用 * @param fn 要执行的函数,传入一个参数,表示所有的第三方库,也就是`Mota.Package.requireAll()`的内容 * @param thisArg 函数的执行上下文,即函数中`this`指向 */ diff --git a/src/plugin/game/index.ts b/src/plugin/game/index.ts index e65e0b1..44d4a2e 100644 --- a/src/plugin/game/index.ts +++ b/src/plugin/game/index.ts @@ -6,7 +6,7 @@ import * as replay from './replay'; import * as ui from './ui'; import * as rewrite from './fx/rewrite'; import * as halo from './fx/halo'; -import * as hero from './hero'; +import * as hero from '../../game/hero'; import * as loopMap from './loopMap'; import * as removeMap from './removeMap'; import * as shop from './shop';