Files
Genarrative/src/components/GameCanvas.tsx
T
kdletters 071faa482c 统一 Rust 与 TypeScript 格式化门禁
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口

完成项目 TypeScript/Prettier 与 Rust 全量格式化

修复 Pingora expected executable 门禁的空白敏感误报

同步开发运维文档与 AGC skill pack 格式化忽略规则
2026-09-01 16:28:34 +08:00

51 lines
1.4 KiB
TypeScript

import { lazy, Suspense } from 'react';
import type { GameCanvasProps } from './game-canvas/GameCanvasShared';
export type {
GameCanvasEntitySelection,
GameCanvasProps,
} from './game-canvas/GameCanvasShared';
const GameCanvasRuntime = lazy(async () => {
const module = await import('./game-canvas/GameCanvasRuntime');
return {
default: module.GameCanvasRuntime,
};
});
function GameCanvasLoadingFallback({
sceneName,
}: {
sceneName: string | null;
}) {
return (
<div className="relative h-full w-full overflow-hidden bg-black">
<div className="absolute inset-0 bg-[radial-gradient(circle_at_top,rgba(255,255,255,0.08),transparent_38%),linear-gradient(180deg,rgba(12,16,24,0.96),rgba(3,5,10,1))]" />
{sceneName && (
<div className="absolute left-1/2 top-3 -translate-x-1/2 rounded-full border border-white/10 bg-black/45 px-4 py-1 text-[10px] uppercase tracking-[0.2em] text-zinc-300">
{sceneName}
</div>
)}
<div className="absolute inset-0 flex items-center justify-center text-[11px] uppercase tracking-[0.3em] text-zinc-500">
Loading scene
</div>
</div>
);
}
export function GameCanvas(props: GameCanvasProps) {
return (
<Suspense
fallback={
<GameCanvasLoadingFallback
sceneName={props.currentScenePreset?.name ?? null}
/>
}
>
<GameCanvasRuntime {...props} />
</Suspense>
);
}