{isBusy ?
同步中...
: null}
{error ?
{error}
: null}
{run.eventLog.slice(-3).map((event) => (
diff --git a/src/routing/appRoutes.test.ts b/src/routing/appRoutes.test.ts
index f3a89a74..ffe9c12d 100644
--- a/src/routing/appRoutes.test.ts
+++ b/src/routing/appRoutes.test.ts
@@ -9,6 +9,18 @@ describe('matchAppRoute', () => {
});
});
+ it('routes puzzle playground path to the standalone puzzle runtime', () => {
+ expect(matchAppRoute('/puzzle')).toEqual({
+ kind: 'puzzle-playground',
+ });
+ });
+
+ it('routes big fish playground path to the standalone big fish runtime', () => {
+ expect(matchAppRoute('/BIG-FISH/')).toEqual({
+ kind: 'big-fish-playground',
+ });
+ });
+
it('routes former standalone editor paths back to the main game', () => {
expect(matchAppRoute('/item-editor/tools')).toEqual({
kind: 'game',
diff --git a/src/routing/appRoutes.tsx b/src/routing/appRoutes.tsx
index 49b5c16d..85101039 100644
--- a/src/routing/appRoutes.tsx
+++ b/src/routing/appRoutes.tsx
@@ -7,6 +7,12 @@ type AppRouteComponent = LazyExoticComponent<
>;
export type AppRouteMatch =
+ | {
+ kind: 'puzzle-playground';
+ }
+ | {
+ kind: 'big-fish-playground';
+ }
| {
kind: 'game';
};
@@ -20,6 +26,8 @@ export type ResolvedAppRoute = {
};
const GameApp = lazy(() => import('../AuthenticatedApp')) as AppRouteComponent;
+const BigFishPlaygroundApp = lazy(() => import('../BigFishPlaygroundApp')) as AppRouteComponent;
+const PuzzlePlaygroundApp = lazy(() => import('../PuzzlePlaygroundApp')) as AppRouteComponent;
function normalizeRoutePath(pathname: string) {
const trimmedPathname = pathname.trim().toLowerCase();
@@ -32,7 +40,19 @@ function normalizeRoutePath(pathname: string) {
}
export function matchAppRoute(pathname: string): AppRouteMatch {
- void normalizeRoutePath(pathname);
+ const normalizedPath = normalizeRoutePath(pathname);
+
+ if (normalizedPath === '/puzzle') {
+ return {
+ kind: 'puzzle-playground',
+ };
+ }
+
+ if (normalizedPath === '/big-fish') {
+ return {
+ kind: 'big-fish-playground',
+ };
+ }
return {
kind: 'game',
@@ -42,6 +62,24 @@ export function matchAppRoute(pathname: string): AppRouteMatch {
export function resolveAppRoute(pathname: string): ResolvedAppRoute {
const matchedRoute = matchAppRoute(pathname);
+ if (matchedRoute.kind === 'puzzle-playground') {
+ return {
+ kind: 'puzzle-playground',
+ loadingEyebrow: '正在载入拼图',
+ loadingText: '正在进入拼图关卡...',
+ Component: PuzzlePlaygroundApp,
+ };
+ }
+
+ if (matchedRoute.kind === 'big-fish-playground') {
+ return {
+ kind: 'big-fish-playground',
+ loadingEyebrow: '正在载入大鱼',
+ loadingText: '正在进入玩法...',
+ Component: BigFishPlaygroundApp,
+ };
+ }
+
return {
kind: 'game',
loadingEyebrow: '正在载入游戏',
diff --git a/src/services/puzzle-runtime/puzzleLocalRuntime.ts b/src/services/puzzle-runtime/puzzleLocalRuntime.ts
index 5480b24c..cfa15349 100644
--- a/src/services/puzzle-runtime/puzzleLocalRuntime.ts
+++ b/src/services/puzzle-runtime/puzzleLocalRuntime.ts
@@ -68,7 +68,7 @@ function buildInitialBoard(gridSize: PuzzleGridSize): PuzzleBoardSnapshot {
const pieces = Array.from({ length: gridSize * gridSize }, (_, index) => {
const correctRow = Math.floor(index / gridSize);
const correctCol = index % gridSize;
- const current = shuffledPositions[index];
+ const current = shuffledPositions[index] ?? { row: correctRow, col: correctCol };
return {
pieceId: `piece-${index}`,
correctRow,