mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-30 05:59:51 +01:00
fix: use code
This commit is contained in:
1 parent
93632a7073
commit
99c95a4c15
1 file changed
+22
-12
@@ -1,13 +1,20 @@
|
|||||||
import { ReloadIcon } from "@radix-ui/react-icons";
|
import { ReloadIcon } from "@radix-ui/react-icons";
|
||||||
import { Card, Flex, IconButton, Text, TextField } from "@radix-ui/themes";
|
import {
|
||||||
|
Card,
|
||||||
|
Code,
|
||||||
|
Flex,
|
||||||
|
IconButton,
|
||||||
|
Text,
|
||||||
|
TextField,
|
||||||
|
} from "@radix-ui/themes";
|
||||||
import { Html } from "@react-three/drei";
|
import { Html } from "@react-three/drei";
|
||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import { radToDeg } from "three/src/math/MathUtils.js";
|
import { radToDeg } from "three/src/math/MathUtils.js";
|
||||||
import { resolveArmorIndex } from "../../../core/blitzkit/resolveArmorIndex";
|
import { resolveArmorIndex } from "../../../core/blitzkit/resolveArmorIndex";
|
||||||
|
import { LocaleProvider, useLocale } from "../../../hooks/useLocale";
|
||||||
import { App } from "../../../stores/app";
|
import { App } from "../../../stores/app";
|
||||||
import { Duel } from "../../../stores/duel";
|
import { Duel } from "../../../stores/duel";
|
||||||
import { Tankopedia } from "../../../stores/tankopedia";
|
import { Tankopedia } from "../../../stores/tankopedia";
|
||||||
import { CopyableCode } from "../../CopyableCode";
|
|
||||||
import { layerTypeNames } from "./ShotDisplayCard";
|
import { layerTypeNames } from "./ShotDisplayCard";
|
||||||
import { ArmorType } from "./SpacedArmorScene";
|
import { ArmorType } from "./SpacedArmorScene";
|
||||||
|
|
||||||
@@ -15,6 +22,7 @@ export function ArmorPlateDisplay() {
|
|||||||
const highlightArmor = Tankopedia.use((state) => state.highlightArmor);
|
const highlightArmor = Tankopedia.use((state) => state.highlightArmor);
|
||||||
const developerMode = App.useDeferred((state) => state.developerMode, false);
|
const developerMode = App.useDeferred((state) => state.developerMode, false);
|
||||||
const input = useRef<HTMLInputElement>(null);
|
const input = useRef<HTMLInputElement>(null);
|
||||||
|
const { locale } = useLocale();
|
||||||
|
|
||||||
if (highlightArmor === undefined) return null;
|
if (highlightArmor === undefined) return null;
|
||||||
|
|
||||||
@@ -24,6 +32,7 @@ export function ArmorPlateDisplay() {
|
|||||||
center
|
center
|
||||||
style={{ pointerEvents: highlightArmor.editingPlate ? "auto" : "none" }}
|
style={{ pointerEvents: highlightArmor.editingPlate ? "auto" : "none" }}
|
||||||
>
|
>
|
||||||
|
<LocaleProvider locale={locale}>
|
||||||
<Card
|
<Card
|
||||||
variant="classic"
|
variant="classic"
|
||||||
mb="4"
|
mb="4"
|
||||||
@@ -55,14 +64,9 @@ export function ArmorPlateDisplay() {
|
|||||||
<>
|
<>
|
||||||
<Text mt="2" color="gray" size="2">
|
<Text mt="2" color="gray" size="2">
|
||||||
<b>DEV:</b>{" "}
|
<b>DEV:</b>{" "}
|
||||||
<CopyableCode
|
<Code variant="soft" highContrast color="gray">
|
||||||
copy={highlightArmor.name}
|
|
||||||
variant="soft"
|
|
||||||
highContrast
|
|
||||||
color="gray"
|
|
||||||
>
|
|
||||||
{highlightArmor.name}
|
{highlightArmor.name}
|
||||||
</CopyableCode>
|
</Code>
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -102,7 +106,9 @@ export function ArmorPlateDisplay() {
|
|||||||
|
|
||||||
if (highlightArmor.name.startsWith("hull_")) {
|
if (highlightArmor.name.startsWith("hull_")) {
|
||||||
tank.armor!.thickness[index] = thickness;
|
tank.armor!.thickness[index] = thickness;
|
||||||
} else if (highlightArmor.name.startsWith("turret_")) {
|
} else if (
|
||||||
|
highlightArmor.name.startsWith("turret_")
|
||||||
|
) {
|
||||||
turret.armor!.thickness[index] = thickness;
|
turret.armor!.thickness[index] = thickness;
|
||||||
} else if (highlightArmor.name.startsWith("gun_")) {
|
} else if (highlightArmor.name.startsWith("gun_")) {
|
||||||
if (highlightArmor.name.includes("_armor_")) {
|
if (highlightArmor.name.includes("_armor_")) {
|
||||||
@@ -110,7 +116,9 @@ export function ArmorPlateDisplay() {
|
|||||||
} else {
|
} else {
|
||||||
gun.thickness = thickness;
|
gun.thickness = thickness;
|
||||||
}
|
}
|
||||||
} else if (highlightArmor.name.startsWith("chassis_")) {
|
} else if (
|
||||||
|
highlightArmor.name.startsWith("chassis_")
|
||||||
|
) {
|
||||||
track.thickness = thickness;
|
track.thickness = thickness;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -150,7 +158,8 @@ export function ArmorPlateDisplay() {
|
|||||||
const initialTurret =
|
const initialTurret =
|
||||||
initialTank.turrets[protagonist.turret.id];
|
initialTank.turrets[protagonist.turret.id];
|
||||||
const gun = turret.guns[protagonist.gun.id];
|
const gun = turret.guns[protagonist.gun.id];
|
||||||
const initialGun = initialTurret.guns[protagonist.gun.id];
|
const initialGun =
|
||||||
|
initialTurret.guns[protagonist.gun.id];
|
||||||
const track = tank.tracks[protagonist.track.id];
|
const track = tank.tracks[protagonist.track.id];
|
||||||
const initialTrack =
|
const initialTrack =
|
||||||
initialTank.tracks[protagonist.track.id];
|
initialTank.tracks[protagonist.track.id];
|
||||||
@@ -180,6 +189,7 @@ export function ArmorPlateDisplay() {
|
|||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
</Card>
|
</Card>
|
||||||
|
</LocaleProvider>
|
||||||
</Html>
|
</Html>
|
||||||
</group>
|
</group>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user