css minor fix

This commit is contained in:
sjwie 2024-04-15 16:32:56 +09:00
parent 76730c24b8
commit ed5134f7ec
1 changed files with 14 additions and 7 deletions

View File

@ -1,8 +1,8 @@
"use client";
import Image from "next/image";
import { useSearchParams } from "next/navigation";
import { Suspense } from "react";
import { Unity, UnityConfig, useUnityContext } from "react-unity-webgl";
const unityConfigBuilder: (path: string) => UnityConfig = (path) => ({
loaderUrl: `${path}.loader.js`,
dataUrl: `${path}.data`,
@ -19,7 +19,7 @@ const option = [
{ value: "/unity/test-project/build", name: "test-project" },
];
export default function Home() {
function UnityComponent() {
const params = useSearchParams();
const p = params.get("p");
console.log(p);
@ -41,15 +41,14 @@ export default function Home() {
Unity , WebGL로
react-unity-webgl .
</div>
<div className="relative h-[600px] w-[800px]">
<div className="flex h-[650px] w-[800px] flex-col">
{isLoaded === false && (
<div className="absolute left-0 top-0 flex h-full w-full items-center justify-center bg-gray-500">
<div className="absolute z-10 flex h-[600px] w-[800px] items-center justify-center bg-gray-500">
<p>Loading... ({loadingPercentage}%)</p>
</div>
)}
{initialisationError && JSON.stringify(initialisationError, null, 2)}
<Unity className="h-full w-full" unityProvider={unityProvider} />
<div className="flex">
<Unity className="h-[600px] w-[800px]" unityProvider={unityProvider} />
<div className="mt-auto flex">
<select
value={Number(p)}
onChange={(e) => (location.href = `/unity?p=${e.target.value}`)}
@ -75,3 +74,11 @@ export default function Home() {
</>
);
}
export default function UnityWrapper() {
return (
<Suspense>
<UnityComponent />
</Suspense>
);
}