mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-30 14:09:51 +01:00
fix: contextual shot display card
This commit is contained in:
1 parent
7e22f4596d
commit
447b4629ce
4 files changed
+9
-14
No files matched your search
@@ -2,6 +2,7 @@ import { PerspectiveCamera } from '@react-three/drei';
|
|||||||
import { Canvas } from '@react-three/fiber';
|
import { Canvas } from '@react-three/fiber';
|
||||||
import { use, useEffect, useRef } from 'react';
|
import { use, useEffect, useRef } from 'react';
|
||||||
import { Armor } from '../../../../../../components/Armor';
|
import { Armor } from '../../../../../../components/Armor';
|
||||||
|
import { ShotDisplay } from '../../../../../../components/Armor/components/ShotDisplay';
|
||||||
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
import { applyPitchYawLimits } from '../../../../../../core/blitz/applyPitchYawLimits';
|
||||||
import { modelDefinitions } from '../../../../../../core/blitzkit/modelDefinitions';
|
import { modelDefinitions } from '../../../../../../core/blitzkit/modelDefinitions';
|
||||||
import { modelTransformEvent } from '../../../../../../core/blitzkit/modelTransform';
|
import { modelTransformEvent } from '../../../../../../core/blitzkit/modelTransform';
|
||||||
@@ -142,6 +143,7 @@ export function TankSandbox() {
|
|||||||
<Lighting />
|
<Lighting />
|
||||||
<TankModel />
|
<TankModel />
|
||||||
<Armor />
|
<Armor />
|
||||||
|
<ShotDisplay />
|
||||||
</Canvas>
|
</Canvas>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,6 @@ import { useModelDefinitions } from '../../../hooks/useModelDefinitions';
|
|||||||
import * as Duel from '../../../stores/duel';
|
import * as Duel from '../../../stores/duel';
|
||||||
import * as TankopediaPersistent from '../../../stores/tankopediaPersistent';
|
import * as TankopediaPersistent from '../../../stores/tankopediaPersistent';
|
||||||
import { CoreArmorSceneComponent } from './CoreArmorSceneComponent';
|
import { CoreArmorSceneComponent } from './CoreArmorSceneComponent';
|
||||||
import { ShotDisplay } from './ShotDisplay';
|
|
||||||
|
|
||||||
export const CoreArmorScene = memo(() => {
|
export const CoreArmorScene = memo(() => {
|
||||||
const wrapper = useRef<Group>(null);
|
const wrapper = useRef<Group>(null);
|
||||||
@@ -137,9 +136,6 @@ export const CoreArmorScene = memo(() => {
|
|||||||
).applyAxisAngle(I_HAT, Math.PI / 2);
|
).applyAxisAngle(I_HAT, Math.PI / 2);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
<ShotDisplay />
|
|
||||||
|
|
||||||
<group
|
<group
|
||||||
ref={wrapper}
|
ref={wrapper}
|
||||||
rotation={[-Math.PI / 2, 0, 0]}
|
rotation={[-Math.PI / 2, 0, 0]}
|
||||||
@@ -206,18 +202,14 @@ export const CoreArmorScene = memo(() => {
|
|||||||
armorId,
|
armorId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isVisible || spaced || thickness === undefined)
|
if (!isVisible || spaced || thickness === undefined) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<group
|
<group
|
||||||
key={node.uuid}
|
key={node.uuid}
|
||||||
position={turretOrigin.clone().add(gunOrigin)}
|
position={turretOrigin.clone().add(gunOrigin)}
|
||||||
>
|
>
|
||||||
<CoreArmorSceneComponent
|
<CoreArmorSceneComponent thickness={thickness} node={node} />
|
||||||
thickness={thickness}
|
|
||||||
node={node}
|
|
||||||
/>
|
|
||||||
</group>
|
</group>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -225,6 +217,5 @@ export const CoreArmorScene = memo(() => {
|
|||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -82,7 +82,7 @@ export function ShotDisplay() {
|
|||||||
sm: 'block',
|
sm: 'block',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ShotDisplayCard />
|
<ShotDisplayCard shot={shot} />
|
||||||
</Box>
|
</Box>
|
||||||
</Html>
|
</Html>
|
||||||
|
|
||||||
|
|||||||
@@ -108,9 +108,11 @@ function LayerEntry({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ShotDisplayCard() {
|
interface ShotDisplayCardProps {
|
||||||
const shot = TankopediaEphemeral.use((state) => state.shot);
|
shot: TankopediaEphemeral.Shot;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ShotDisplayCard({ shot }: ShotDisplayCardProps) {
|
||||||
if (!shot) return null;
|
if (!shot) return null;
|
||||||
|
|
||||||
const outTitleColor = shot.out
|
const outTitleColor = shot.out
|
||||||
|
|||||||
Reference in new issue
Block a user