From 0679bbb1a53e932453be98093eb08c103304210b Mon Sep 17 00:00:00 2001
From: unanmed <1319491857@qq.com>
Date: Sun, 9 Mar 2025 16:43:59 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20src=20=E9=99=A4=E5=85=A5=E5=8F=A3?=
=?UTF-8?q?=E5=A4=96=E5=85=A8=E9=83=A8=E7=A7=BB=E5=85=A5=20monorepo?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages-user/client-modules/package.json | 3 +
.../client-modules/src}/action/move.ts | 0
.../client-modules/src}/audio/bgm.ts | 0
.../client-modules/src}/audio/decoder.ts | 0
.../client-modules/src}/audio/effect.ts | 0
.../client-modules/src}/audio/index.ts | 0
.../client-modules/src}/audio/player.ts | 0
.../client-modules/src}/audio/sound.ts | 0
.../client-modules/src}/audio/source.ts | 0
.../client-modules/src}/audio/support.ts | 0
.../client-modules/src}/fallback/audio.ts | 0
.../client-modules/src}/fallback/index.ts | 0
.../client-modules/src}/fallback/ui.ts | 0
.../client-modules/src}/fallback/weather.ts | 0
.../client-modules/src}/index.ts | 0
.../client-modules/src}/loader/index.ts | 0
.../client-modules/src}/loader/stream.ts | 0
.../src}/render/components/choices.tsx | 0
.../src}/render/components/icons.tsx | 0
.../src}/render/components/index.ts | 0
.../src}/render/components/misc.tsx | 0
.../src}/render/components/page.tsx | 0
.../src}/render/components/scroll.tsx | 0
.../src}/render/components/textbox.tsx | 0
.../src}/render/components/textboxTyper.ts | 0
.../src}/render/components/tip.tsx | 0
.../src}/render/components/types.ts | 0
.../client-modules/src}/render/index.tsx | 0
.../client-modules/src}/render/shared.ts | 0
.../client-modules/src}/render/ui/index.ts | 0
.../client-modules/src}/render/ui/main.tsx | 0
.../src}/render/ui/settings.tsx | 0
.../src}/render/ui/statusBar.tsx | 0
.../client-modules/src}/render/ui/toolbar.tsx | 0
.../client-modules/src}/render/use.ts | 0
.../client-modules/src}/utils/index.ts | 0
.../client-modules/src}/utils/saves.ts | 0
.../client-modules/src}/weather/cloud.ts | 0
.../client-modules/src}/weather/index.ts | 0
.../client-modules/src}/weather/rain.ts | 0
.../client-modules/src}/weather/snow.ts | 0
.../client-modules/src}/weather/sun.ts | 0
.../client-modules/src}/weather/weather.ts | 0
packages-user/data-fallback/src/battle.ts | 4 +-
packages-user/data-fallback/src/index.ts | 5 +
packages-user/data-state/src/enemy/damage.ts | 3 +-
.../data-state/src/mechanism/misc.ts | 4 +-
.../data-state/src/mechanism}/skillTree.ts | 2 +-
packages-user/data-utils/src/index.ts | 1 +
.../data-utils/src}/utils.ts | 0
packages-user/entry-client/package.json | 6 +-
packages-user/entry-client/src/create.ts | 4 +
packages-user/entry-client/src/index.ts | 6 +-
packages-user/entry-data/package.json | 9 +-
packages-user/entry-data/src/create.ts | 14 ++
packages-user/entry-data/src/index.ts | 4 +
packages-user/entry-data/src/mota.ts | 16 ++-
.../legacy-plugin-client/package.json | 6 +
.../legacy-plugin-client/src}/boss/barrage.ts | 2 +-
.../legacy-plugin-client/src}/boss/index.ts | 0
.../src}/boss/palaceBoss.ts | 2 +-
.../src}/boss/palaceBossProjectile.ts | 2 +-
.../src}/boss/towerBoss.ts | 2 +-
.../src}/boss/towerBossProjectile.ts | 2 +-
.../legacy-plugin-client/src}/chase/chase.ts | 2 +-
.../legacy-plugin-client/src}/chase/chase1.ts | 0
.../legacy-plugin-client/src}/chase/index.ts | 0
.../legacy-plugin-client/src}/fallback.ts | 0
.../legacy-plugin-client/src}/fx/frag.ts | 64 ++++-----
.../src}/fx/gameCanvas.ts | 0
.../legacy-plugin-client/src}/fx/halo.ts | 0
.../legacy-plugin-client/src/fx/index.ts | 6 +
.../src}/fx/itemDetail.ts | 0
.../src}/fx/pointShader.ts | 0
.../legacy-plugin-client/src}/fx/pop.ts | 0
.../legacy-plugin-client/src}/fx/portal.ts | 2 +-
.../legacy-plugin-client/src/index.ts | 6 +
.../legacy-plugin-client/src}/loopMap.ts | 0
packages-user/legacy-plugin-data/package.json | 7 +
.../legacy-plugin-data/src}/chase.ts | 0
.../legacy-plugin-data/src/dev/hotReload.ts | 3 +-
.../src}/enemy/checkblock.ts | 0
.../legacy-plugin-data/src/enemy/index.ts | 6 +
.../src}/enemy/remainEnemy.ts | 0
.../legacy-plugin-data/src}/fallback.ts | 10 +-
.../legacy-plugin-data/src}/fiveLayer.ts | 2 +-
.../legacy-plugin-data/src/fx/index.ts | 5 +
.../legacy-plugin-data/src}/fx/itemDetail.ts | 2 +-
packages-user/legacy-plugin-data/src/hook.ts | 65 +++++++++
packages-user/legacy-plugin-data/src/index.ts | 25 ++++
.../legacy-plugin-data/src}/removeMap.ts | 0
.../legacy-plugin-data/src}/replay.ts | 7 +-
.../legacy-plugin-data/src}/shop.ts | 0
.../legacy-plugin-data/src}/skill.ts | 0
.../legacy-plugin-data/src}/ui.ts | 2 +-
packages/legacy-ui/src/index.ts | 2 +
pnpm-lock.yaml | 131 +++++++++++-------
src/main.ts | 6 +-
src/package.json | 19 +--
src/plugin/game/hook.ts | 63 ---------
src/plugin/game/index.ts | 50 -------
src/plugin/index.ts | 10 --
idea.md => tasks.md | 0
103 files changed, 340 insertions(+), 252 deletions(-)
create mode 100644 packages-user/client-modules/package.json
rename {src/module => packages-user/client-modules/src}/action/move.ts (100%)
rename {src/module => packages-user/client-modules/src}/audio/bgm.ts (100%)
rename {src/module => packages-user/client-modules/src}/audio/decoder.ts (100%)
rename {src/module => packages-user/client-modules/src}/audio/effect.ts (100%)
rename {src/module => packages-user/client-modules/src}/audio/index.ts (100%)
rename {src/module => packages-user/client-modules/src}/audio/player.ts (100%)
rename {src/module => packages-user/client-modules/src}/audio/sound.ts (100%)
rename {src/module => packages-user/client-modules/src}/audio/source.ts (100%)
rename {src/module => packages-user/client-modules/src}/audio/support.ts (100%)
rename {src/module => packages-user/client-modules/src}/fallback/audio.ts (100%)
rename {src/module => packages-user/client-modules/src}/fallback/index.ts (100%)
rename {src/module => packages-user/client-modules/src}/fallback/ui.ts (100%)
rename {src/module => packages-user/client-modules/src}/fallback/weather.ts (100%)
rename {src/module => packages-user/client-modules/src}/index.ts (100%)
rename {src/module => packages-user/client-modules/src}/loader/index.ts (100%)
rename {src/module => packages-user/client-modules/src}/loader/stream.ts (100%)
rename {src/module => packages-user/client-modules/src}/render/components/choices.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/components/icons.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/components/index.ts (100%)
rename {src/module => packages-user/client-modules/src}/render/components/misc.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/components/page.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/components/scroll.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/components/textbox.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/components/textboxTyper.ts (100%)
rename {src/module => packages-user/client-modules/src}/render/components/tip.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/components/types.ts (100%)
rename {src/module => packages-user/client-modules/src}/render/index.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/shared.ts (100%)
rename {src/module => packages-user/client-modules/src}/render/ui/index.ts (100%)
rename {src/module => packages-user/client-modules/src}/render/ui/main.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/ui/settings.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/ui/statusBar.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/ui/toolbar.tsx (100%)
rename {src/module => packages-user/client-modules/src}/render/use.ts (100%)
rename {src/module => packages-user/client-modules/src}/utils/index.ts (100%)
rename {src/module => packages-user/client-modules/src}/utils/saves.ts (100%)
rename {src/module => packages-user/client-modules/src}/weather/cloud.ts (100%)
rename {src/module => packages-user/client-modules/src}/weather/index.ts (100%)
rename {src/module => packages-user/client-modules/src}/weather/rain.ts (100%)
rename {src/module => packages-user/client-modules/src}/weather/snow.ts (100%)
rename {src/module => packages-user/client-modules/src}/weather/sun.ts (100%)
rename {src/module => packages-user/client-modules/src}/weather/weather.ts (100%)
rename {src/plugin/game => packages-user/data-state/src/mechanism}/skillTree.ts (99%)
rename {src/plugin/game => packages-user/data-utils/src}/utils.ts (100%)
create mode 100644 packages-user/entry-data/src/create.ts
create mode 100644 packages-user/legacy-plugin-client/package.json
rename {src/plugin => packages-user/legacy-plugin-client/src}/boss/barrage.ts (99%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/boss/index.ts (100%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/boss/palaceBoss.ts (98%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/boss/palaceBossProjectile.ts (99%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/boss/towerBoss.ts (99%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/boss/towerBossProjectile.ts (99%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/chase/chase.ts (99%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/chase/chase1.ts (100%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/chase/index.ts (100%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/fallback.ts (100%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/fx/frag.ts (78%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/fx/gameCanvas.ts (100%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/fx/halo.ts (100%)
create mode 100644 packages-user/legacy-plugin-client/src/fx/index.ts
rename {src/plugin => packages-user/legacy-plugin-client/src}/fx/itemDetail.ts (100%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/fx/pointShader.ts (100%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/fx/pop.ts (100%)
rename {src/plugin => packages-user/legacy-plugin-client/src}/fx/portal.ts (99%)
create mode 100644 packages-user/legacy-plugin-client/src/index.ts
rename {src/plugin => packages-user/legacy-plugin-client/src}/loopMap.ts (100%)
create mode 100644 packages-user/legacy-plugin-data/package.json
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/chase.ts (100%)
rename src/plugin/game/dev/hotReload.js => packages-user/legacy-plugin-data/src/dev/hotReload.ts (98%)
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/enemy/checkblock.ts (100%)
create mode 100644 packages-user/legacy-plugin-data/src/enemy/index.ts
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/enemy/remainEnemy.ts (100%)
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/fallback.ts (98%)
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/fiveLayer.ts (99%)
create mode 100644 packages-user/legacy-plugin-data/src/fx/index.ts
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/fx/itemDetail.ts (98%)
create mode 100644 packages-user/legacy-plugin-data/src/hook.ts
create mode 100644 packages-user/legacy-plugin-data/src/index.ts
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/removeMap.ts (100%)
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/replay.ts (98%)
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/shop.ts (100%)
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/skill.ts (100%)
rename {src/plugin/game => packages-user/legacy-plugin-data/src}/ui.ts (98%)
delete mode 100644 src/plugin/game/hook.ts
delete mode 100644 src/plugin/game/index.ts
delete mode 100644 src/plugin/index.ts
rename idea.md => tasks.md (100%)
diff --git a/packages-user/client-modules/package.json b/packages-user/client-modules/package.json
new file mode 100644
index 0000000..0b2c805
--- /dev/null
+++ b/packages-user/client-modules/package.json
@@ -0,0 +1,3 @@
+{
+ "name": "@user/client-modules"
+}
\ No newline at end of file
diff --git a/src/module/action/move.ts b/packages-user/client-modules/src/action/move.ts
similarity index 100%
rename from src/module/action/move.ts
rename to packages-user/client-modules/src/action/move.ts
diff --git a/src/module/audio/bgm.ts b/packages-user/client-modules/src/audio/bgm.ts
similarity index 100%
rename from src/module/audio/bgm.ts
rename to packages-user/client-modules/src/audio/bgm.ts
diff --git a/src/module/audio/decoder.ts b/packages-user/client-modules/src/audio/decoder.ts
similarity index 100%
rename from src/module/audio/decoder.ts
rename to packages-user/client-modules/src/audio/decoder.ts
diff --git a/src/module/audio/effect.ts b/packages-user/client-modules/src/audio/effect.ts
similarity index 100%
rename from src/module/audio/effect.ts
rename to packages-user/client-modules/src/audio/effect.ts
diff --git a/src/module/audio/index.ts b/packages-user/client-modules/src/audio/index.ts
similarity index 100%
rename from src/module/audio/index.ts
rename to packages-user/client-modules/src/audio/index.ts
diff --git a/src/module/audio/player.ts b/packages-user/client-modules/src/audio/player.ts
similarity index 100%
rename from src/module/audio/player.ts
rename to packages-user/client-modules/src/audio/player.ts
diff --git a/src/module/audio/sound.ts b/packages-user/client-modules/src/audio/sound.ts
similarity index 100%
rename from src/module/audio/sound.ts
rename to packages-user/client-modules/src/audio/sound.ts
diff --git a/src/module/audio/source.ts b/packages-user/client-modules/src/audio/source.ts
similarity index 100%
rename from src/module/audio/source.ts
rename to packages-user/client-modules/src/audio/source.ts
diff --git a/src/module/audio/support.ts b/packages-user/client-modules/src/audio/support.ts
similarity index 100%
rename from src/module/audio/support.ts
rename to packages-user/client-modules/src/audio/support.ts
diff --git a/src/module/fallback/audio.ts b/packages-user/client-modules/src/fallback/audio.ts
similarity index 100%
rename from src/module/fallback/audio.ts
rename to packages-user/client-modules/src/fallback/audio.ts
diff --git a/src/module/fallback/index.ts b/packages-user/client-modules/src/fallback/index.ts
similarity index 100%
rename from src/module/fallback/index.ts
rename to packages-user/client-modules/src/fallback/index.ts
diff --git a/src/module/fallback/ui.ts b/packages-user/client-modules/src/fallback/ui.ts
similarity index 100%
rename from src/module/fallback/ui.ts
rename to packages-user/client-modules/src/fallback/ui.ts
diff --git a/src/module/fallback/weather.ts b/packages-user/client-modules/src/fallback/weather.ts
similarity index 100%
rename from src/module/fallback/weather.ts
rename to packages-user/client-modules/src/fallback/weather.ts
diff --git a/src/module/index.ts b/packages-user/client-modules/src/index.ts
similarity index 100%
rename from src/module/index.ts
rename to packages-user/client-modules/src/index.ts
diff --git a/src/module/loader/index.ts b/packages-user/client-modules/src/loader/index.ts
similarity index 100%
rename from src/module/loader/index.ts
rename to packages-user/client-modules/src/loader/index.ts
diff --git a/src/module/loader/stream.ts b/packages-user/client-modules/src/loader/stream.ts
similarity index 100%
rename from src/module/loader/stream.ts
rename to packages-user/client-modules/src/loader/stream.ts
diff --git a/src/module/render/components/choices.tsx b/packages-user/client-modules/src/render/components/choices.tsx
similarity index 100%
rename from src/module/render/components/choices.tsx
rename to packages-user/client-modules/src/render/components/choices.tsx
diff --git a/src/module/render/components/icons.tsx b/packages-user/client-modules/src/render/components/icons.tsx
similarity index 100%
rename from src/module/render/components/icons.tsx
rename to packages-user/client-modules/src/render/components/icons.tsx
diff --git a/src/module/render/components/index.ts b/packages-user/client-modules/src/render/components/index.ts
similarity index 100%
rename from src/module/render/components/index.ts
rename to packages-user/client-modules/src/render/components/index.ts
diff --git a/src/module/render/components/misc.tsx b/packages-user/client-modules/src/render/components/misc.tsx
similarity index 100%
rename from src/module/render/components/misc.tsx
rename to packages-user/client-modules/src/render/components/misc.tsx
diff --git a/src/module/render/components/page.tsx b/packages-user/client-modules/src/render/components/page.tsx
similarity index 100%
rename from src/module/render/components/page.tsx
rename to packages-user/client-modules/src/render/components/page.tsx
diff --git a/src/module/render/components/scroll.tsx b/packages-user/client-modules/src/render/components/scroll.tsx
similarity index 100%
rename from src/module/render/components/scroll.tsx
rename to packages-user/client-modules/src/render/components/scroll.tsx
diff --git a/src/module/render/components/textbox.tsx b/packages-user/client-modules/src/render/components/textbox.tsx
similarity index 100%
rename from src/module/render/components/textbox.tsx
rename to packages-user/client-modules/src/render/components/textbox.tsx
diff --git a/src/module/render/components/textboxTyper.ts b/packages-user/client-modules/src/render/components/textboxTyper.ts
similarity index 100%
rename from src/module/render/components/textboxTyper.ts
rename to packages-user/client-modules/src/render/components/textboxTyper.ts
diff --git a/src/module/render/components/tip.tsx b/packages-user/client-modules/src/render/components/tip.tsx
similarity index 100%
rename from src/module/render/components/tip.tsx
rename to packages-user/client-modules/src/render/components/tip.tsx
diff --git a/src/module/render/components/types.ts b/packages-user/client-modules/src/render/components/types.ts
similarity index 100%
rename from src/module/render/components/types.ts
rename to packages-user/client-modules/src/render/components/types.ts
diff --git a/src/module/render/index.tsx b/packages-user/client-modules/src/render/index.tsx
similarity index 100%
rename from src/module/render/index.tsx
rename to packages-user/client-modules/src/render/index.tsx
diff --git a/src/module/render/shared.ts b/packages-user/client-modules/src/render/shared.ts
similarity index 100%
rename from src/module/render/shared.ts
rename to packages-user/client-modules/src/render/shared.ts
diff --git a/src/module/render/ui/index.ts b/packages-user/client-modules/src/render/ui/index.ts
similarity index 100%
rename from src/module/render/ui/index.ts
rename to packages-user/client-modules/src/render/ui/index.ts
diff --git a/src/module/render/ui/main.tsx b/packages-user/client-modules/src/render/ui/main.tsx
similarity index 100%
rename from src/module/render/ui/main.tsx
rename to packages-user/client-modules/src/render/ui/main.tsx
diff --git a/src/module/render/ui/settings.tsx b/packages-user/client-modules/src/render/ui/settings.tsx
similarity index 100%
rename from src/module/render/ui/settings.tsx
rename to packages-user/client-modules/src/render/ui/settings.tsx
diff --git a/src/module/render/ui/statusBar.tsx b/packages-user/client-modules/src/render/ui/statusBar.tsx
similarity index 100%
rename from src/module/render/ui/statusBar.tsx
rename to packages-user/client-modules/src/render/ui/statusBar.tsx
diff --git a/src/module/render/ui/toolbar.tsx b/packages-user/client-modules/src/render/ui/toolbar.tsx
similarity index 100%
rename from src/module/render/ui/toolbar.tsx
rename to packages-user/client-modules/src/render/ui/toolbar.tsx
diff --git a/src/module/render/use.ts b/packages-user/client-modules/src/render/use.ts
similarity index 100%
rename from src/module/render/use.ts
rename to packages-user/client-modules/src/render/use.ts
diff --git a/src/module/utils/index.ts b/packages-user/client-modules/src/utils/index.ts
similarity index 100%
rename from src/module/utils/index.ts
rename to packages-user/client-modules/src/utils/index.ts
diff --git a/src/module/utils/saves.ts b/packages-user/client-modules/src/utils/saves.ts
similarity index 100%
rename from src/module/utils/saves.ts
rename to packages-user/client-modules/src/utils/saves.ts
diff --git a/src/module/weather/cloud.ts b/packages-user/client-modules/src/weather/cloud.ts
similarity index 100%
rename from src/module/weather/cloud.ts
rename to packages-user/client-modules/src/weather/cloud.ts
diff --git a/src/module/weather/index.ts b/packages-user/client-modules/src/weather/index.ts
similarity index 100%
rename from src/module/weather/index.ts
rename to packages-user/client-modules/src/weather/index.ts
diff --git a/src/module/weather/rain.ts b/packages-user/client-modules/src/weather/rain.ts
similarity index 100%
rename from src/module/weather/rain.ts
rename to packages-user/client-modules/src/weather/rain.ts
diff --git a/src/module/weather/snow.ts b/packages-user/client-modules/src/weather/snow.ts
similarity index 100%
rename from src/module/weather/snow.ts
rename to packages-user/client-modules/src/weather/snow.ts
diff --git a/src/module/weather/sun.ts b/packages-user/client-modules/src/weather/sun.ts
similarity index 100%
rename from src/module/weather/sun.ts
rename to packages-user/client-modules/src/weather/sun.ts
diff --git a/src/module/weather/weather.ts b/packages-user/client-modules/src/weather/weather.ts
similarity index 100%
rename from src/module/weather/weather.ts
rename to packages-user/client-modules/src/weather/weather.ts
diff --git a/packages-user/data-fallback/src/battle.ts b/packages-user/data-fallback/src/battle.ts
index 48b2723..fcf9220 100644
--- a/packages-user/data-fallback/src/battle.ts
+++ b/packages-user/data-fallback/src/battle.ts
@@ -16,7 +16,7 @@ export interface CurrentEnemy {
onMapEnemy: DamageEnemy[];
}
-function init() {
+export function patchBattle() {
const patch = new Patch(PatchClass.Enemys);
patch.add('canBattle', function (x, y, floorId) {
@@ -252,7 +252,7 @@ function init() {
hook.emit('afterBattle', enemy, x, y);
};
}
-loading.once('coreInit', init);
+loading.once('coreInit', patchBattle);
declare global {
interface Enemys {
diff --git a/packages-user/data-fallback/src/index.ts b/packages-user/data-fallback/src/index.ts
index e69de29..ff2815a 100644
--- a/packages-user/data-fallback/src/index.ts
+++ b/packages-user/data-fallback/src/index.ts
@@ -0,0 +1,5 @@
+import { patchBattle } from './battle';
+
+export function patchAll() {
+ patchBattle();
+}
diff --git a/packages-user/data-state/src/enemy/damage.ts b/packages-user/data-state/src/enemy/damage.ts
index b768676..b17b6c1 100644
--- a/packages-user/data-state/src/enemy/damage.ts
+++ b/packages-user/data-state/src/enemy/damage.ts
@@ -1,6 +1,5 @@
import { getHeroStatusOf, getHeroStatusOn } from '../state/hero';
-import { Range } from '@user/data-utils';
-import { ensureArray, has, manhattan } from '@/plugin/game/utils';
+import { Range, ensureArray, has, manhattan } from '@user/data-utils';
import EventEmitter from 'eventemitter3';
import { hook } from '@user/data-base';
import { HeroSkill, NightSpecial } from '../mechanism/misc';
diff --git a/packages-user/data-state/src/mechanism/misc.ts b/packages-user/data-state/src/mechanism/misc.ts
index 12d91f0..ef2108b 100644
--- a/packages-user/data-state/src/mechanism/misc.ts
+++ b/packages-user/data-state/src/mechanism/misc.ts
@@ -1,7 +1,7 @@
-import { backDir, has } from '@/plugin/game/utils';
+import { backDir, has } from '@user/data-utils';
import { loading } from '@user/data-base';
import type { LayerDoorAnimate } from '@motajs/render';
-import { getSkillLevel } from '@/plugin/game/skillTree';
+import { getSkillLevel } from './skillTree';
/**
* 一些零散机制的数据
diff --git a/src/plugin/game/skillTree.ts b/packages-user/data-state/src/mechanism/skillTree.ts
similarity index 99%
rename from src/plugin/game/skillTree.ts
rename to packages-user/data-state/src/mechanism/skillTree.ts
index 29374b9..2c91c0a 100644
--- a/src/plugin/game/skillTree.ts
+++ b/packages-user/data-state/src/mechanism/skillTree.ts
@@ -1,4 +1,4 @@
-import { HeroSkill } from '@/game/mechanism/misc';
+import { HeroSkill } from './misc';
let levels: number[] = [];
diff --git a/packages-user/data-utils/src/index.ts b/packages-user/data-utils/src/index.ts
index f298acd..43ce4e4 100644
--- a/packages-user/data-utils/src/index.ts
+++ b/packages-user/data-utils/src/index.ts
@@ -1 +1,2 @@
export * from './range';
+export * from './utils';
diff --git a/src/plugin/game/utils.ts b/packages-user/data-utils/src/utils.ts
similarity index 100%
rename from src/plugin/game/utils.ts
rename to packages-user/data-utils/src/utils.ts
diff --git a/packages-user/entry-client/package.json b/packages-user/entry-client/package.json
index 97707e0..cbb54fd 100644
--- a/packages-user/entry-client/package.json
+++ b/packages-user/entry-client/package.json
@@ -1,5 +1,5 @@
{
- "name": "@motajs/entry-client",
+ "name": "@user/entry-client",
"dependencies": {
"@motajs/client": "workspace:*",
"@motajs/client-base": "workspace:*",
@@ -16,6 +16,8 @@
"@motajs/legacy-client": "workspace:*",
"@motajs/legacy-data": "workspace:*",
"@motajs/legacy-ui": "workspace:*",
- "@motajs/legacy-system": "workspace:*"
+ "@motajs/legacy-system": "workspace:*",
+ "@user/client-modules": "workspace:*",
+ "@user/legacy-plugin-client": "workspace:*"
}
}
\ No newline at end of file
diff --git a/packages-user/entry-client/src/create.ts b/packages-user/entry-client/src/create.ts
index cef727a..e4efbfd 100644
--- a/packages-user/entry-client/src/create.ts
+++ b/packages-user/entry-client/src/create.ts
@@ -14,6 +14,8 @@ import * as RenderVue from '@motajs/render-vue';
import * as System from '@motajs/system';
import * as SystemAction from '@motajs/system-action';
import * as SystemUI from '@motajs/system-ui';
+import * as ClientModules from '@user/client-modules';
+import * as LegacyPluginClient from '@user/legacy-plugin-client';
export function create() {
Mota.register('@motajs/client', Client);
@@ -31,4 +33,6 @@ export function create() {
Mota.register('@motajs/system', System);
Mota.register('@motajs/system-action', SystemAction);
Mota.register('@motajs/system-ui', SystemUI);
+ Mota.register('@user/client-modules', ClientModules);
+ Mota.register('@user/legacy-plugin-client', LegacyPluginClient);
}
diff --git a/packages-user/entry-client/src/index.ts b/packages-user/entry-client/src/index.ts
index 1e03cce..3f58b4d 100644
--- a/packages-user/entry-client/src/index.ts
+++ b/packages-user/entry-client/src/index.ts
@@ -1 +1,5 @@
-export * from './create';
+import { create } from './create';
+
+export function createGame() {
+ create();
+}
diff --git a/packages-user/entry-data/package.json b/packages-user/entry-data/package.json
index 35b3d3e..14d95bf 100644
--- a/packages-user/entry-data/package.json
+++ b/packages-user/entry-data/package.json
@@ -1,3 +1,10 @@
{
- "name": "@user/entry-data"
+ "name": "@user/entry-data",
+ "dependencies": {
+ "@user/data-base": "workspace:*",
+ "@user/data-fallback": "workspace:*",
+ "@user/data-state": "workspace:*",
+ "@user/data-utils": "workspace:*",
+ "@user/legacy-plugin-data": "workspace:*"
+ }
}
\ No newline at end of file
diff --git a/packages-user/entry-data/src/create.ts b/packages-user/entry-data/src/create.ts
new file mode 100644
index 0000000..c099666
--- /dev/null
+++ b/packages-user/entry-data/src/create.ts
@@ -0,0 +1,14 @@
+import { Mota } from './mota';
+import * as DataBase from '@user/data-base';
+import * as DataFallback from '@user/data-fallback';
+import * as DataState from '@user/data-state';
+import * as DataUtils from '@user/data-utils';
+import * as LegacyPluginData from '@user/legacy-plugin-data';
+
+export function create() {
+ Mota.register('@user/data-base', DataBase);
+ Mota.register('@user/data-fallback', DataFallback);
+ Mota.register('@user/data-state', DataState);
+ Mota.register('@user/data-utils', DataUtils);
+ Mota.register('@user/legacy-plugin-data', LegacyPluginData);
+}
diff --git a/packages-user/entry-data/src/index.ts b/packages-user/entry-data/src/index.ts
index 2d3bd59..c07228f 100644
--- a/packages-user/entry-data/src/index.ts
+++ b/packages-user/entry-data/src/index.ts
@@ -1,5 +1,9 @@
+import { patchAll } from '@user/data-fallback';
import { createMota } from './mota';
+import { create } from './create';
createMota();
+patchAll();
+create();
export * from './mota';
diff --git a/packages-user/entry-data/src/mota.ts b/packages-user/entry-data/src/mota.ts
index 2948676..64ddc34 100644
--- a/packages-user/entry-data/src/mota.ts
+++ b/packages-user/entry-data/src/mota.ts
@@ -13,6 +13,13 @@ import type * as RenderVue from '@motajs/render-vue';
import type * as System from '@motajs/system';
import type * as SystemAction from '@motajs/system-action';
import type * as SystemUI from '@motajs/system-ui';
+import type * as ClientModules from '@user/client-modules';
+import type * as DataBase from '@user/data-base';
+import type * as DataFallback from '@user/data-fallback';
+import type * as DataState from '@user/data-state';
+import type * as DataUtils from '@user/data-utils';
+import type * as LegacyPluginClient from '@user/legacy-plugin-client';
+import type * as LegacyPluginData from '@user/legacy-plugin-data';
interface ModuleInterface {
'@motajs/client': typeof Client;
@@ -30,6 +37,13 @@ interface ModuleInterface {
'@motajs/system': typeof System;
'@motajs/system-action': typeof SystemAction;
'@motajs/system-ui': typeof SystemUI;
+ '@user/client-modules': typeof ClientModules;
+ '@user/data-base': typeof DataBase;
+ '@user/data-fallback': typeof DataFallback;
+ '@user/data-state': typeof DataState;
+ '@user/data-utils': typeof DataUtils;
+ '@user/legacy-plugin-client': typeof LegacyPluginClient;
+ '@user/legacy-plugin-data': typeof LegacyPluginData;
}
export interface IMota {
@@ -137,7 +151,7 @@ declare global {
}
}
-export const Mota = new MotaSystem();
+export const Mota: IMota = new MotaSystem();
export function createMota() {
window.Mota = Mota;
diff --git a/packages-user/legacy-plugin-client/package.json b/packages-user/legacy-plugin-client/package.json
new file mode 100644
index 0000000..9d3df1b
--- /dev/null
+++ b/packages-user/legacy-plugin-client/package.json
@@ -0,0 +1,6 @@
+{
+ "name": "@user/legacy-plugin-client",
+ "dependencies": {
+ "@user/data-state": "workspace:*"
+ }
+}
\ No newline at end of file
diff --git a/src/plugin/boss/barrage.ts b/packages-user/legacy-plugin-client/src/boss/barrage.ts
similarity index 99%
rename from src/plugin/boss/barrage.ts
rename to packages-user/legacy-plugin-client/src/boss/barrage.ts
index ee22b41..7d5d31e 100644
--- a/src/plugin/boss/barrage.ts
+++ b/packages-user/legacy-plugin-client/src/boss/barrage.ts
@@ -4,7 +4,7 @@ import {
RenderItemPosition,
Transform
} from '@motajs/render';
-import { IStateDamageable } from '@/game/state/interface';
+import { IStateDamageable } from '@user/data-state';
import EventEmitter from 'eventemitter3';
import { Ticker } from 'mutate-animate';
diff --git a/src/plugin/boss/index.ts b/packages-user/legacy-plugin-client/src/boss/index.ts
similarity index 100%
rename from src/plugin/boss/index.ts
rename to packages-user/legacy-plugin-client/src/boss/index.ts
diff --git a/src/plugin/boss/palaceBoss.ts b/packages-user/legacy-plugin-client/src/boss/palaceBoss.ts
similarity index 98%
rename from src/plugin/boss/palaceBoss.ts
rename to packages-user/legacy-plugin-client/src/boss/palaceBoss.ts
index d816f92..badcb37 100644
--- a/src/plugin/boss/palaceBoss.ts
+++ b/packages-user/legacy-plugin-client/src/boss/palaceBoss.ts
@@ -1,4 +1,4 @@
-import { IStateDamageable } from '@/game/state/interface';
+import { IStateDamageable } from '@user/data-state';
import { BarrageBoss, BossSprite, Hitbox } from './barrage';
import {
Container,
diff --git a/src/plugin/boss/palaceBossProjectile.ts b/packages-user/legacy-plugin-client/src/boss/palaceBossProjectile.ts
similarity index 99%
rename from src/plugin/boss/palaceBossProjectile.ts
rename to packages-user/legacy-plugin-client/src/boss/palaceBossProjectile.ts
index 5cd0938..2e93823 100644
--- a/src/plugin/boss/palaceBossProjectile.ts
+++ b/packages-user/legacy-plugin-client/src/boss/palaceBossProjectile.ts
@@ -1,5 +1,5 @@
import { Transform, MotaOffscreenCanvas2D } from '@motajs/render';
-import { IStateDamageable } from '@/game/state/interface';
+import { IStateDamageable } from '@user/data-state';
import { Hitbox, Projectile } from './barrage';
import type { PalaceBoss } from './palaceBoss';
import { clamp } from '@motajs/legacy-ui';
diff --git a/src/plugin/boss/towerBoss.ts b/packages-user/legacy-plugin-client/src/boss/towerBoss.ts
similarity index 99%
rename from src/plugin/boss/towerBoss.ts
rename to packages-user/legacy-plugin-client/src/boss/towerBoss.ts
index cf267d0..1c624a7 100644
--- a/src/plugin/boss/towerBoss.ts
+++ b/packages-user/legacy-plugin-client/src/boss/towerBoss.ts
@@ -21,7 +21,7 @@ import {
ThunderBallProjectile,
ThunderProjectile
} from './towerBossProjectile';
-import { IStateDamageable } from '@/game/state/interface';
+import { IStateDamageable } from '@user/data-state';
import { Pop } from '../fx/pop';
import { WeatherController } from '@/module';
diff --git a/src/plugin/boss/towerBossProjectile.ts b/packages-user/legacy-plugin-client/src/boss/towerBossProjectile.ts
similarity index 99%
rename from src/plugin/boss/towerBossProjectile.ts
rename to packages-user/legacy-plugin-client/src/boss/towerBossProjectile.ts
index 3c046b1..8e98a1e 100644
--- a/src/plugin/boss/towerBossProjectile.ts
+++ b/packages-user/legacy-plugin-client/src/boss/towerBossProjectile.ts
@@ -2,7 +2,7 @@ import { hyper, power, TimingFn } from 'mutate-animate';
import { Hitbox, Projectile } from './barrage';
import { MotaOffscreenCanvas2D, Transform } from '@motajs/render';
import type { TowerBoss } from './towerBoss';
-import { IStateDamageable } from '@/game/state/interface';
+import { IStateDamageable } from '@user/data-state';
import { PointEffect, PointEffectType } from '../fx/pointShader';
import { isNil } from 'lodash-es';
diff --git a/src/plugin/chase/chase.ts b/packages-user/legacy-plugin-client/src/chase/chase.ts
similarity index 99%
rename from src/plugin/chase/chase.ts
rename to packages-user/legacy-plugin-client/src/chase/chase.ts
index edcff02..272fa5a 100644
--- a/src/plugin/chase/chase.ts
+++ b/packages-user/legacy-plugin-client/src/chase/chase.ts
@@ -9,7 +9,7 @@ import {
disableViewport,
enableViewport
} from '@motajs/render';
-import type { HeroMover, MoveStep } from '@/game/state/move';
+import type { HeroMover, MoveStep } from '@user/data-state';
import EventEmitter from 'eventemitter3';
export interface IChaseController {
diff --git a/src/plugin/chase/chase1.ts b/packages-user/legacy-plugin-client/src/chase/chase1.ts
similarity index 100%
rename from src/plugin/chase/chase1.ts
rename to packages-user/legacy-plugin-client/src/chase/chase1.ts
diff --git a/src/plugin/chase/index.ts b/packages-user/legacy-plugin-client/src/chase/index.ts
similarity index 100%
rename from src/plugin/chase/index.ts
rename to packages-user/legacy-plugin-client/src/chase/index.ts
diff --git a/src/plugin/fallback.ts b/packages-user/legacy-plugin-client/src/fallback.ts
similarity index 100%
rename from src/plugin/fallback.ts
rename to packages-user/legacy-plugin-client/src/fallback.ts
diff --git a/src/plugin/fx/frag.ts b/packages-user/legacy-plugin-client/src/fx/frag.ts
similarity index 78%
rename from src/plugin/fx/frag.ts
rename to packages-user/legacy-plugin-client/src/fx/frag.ts
index a0933c9..1431bb4 100644
--- a/src/plugin/fx/frag.ts
+++ b/packages-user/legacy-plugin-client/src/fx/frag.ts
@@ -1,5 +1,5 @@
import { Animation, linear, sleep } from 'mutate-animate';
-import { has } from '@motajs/legacy-ui';
+// import { has } from '@motajs/legacy-ui';
// todo: 移植到渲染树
@@ -28,37 +28,37 @@ const FRAG_TIMING = linear();
export function init() {
return;
- Mota.rewrite(core.events, 'afterBattle', 'add', (_, enemy, x, y) => {
- // 打怪特效
- const setting = Mota.require('var', 'mainSetting');
- if (setting.getValue('fx.frag') && has(x) && has(y)) {
- const frame = core.status.globalAnimateStatus % 2;
- const canvas = document.createElement('canvas');
- canvas.width = 32;
- canvas.height = 32;
- core.drawIcon(canvas, enemy.id, 0, 0, 32, 32, frame);
- const manager = applyFragWith(canvas);
- const frag = manager.canvas;
- frag.style.imageRendering = 'pixelated';
- frag.style.width = `${frag.width * core.domStyle.scale}px`;
- frag.style.height = `${frag.height * core.domStyle.scale}px`;
- const left =
- (x * 32 + 16 - frag.width / 2 - core.bigmap.offsetX) *
- core.domStyle.scale;
- const top =
- (y * 32 + 16 - frag.height / 2 - core.bigmap.offsetY) *
- core.domStyle.scale;
- frag.style.left = `${left}px`;
- frag.style.top = `${top}px`;
- frag.style.zIndex = '45';
- frag.style.position = 'absolute';
- frag.style.filter = 'sepia(20%)brightness(120%)';
- core.dom.gameDraw.appendChild(frag);
- manager.onEnd.then(() => {
- frag.remove();
- });
- }
- });
+ // Mota.rewrite(core.events, 'afterBattle', 'add', (_, enemy, x, y) => {
+ // // 打怪特效
+ // const setting = Mota.require('var', 'mainSetting');
+ // if (setting.getValue('fx.frag') && has(x) && has(y)) {
+ // const frame = core.status.globalAnimateStatus % 2;
+ // const canvas = document.createElement('canvas');
+ // canvas.width = 32;
+ // canvas.height = 32;
+ // core.drawIcon(canvas, enemy.id, 0, 0, 32, 32, frame);
+ // const manager = applyFragWith(canvas);
+ // const frag = manager.canvas;
+ // frag.style.imageRendering = 'pixelated';
+ // frag.style.width = `${frag.width * core.domStyle.scale}px`;
+ // frag.style.height = `${frag.height * core.domStyle.scale}px`;
+ // const left =
+ // (x * 32 + 16 - frag.width / 2 - core.bigmap.offsetX) *
+ // core.domStyle.scale;
+ // const top =
+ // (y * 32 + 16 - frag.height / 2 - core.bigmap.offsetY) *
+ // core.domStyle.scale;
+ // frag.style.left = `${left}px`;
+ // frag.style.top = `${top}px`;
+ // frag.style.zIndex = '45';
+ // frag.style.position = 'absolute';
+ // frag.style.filter = 'sepia(20%)brightness(120%)';
+ // core.dom.gameDraw.appendChild(frag);
+ // manager.onEnd.then(() => {
+ // frag.remove();
+ // });
+ // }
+ // });
}
export function applyFragWith(
diff --git a/src/plugin/fx/gameCanvas.ts b/packages-user/legacy-plugin-client/src/fx/gameCanvas.ts
similarity index 100%
rename from src/plugin/fx/gameCanvas.ts
rename to packages-user/legacy-plugin-client/src/fx/gameCanvas.ts
diff --git a/src/plugin/fx/halo.ts b/packages-user/legacy-plugin-client/src/fx/halo.ts
similarity index 100%
rename from src/plugin/fx/halo.ts
rename to packages-user/legacy-plugin-client/src/fx/halo.ts
diff --git a/packages-user/legacy-plugin-client/src/fx/index.ts b/packages-user/legacy-plugin-client/src/fx/index.ts
new file mode 100644
index 0000000..a3e1a3e
--- /dev/null
+++ b/packages-user/legacy-plugin-client/src/fx/index.ts
@@ -0,0 +1,6 @@
+export * from './gameCanvas';
+export * from './halo';
+export * from './itemDetail';
+export * from './pointShader';
+export * from './pop';
+export * from './portal';
diff --git a/src/plugin/fx/itemDetail.ts b/packages-user/legacy-plugin-client/src/fx/itemDetail.ts
similarity index 100%
rename from src/plugin/fx/itemDetail.ts
rename to packages-user/legacy-plugin-client/src/fx/itemDetail.ts
diff --git a/src/plugin/fx/pointShader.ts b/packages-user/legacy-plugin-client/src/fx/pointShader.ts
similarity index 100%
rename from src/plugin/fx/pointShader.ts
rename to packages-user/legacy-plugin-client/src/fx/pointShader.ts
diff --git a/src/plugin/fx/pop.ts b/packages-user/legacy-plugin-client/src/fx/pop.ts
similarity index 100%
rename from src/plugin/fx/pop.ts
rename to packages-user/legacy-plugin-client/src/fx/pop.ts
diff --git a/src/plugin/fx/portal.ts b/packages-user/legacy-plugin-client/src/fx/portal.ts
similarity index 99%
rename from src/plugin/fx/portal.ts
rename to packages-user/legacy-plugin-client/src/fx/portal.ts
index 0fbd0bd..5ed723b 100644
--- a/src/plugin/fx/portal.ts
+++ b/packages-user/legacy-plugin-client/src/fx/portal.ts
@@ -7,7 +7,7 @@ import {
LayerGroup,
Sprite
} from '@motajs/render';
-import type { BluePalace } from '@/game/mechanism/misc';
+import type { BluePalace } from '@user/data-state';
/** 最大粒子数 */
const MAX_PARTICLES = 10;
diff --git a/packages-user/legacy-plugin-client/src/index.ts b/packages-user/legacy-plugin-client/src/index.ts
new file mode 100644
index 0000000..1d495b7
--- /dev/null
+++ b/packages-user/legacy-plugin-client/src/index.ts
@@ -0,0 +1,6 @@
+export * from './boss';
+export * from './chase';
+export * from './fx';
+
+export * from './fallback';
+export * from './loopMap';
diff --git a/src/plugin/loopMap.ts b/packages-user/legacy-plugin-client/src/loopMap.ts
similarity index 100%
rename from src/plugin/loopMap.ts
rename to packages-user/legacy-plugin-client/src/loopMap.ts
diff --git a/packages-user/legacy-plugin-data/package.json b/packages-user/legacy-plugin-data/package.json
new file mode 100644
index 0000000..2cc08e4
--- /dev/null
+++ b/packages-user/legacy-plugin-data/package.json
@@ -0,0 +1,7 @@
+{
+ "name": "@user/legacy-plugin-data",
+ "dependencies": {
+ "@user/data-state": "workspace:*",
+ "@user/data-base": "workspace:*"
+ }
+}
\ No newline at end of file
diff --git a/src/plugin/game/chase.ts b/packages-user/legacy-plugin-data/src/chase.ts
similarity index 100%
rename from src/plugin/game/chase.ts
rename to packages-user/legacy-plugin-data/src/chase.ts
diff --git a/src/plugin/game/dev/hotReload.js b/packages-user/legacy-plugin-data/src/dev/hotReload.ts
similarity index 98%
rename from src/plugin/game/dev/hotReload.js
rename to packages-user/legacy-plugin-data/src/dev/hotReload.ts
index 0a87723..61475b6 100644
--- a/src/plugin/game/dev/hotReload.js
+++ b/packages-user/legacy-plugin-data/src/dev/hotReload.ts
@@ -1,4 +1,5 @@
-///
+// @ts-nocheck
+
export {};
/* @__PURE__ */ (function () {
diff --git a/src/plugin/game/enemy/checkblock.ts b/packages-user/legacy-plugin-data/src/enemy/checkblock.ts
similarity index 100%
rename from src/plugin/game/enemy/checkblock.ts
rename to packages-user/legacy-plugin-data/src/enemy/checkblock.ts
diff --git a/packages-user/legacy-plugin-data/src/enemy/index.ts b/packages-user/legacy-plugin-data/src/enemy/index.ts
new file mode 100644
index 0000000..15277bf
--- /dev/null
+++ b/packages-user/legacy-plugin-data/src/enemy/index.ts
@@ -0,0 +1,6 @@
+import { init as initCheckBlock } from './checkblock';
+
+initCheckBlock();
+
+export * from './checkblock';
+export * from './remainEnemy';
diff --git a/src/plugin/game/enemy/remainEnemy.ts b/packages-user/legacy-plugin-data/src/enemy/remainEnemy.ts
similarity index 100%
rename from src/plugin/game/enemy/remainEnemy.ts
rename to packages-user/legacy-plugin-data/src/enemy/remainEnemy.ts
diff --git a/src/plugin/game/fallback.ts b/packages-user/legacy-plugin-data/src/fallback.ts
similarity index 98%
rename from src/plugin/game/fallback.ts
rename to packages-user/legacy-plugin-data/src/fallback.ts
index 30c52d2..5d313ba 100644
--- a/src/plugin/game/fallback.ts
+++ b/packages-user/legacy-plugin-data/src/fallback.ts
@@ -9,7 +9,7 @@ import type {
FloorViewport
} from '@motajs/render';
import type { TimingFn } from 'mutate-animate';
-import { BlockMover, heroMoveCollection, MoveStep } from '@/game/state/move';
+import { BlockMover, heroMoveCollection, MoveStep } from '@user/data-state';
// 向后兼容用,会充当两个版本间过渡的作用
@@ -23,13 +23,13 @@ interface Adapters {
const adapters: Adapters = {};
-export function init() {
+export function initFallback() {
const hook = Mota.require('var', 'hook');
const loading = Mota.require('var', 'loading');
let fallbackIds: number = 1e8;
if (!main.replayChecking && main.mode === 'play') {
- const Adapter = Mota.require('module', 'Render').RenderAdapter;
+ const Adapter = Mota.require('@motajs/render').RenderAdapter;
const hero = Adapter.get('hero-adapter');
const doorAnimate = Adapter.get('door-animate');
const animate = Adapter.get('animate');
@@ -88,8 +88,8 @@ export function init() {
Mota.r(() => {
// ----- 引入
- const Camera = Mota.require('module', 'Render').Camera;
- const Renderer = Mota.require('module', 'Render').MotaRenderer;
+ const { Camera, MotaRenderer: Renderer } =
+ Mota.require('@motajs/render');
const Animation = Mota.require('module', 'Animation');
// ----- 勇士移动相关
diff --git a/src/plugin/game/fiveLayer.ts b/packages-user/legacy-plugin-data/src/fiveLayer.ts
similarity index 99%
rename from src/plugin/game/fiveLayer.ts
rename to packages-user/legacy-plugin-data/src/fiveLayer.ts
index 6ff0fa7..d286cd9 100644
--- a/src/plugin/game/fiveLayer.ts
+++ b/packages-user/legacy-plugin-data/src/fiveLayer.ts
@@ -16,7 +16,7 @@ function createCanvas(name, zIndex) {
return canvas;
}
-export function init() {
+export function initFiveLayer() {
// 大地图适配
core.initStatus.bg2maps = {};
diff --git a/packages-user/legacy-plugin-data/src/fx/index.ts b/packages-user/legacy-plugin-data/src/fx/index.ts
new file mode 100644
index 0000000..ae5d386
--- /dev/null
+++ b/packages-user/legacy-plugin-data/src/fx/index.ts
@@ -0,0 +1,5 @@
+import { init as initItemDetail } from './itemDetail';
+
+initItemDetail();
+
+export * from './itemDetail';
diff --git a/src/plugin/game/fx/itemDetail.ts b/packages-user/legacy-plugin-data/src/fx/itemDetail.ts
similarity index 98%
rename from src/plugin/game/fx/itemDetail.ts
rename to packages-user/legacy-plugin-data/src/fx/itemDetail.ts
index 50888c0..5bd1adf 100644
--- a/src/plugin/game/fx/itemDetail.ts
+++ b/packages-user/legacy-plugin-data/src/fx/itemDetail.ts
@@ -1,4 +1,4 @@
-import { EnemyCollection, ensureFloorDamage } from '@/game/enemy/damage';
+import { EnemyCollection, ensureFloorDamage } from '@user/data-state';
import { formatDamage } from '../utils';
export function init() {
diff --git a/packages-user/legacy-plugin-data/src/hook.ts b/packages-user/legacy-plugin-data/src/hook.ts
new file mode 100644
index 0000000..3773ee3
--- /dev/null
+++ b/packages-user/legacy-plugin-data/src/hook.ts
@@ -0,0 +1,65 @@
+import { hook } from '@user/data-base';
+
+const potionItems: AllIdsOf<'items'>[] = [
+ 'redPotion',
+ 'bluePotion',
+ 'yellowPotion',
+ 'greenPotion',
+ 'I482',
+ 'I484',
+ 'I487',
+ 'I491'
+];
+
+export function createHook() {
+ hook.on('afterGetItem', (itemId, x, y, isGentleClick) => {
+ // 获得一个道具后触发的事件
+ // itemId:获得的道具ID;x和y是该道具所在的坐标
+ // isGentleClick:是否是轻按触发的
+ if (potionItems.includes(itemId)) core.playSound('回血');
+ else core.playSound('获得道具');
+
+ const todo: any[] = [];
+ // 检查该点的获得道具后事件。
+ if (core.status.floorId == null) return;
+ const event =
+ core.floors[core.status.floorId].afterGetItem[`${x},${y}`];
+ if (
+ event &&
+ (event instanceof Array ||
+ !isGentleClick ||
+ !event.disableOnGentleClick)
+ ) {
+ core.unshift(todo, event as any[]);
+ }
+ if (core.hasFlag('spring')) {
+ if (!core.hasFlag('springCount')) core.setFlag('springCount', 0);
+ if (potionItems.includes(itemId)) {
+ core.addFlag('springCount', 1);
+ }
+ if (core.getFlag('springCount', 0) === 50) {
+ core.setFlag('springCount', 0);
+ core.status.hero.hpmax += core.getNakedStatus('hpmax') * 0.1;
+ }
+ core.updateStatusBar();
+ }
+
+ if (todo.length > 0) core.insertAction(todo, x, y);
+ });
+
+ hook.on('afterOpenDoor', (doorId, x, y) => {
+ // 开一个门后触发的事件
+
+ const todo: any[] = [];
+ // 检查该点的获得开门后事件。
+ if (core.status.floorId == null) return;
+ const event =
+ core.floors[core.status.floorId].afterOpenDoor[`${x},${y}`];
+ if (event) core.unshift(todo, event as any[]);
+
+ if (todo.length > 0) core.insertAction(todo, x, y);
+
+ if (core.status.event.id == null) core.continueAutomaticRoute();
+ else core.clearContinueAutomaticRoute();
+ });
+}
diff --git a/packages-user/legacy-plugin-data/src/index.ts b/packages-user/legacy-plugin-data/src/index.ts
new file mode 100644
index 0000000..9dce77d
--- /dev/null
+++ b/packages-user/legacy-plugin-data/src/index.ts
@@ -0,0 +1,25 @@
+import { initFallback } from './fallback';
+import { initFiveLayer } from './fiveLayer';
+import { createHook } from './hook';
+import { initReplay } from './replay';
+import { initUI } from './ui';
+
+if (import.meta.env.DEV) {
+ import('./dev/hotReload');
+}
+
+initFallback();
+initFiveLayer();
+createHook();
+initReplay();
+initUI();
+
+export * from './chase';
+export * from './fallback';
+export * from './fiveLayer';
+export * from './removeMap';
+export * from './replay';
+export * from './shop';
+export * from './skill';
+export * from '../../data-state/src/mechanism/skillTree';
+export * from './ui';
diff --git a/src/plugin/game/removeMap.ts b/packages-user/legacy-plugin-data/src/removeMap.ts
similarity index 100%
rename from src/plugin/game/removeMap.ts
rename to packages-user/legacy-plugin-data/src/removeMap.ts
diff --git a/src/plugin/game/replay.ts b/packages-user/legacy-plugin-data/src/replay.ts
similarity index 98%
rename from src/plugin/game/replay.ts
rename to packages-user/legacy-plugin-data/src/replay.ts
index a8fcb8b..b04dfcd 100644
--- a/src/plugin/game/replay.ts
+++ b/packages-user/legacy-plugin-data/src/replay.ts
@@ -1,5 +1,8 @@
import { HeroSkill } from '@/game/mechanism/misc';
-import { getSkillFromIndex, upgradeSkill } from './skillTree';
+import {
+ getSkillFromIndex,
+ upgradeSkill
+} from '../../data-state/src/mechanism/skillTree';
import { canOpenShop } from './shop';
const replayableSettings = ['autoSkill'];
@@ -20,7 +23,7 @@ export function clip(...replace: string[]) {
core.status.route.push(...replace);
}
-export function init() {
+export function initReplay() {
function tipAndWait(content: string, time: number) {
const speed = core.status.replay.speed;
if (main.replayChecking || speed === 24) return Promise.resolve();
diff --git a/src/plugin/game/shop.ts b/packages-user/legacy-plugin-data/src/shop.ts
similarity index 100%
rename from src/plugin/game/shop.ts
rename to packages-user/legacy-plugin-data/src/shop.ts
diff --git a/src/plugin/game/skill.ts b/packages-user/legacy-plugin-data/src/skill.ts
similarity index 100%
rename from src/plugin/game/skill.ts
rename to packages-user/legacy-plugin-data/src/skill.ts
diff --git a/src/plugin/game/ui.ts b/packages-user/legacy-plugin-data/src/ui.ts
similarity index 98%
rename from src/plugin/game/ui.ts
rename to packages-user/legacy-plugin-data/src/ui.ts
index 54de027..811d024 100644
--- a/src/plugin/game/ui.ts
+++ b/packages-user/legacy-plugin-data/src/ui.ts
@@ -1,6 +1,6 @@
// @ts-nocheck
-export function init() {
+export function initUI() {
if (main.mode === 'editor') return;
const { mainUi, fixedUi, mainSetting } = Mota.requireAll('var');
diff --git a/packages/legacy-ui/src/index.ts b/packages/legacy-ui/src/index.ts
index a841522..6c7fcd5 100644
--- a/packages/legacy-ui/src/index.ts
+++ b/packages/legacy-ui/src/index.ts
@@ -1,3 +1,5 @@
+import 'ant-design-vue/dist/antd.dark.css';
+
export * as UI from './ui';
export * as Components from './components';
export * from './preset';
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 69b0bd2..b3f29a0 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -190,6 +190,47 @@ importers:
specifier: ^8.18.0
version: 8.18.0
+ packages-user/client-modules: {}
+
+ packages-user/data-base:
+ dependencies:
+ '@motajs/types':
+ specifier: workspace:*
+ version: link:../../packages/types
+
+ packages-user/data-fallback:
+ dependencies:
+ '@motajs/legacy-common':
+ specifier: workspace:*
+ version: link:../../packages/legacy-common
+ '@user/data-base':
+ specifier: workspace:*
+ version: link:../data-base
+ '@user/data-state':
+ specifier: workspace:*
+ version: link:../data-state
+
+ packages-user/data-state:
+ dependencies:
+ '@motajs/common':
+ specifier: workspace:*
+ version: link:../../packages/common
+ '@motajs/types':
+ specifier: workspace:*
+ version: link:../../packages/types
+ '@user/data-base':
+ specifier: workspace:*
+ version: link:../data-base
+ '@user/data-utils':
+ specifier: workspace:*
+ version: link:../data-utils
+
+ packages-user/data-utils:
+ dependencies:
+ '@user/data-base':
+ specifier: workspace:*
+ version: link:../data-base
+
packages-user/entry-client:
dependencies:
'@motajs/client':
@@ -240,8 +281,45 @@ importers:
'@motajs/system-ui':
specifier: workspace:*
version: link:../../packages/system-ui
+ '@user/client-modules':
+ specifier: workspace:*
+ version: link:../client-modules
+ '@user/legacy-plugin-client':
+ specifier: workspace:*
+ version: link:../legacy-plugin-client
- packages-user/entry-data: {}
+ packages-user/entry-data:
+ dependencies:
+ '@user/data-base':
+ specifier: workspace:*
+ version: link:../data-base
+ '@user/data-fallback':
+ specifier: workspace:*
+ version: link:../data-fallback
+ '@user/data-state':
+ specifier: workspace:*
+ version: link:../data-state
+ '@user/data-utils':
+ specifier: workspace:*
+ version: link:../data-utils
+ '@user/legacy-plugin-data':
+ specifier: workspace:*
+ version: link:../legacy-plugin-data
+
+ packages-user/legacy-plugin-client:
+ dependencies:
+ '@user/data-state':
+ specifier: workspace:*
+ version: link:../data-state
+
+ packages-user/legacy-plugin-data:
+ dependencies:
+ '@user/data-base':
+ specifier: workspace:*
+ version: link:../data-base
+ '@user/data-state':
+ specifier: workspace:*
+ version: link:../data-state
packages/client:
dependencies:
@@ -382,56 +460,13 @@ importers:
specifier: workspace:*
version: link:../render
+ packages/types: {}
+
src:
dependencies:
- '@motajs/client':
+ '@user/entry-client':
specifier: workspace:*
- version: link:../packages/client
- '@motajs/client-base':
- specifier: workspace:*
- version: link:../packages/client-base
- '@motajs/common':
- specifier: workspace:*
- version: link:../packages/common
- '@motajs/legacy-client':
- specifier: workspace:*
- version: link:../packages/legacy-client
- '@motajs/legacy-common':
- specifier: workspace:*
- version: link:../packages/legacy-common
- '@motajs/legacy-data':
- specifier: workspace:*
- version: link:../packages/legacy-data
- '@motajs/legacy-system':
- specifier: workspace:*
- version: link:../packages/legacy-system
- '@motajs/legacy-ui':
- specifier: workspace:*
- version: link:../packages/legacy-ui
- '@motajs/render':
- specifier: workspace:*
- version: link:../packages/render
- '@motajs/render-core':
- specifier: workspace:*
- version: link:../packages/render-core
- '@motajs/render-elements':
- specifier: workspace:*
- version: link:../packages/render-elements
- '@motajs/render-style':
- specifier: workspace:*
- version: link:../packages/render-style
- '@motajs/render-vue':
- specifier: workspace:*
- version: link:../packages/render-vue
- '@motajs/system':
- specifier: workspace:*
- version: link:../packages/system
- '@motajs/system-action':
- specifier: workspace:*
- version: link:../packages/system-action
- '@motajs/system-ui':
- specifier: workspace:*
- version: link:../packages/system-ui
+ version: link:../packages-user/entry-client
packages:
diff --git a/src/main.ts b/src/main.ts
index 2dcc520..61471fd 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,10 +1,12 @@
import { createApp } from 'vue';
-import './game/index';
import App from './App.vue';
import './styles.less';
-import 'ant-design-vue/dist/antd.dark.css';
+import { createGame } from '@user/entry-client';
createApp(App).mount('#root');
+// 创建游戏实例
+createGame();
+
main.init('play');
main.listen();
diff --git a/src/package.json b/src/package.json
index 2cfb618..2529ce8 100644
--- a/src/package.json
+++ b/src/package.json
@@ -1,21 +1,6 @@
{
- "name": "@motajs/user",
+ "name": "@user/main",
"dependencies": {
- "@motajs/client": "workspace:*",
- "@motajs/client-base": "workspace:*",
- "@motajs/common": "workspace:*",
- "@motajs/render": "workspace:*",
- "@motajs/render-core": "workspace:*",
- "@motajs/render-elements": "workspace:*",
- "@motajs/render-style": "workspace:*",
- "@motajs/render-vue": "workspace:*",
- "@motajs/system": "workspace:*",
- "@motajs/system-ui": "workspace:*",
- "@motajs/system-action": "workspace:*",
- "@motajs/legacy-common": "workspace:*",
- "@motajs/legacy-client": "workspace:*",
- "@motajs/legacy-data": "workspace:*",
- "@motajs/legacy-ui": "workspace:*",
- "@motajs/legacy-system": "workspace:*"
+ "@user/entry-client": "workspace:*"
}
}
\ No newline at end of file
diff --git a/src/plugin/game/hook.ts b/src/plugin/game/hook.ts
deleted file mode 100644
index 23486e9..0000000
--- a/src/plugin/game/hook.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { hook } from '@/game/game';
-
-export {};
-
-const potionItems: AllIdsOf<'items'>[] = [
- 'redPotion',
- 'bluePotion',
- 'yellowPotion',
- 'greenPotion',
- 'I482',
- 'I484',
- 'I487',
- 'I491'
-];
-
-hook.on('afterGetItem', (itemId, x, y, isGentleClick) => {
- // 获得一个道具后触发的事件
- // itemId:获得的道具ID;x和y是该道具所在的坐标
- // isGentleClick:是否是轻按触发的
- if (potionItems.includes(itemId)) core.playSound('回血');
- else core.playSound('获得道具');
-
- const todo: any[] = [];
- // 检查该点的获得道具后事件。
- if (core.status.floorId == null) return;
- const event = core.floors[core.status.floorId].afterGetItem[`${x},${y}`];
- if (
- event &&
- (event instanceof Array ||
- !isGentleClick ||
- !event.disableOnGentleClick)
- ) {
- core.unshift(todo, event as any[]);
- }
- if (core.hasFlag('spring')) {
- if (!core.hasFlag('springCount')) core.setFlag('springCount', 0);
- if (potionItems.includes(itemId)) {
- core.addFlag('springCount', 1);
- }
- if (core.getFlag('springCount', 0) === 50) {
- core.setFlag('springCount', 0);
- core.status.hero.hpmax += core.getNakedStatus('hpmax') * 0.1;
- }
- core.updateStatusBar();
- }
-
- if (todo.length > 0) core.insertAction(todo, x, y);
-});
-
-hook.on('afterOpenDoor', (doorId, x, y) => {
- // 开一个门后触发的事件
-
- const todo: any[] = [];
- // 检查该点的获得开门后事件。
- if (core.status.floorId == null) return;
- const event = core.floors[core.status.floorId].afterOpenDoor[`${x},${y}`];
- if (event) core.unshift(todo, event as any[]);
-
- if (todo.length > 0) core.insertAction(todo, x, y);
-
- if (core.status.event.id == null) core.continueAutomaticRoute();
- else core.clearContinueAutomaticRoute();
-});
diff --git a/src/plugin/game/index.ts b/src/plugin/game/index.ts
deleted file mode 100644
index fa3b212..0000000
--- a/src/plugin/game/index.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/* @__PURE__ */ import './dev/hotReload'; // 仅开发会用到
-import * as fiveLayer from './fiveLayer';
-import * as itemDetail from './fx/itemDetail';
-import * as replay from './replay';
-import * as ui from './ui';
-import * as removeMap from './removeMap';
-import * as shop from './shop';
-import * as skill from './skill';
-import * as skillTree from './skillTree';
-import * as utils from './utils';
-import * as chase from './chase';
-import * as remainEnemy from './enemy/remainEnemy';
-import * as checkBlock from './enemy/checkblock';
-import * as fallback from './fallback';
-import './hook';
-
-Mota.Plugin.register('utils_g', utils);
-Mota.Plugin.register('shop_g', shop);
-Mota.Plugin.register('replay_g', replay, replay.init);
-Mota.Plugin.register('skillTree_g', skillTree);
-Mota.Plugin.register('removeMap_g', removeMap);
-Mota.Plugin.register('chase_g', chase);
-Mota.Plugin.register('skill_g', skill);
-Mota.Plugin.register('fiveLayer_g', fiveLayer, fiveLayer.init);
-Mota.Plugin.register('itemDetail_g', itemDetail, itemDetail.init);
-// Mota.Plugin.register('study_g', study);
-Mota.Plugin.register('remainEnemy_g', remainEnemy);
-Mota.Plugin.register('checkBlock_g', checkBlock, checkBlock.init);
-// todo: 这几个不应该放到插件
-Mota.Plugin.register('ui_g', ui, ui.init);
-// 用于暂时向后兼容的插件,若干个版本后会删除
-Mota.Plugin.register('fallback_g', fallback, fallback.init);
-
-// export {
-// halo,
-// hero,
-// loopMap,
-// remainEnemy,
-// removeMap,
-// shop,
-// skill,
-// skillTree,
-// study,
-// towerBoss,
-// utils,
-// chase,
-// damage,
-// battle,
-// special
-// };
diff --git a/src/plugin/index.ts b/src/plugin/index.ts
deleted file mode 100644
index 143da16..0000000
--- a/src/plugin/index.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import * as chase from './chase';
-import * as gameCanvas from './fx/gameCanvas';
-import * as boss from './boss';
-import './loopMap';
-
-Mota.Plugin.register('chase_r', chase);
-Mota.Plugin.register('gameCanvas_r', gameCanvas);
-Mota.Plugin.register('chase_r', chase);
-Mota.Plugin.register('boss_r', boss);
-Mota.Plugin.register('utils_r', utils);
diff --git a/idea.md b/tasks.md
similarity index 100%
rename from idea.md
rename to tasks.md