mirror of
https://github.com/ad044/lainTSX.git
synced 2024-10-22 23:19:06 +00:00
fixed typing/glow bug
This commit is contained in:
parent
ca1358548d
commit
00d3829e30
2 changed files with 65 additions and 23 deletions
|
@ -19,8 +19,8 @@ import level_y_values from "../../resources/level_y_values.json";
|
||||||
|
|
||||||
type BlueOrbContructorProps = {
|
type BlueOrbContructorProps = {
|
||||||
sprite: string;
|
sprite: string;
|
||||||
position: [number, number, number];
|
position: number[];
|
||||||
rotation: [number, number, number, (string | undefined)?];
|
rotation: number[];
|
||||||
active: boolean;
|
active: boolean;
|
||||||
level: string;
|
level: string;
|
||||||
};
|
};
|
||||||
|
@ -39,12 +39,13 @@ const BlueOrb = memo((props: BlueOrbContructorProps) => {
|
||||||
// so we import all of them here and then use this function to
|
// so we import all of them here and then use this function to
|
||||||
// associate a sprite with the path
|
// associate a sprite with the path
|
||||||
const spriteToPath = (sprite: string) => {
|
const spriteToPath = (sprite: string) => {
|
||||||
console.log(sprite);
|
if (sprite.includes("S")) {
|
||||||
if (sprite.startsWith("S")) {
|
|
||||||
return [SSkn, SSKnActive];
|
return [SSkn, SSKnActive];
|
||||||
} else if (sprite.startsWith("P") || sprite.startsWith("G")) {
|
} else if (
|
||||||
return [MULTI, MULTIActive];
|
sprite.startsWith("P") ||
|
||||||
} else if (sprite.includes("?")) {
|
sprite.startsWith("G") ||
|
||||||
|
sprite.includes("?")
|
||||||
|
) {
|
||||||
return [MULTI, MULTIActive];
|
return [MULTI, MULTIActive];
|
||||||
} else if (sprite.includes("Dc")) {
|
} else if (sprite.includes("Dc")) {
|
||||||
return [Dc, DcActive];
|
return [Dc, DcActive];
|
||||||
|
@ -117,9 +118,9 @@ const BlueOrb = memo((props: BlueOrbContructorProps) => {
|
||||||
return (
|
return (
|
||||||
<group position={[0, (level_y_values as LevelYValues)[props.level], 0]}>
|
<group position={[0, (level_y_values as LevelYValues)[props.level], 0]}>
|
||||||
<mesh
|
<mesh
|
||||||
position={props.position}
|
position={props.position as [number, number, number]}
|
||||||
scale={[0.25, 0.15, 0.25]}
|
scale={[0.25, 0.15, 0.25]}
|
||||||
rotation={props.rotation}
|
rotation={props.rotation as [number, number, number]}
|
||||||
renderOrder={1}
|
renderOrder={1}
|
||||||
>
|
>
|
||||||
<planeBufferGeometry attach="geometry" />
|
<planeBufferGeometry attach="geometry" />
|
||||||
|
|
|
@ -7,6 +7,48 @@ import { currentBlueOrbAtom } from "./BlueOrb/CurrentBlueOrbAtom";
|
||||||
import Level from "./Level";
|
import Level from "./Level";
|
||||||
import level_y_values from "../resources/level_y_values.json";
|
import level_y_values from "../resources/level_y_values.json";
|
||||||
|
|
||||||
|
type ImageTableIndices = {
|
||||||
|
1: string;
|
||||||
|
2: string;
|
||||||
|
3: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type ProtocolLines = {
|
||||||
|
1: string;
|
||||||
|
2: string;
|
||||||
|
3: string;
|
||||||
|
4: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Words = {
|
||||||
|
1: string;
|
||||||
|
2: string;
|
||||||
|
3: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type BlueOrbData = {
|
||||||
|
"SLPS_016_0x offset": string;
|
||||||
|
image_table_indices: ImageTableIndices;
|
||||||
|
is_hidden: string;
|
||||||
|
media_file: string;
|
||||||
|
node_name: string;
|
||||||
|
protocol_lines: ProtocolLines;
|
||||||
|
site: string;
|
||||||
|
type: string;
|
||||||
|
unlocked_by: string;
|
||||||
|
upgrade_requirement: string;
|
||||||
|
words: Words;
|
||||||
|
};
|
||||||
|
|
||||||
|
type BlueOrbPositionData = {
|
||||||
|
position: number[];
|
||||||
|
rotation: number[];
|
||||||
|
};
|
||||||
|
|
||||||
|
type BlueOrbPositions = {
|
||||||
|
[orbPos: string]: BlueOrbPositionData;
|
||||||
|
};
|
||||||
|
|
||||||
const Site = memo(() => {
|
const Site = memo(() => {
|
||||||
const currentBlueOrb = useRecoilValue(currentBlueOrbAtom);
|
const currentBlueOrb = useRecoilValue(currentBlueOrbAtom);
|
||||||
|
|
||||||
|
@ -14,29 +56,28 @@ const Site = memo(() => {
|
||||||
<>
|
<>
|
||||||
<Suspense fallback={<>loading...</>}>
|
<Suspense fallback={<>loading...</>}>
|
||||||
{/* distance between LEVELS is 1.5 */}
|
{/* distance between LEVELS is 1.5 */}
|
||||||
|
|
||||||
{Object.values(level_y_values).map((yVal) => {
|
{Object.values(level_y_values).map((yVal) => {
|
||||||
return <Level levelPosY={yVal} />;
|
return <Level levelPosY={yVal} key={yVal} />;
|
||||||
})}
|
})}
|
||||||
|
|
||||||
{Object.entries(site_a).map((blueOrb) => {
|
{Object.entries(site_a).map((blueOrb: [string, BlueOrbData]) => {
|
||||||
if ((blueOrb as any)[1]["unlocked_by"] === "-1")
|
if (blueOrb[1]["unlocked_by"] === "-1")
|
||||||
return (
|
return (
|
||||||
<BlueOrb
|
<BlueOrb
|
||||||
sprite={(blueOrb as any)[1]["node_name"]}
|
sprite={blueOrb[1]["node_name"]}
|
||||||
position={
|
position={
|
||||||
(blue_orb_positions as any)[(blueOrb as any)[0].substr(2)][
|
(blue_orb_positions as BlueOrbPositions)[
|
||||||
"position"
|
blueOrb[0].substr(2)
|
||||||
]
|
]["position"]
|
||||||
}
|
}
|
||||||
rotation={
|
rotation={
|
||||||
(blue_orb_positions as any)[(blueOrb as any)[0].substr(2)][
|
(blue_orb_positions as BlueOrbPositions)[
|
||||||
"rotation"
|
blueOrb[0].substr(2)
|
||||||
]
|
]["rotation"]
|
||||||
}
|
}
|
||||||
key={(blueOrb as any)[1]["node_name"]}
|
key={blueOrb[1]["node_name"]}
|
||||||
active={(blueOrb as any)[1] === currentBlueOrb}
|
active={blueOrb[0] === currentBlueOrb}
|
||||||
level={(blueOrb as any)[0].substr(0, 2)}
|
level={blueOrb[0].substr(0, 2)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
Loading…
Reference in a new issue