mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: seletable external moduels
This commit is contained in:
1 parent
6ebced6f01
commit
7c3bc8884d
1 file changed
+21
-13
@@ -395,7 +395,7 @@ export function SpacedArmorSceneComponent({
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ArmorType.External:
|
case ArmorType.External:
|
||||||
color = unselectedColor;
|
color = new Color(0, 1, 1);
|
||||||
opacity = 1 / 8;
|
opacity = 1 / 8;
|
||||||
renderOrder = 0;
|
renderOrder = 0;
|
||||||
depthWrite = false;
|
depthWrite = false;
|
||||||
@@ -421,24 +421,35 @@ export function SpacedArmorSceneComponent({
|
|||||||
* never mutates :)
|
* never mutates :)
|
||||||
*/
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function handleHighlightArmor(thisName?: string) {
|
function handleHighlightArmor(selectedName?: string) {
|
||||||
if (!props.static) return;
|
if (!props.static) return;
|
||||||
|
|
||||||
if (thisName === undefined) {
|
if (selectedName === undefined) {
|
||||||
// nothing selected, go back to defaults
|
// nothing selected, go back to defaults
|
||||||
material.opacity = opacity;
|
material.opacity = opacity;
|
||||||
material.transparent = true;
|
material.transparent = true;
|
||||||
material.color = color;
|
material.color = color;
|
||||||
} else if (thisName === props.name) {
|
material.depthWrite = props.type !== ArmorType.External;
|
||||||
|
} else if (
|
||||||
|
selectedName === props.name ||
|
||||||
|
(props.name.startsWith('chassis_') &&
|
||||||
|
selectedName.startsWith('chassis_')) ||
|
||||||
|
(props.name.startsWith('gun_') &&
|
||||||
|
selectedName.startsWith('gun_') &&
|
||||||
|
!props.name.includes('_armor_') &&
|
||||||
|
!selectedName.includes('_armor_'))
|
||||||
|
) {
|
||||||
// this selected, stand out!
|
// this selected, stand out!
|
||||||
material.opacity = 1;
|
material.opacity = 1;
|
||||||
material.transparent = false;
|
material.transparent = false;
|
||||||
material.color = color;
|
material.color = color;
|
||||||
|
material.depthWrite = true;
|
||||||
} else {
|
} else {
|
||||||
// something else selected, become background
|
// something else selected, become background
|
||||||
material.opacity = 1 / 4;
|
material.opacity = 1 / 4;
|
||||||
material.transparent = true;
|
material.transparent = true;
|
||||||
material.color = unselectedColor;
|
material.color = unselectedColor;
|
||||||
|
material.depthWrite = props.type !== ArmorType.External;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,15 +472,12 @@ export function SpacedArmorSceneComponent({
|
|||||||
thickness,
|
thickness,
|
||||||
} satisfies ArmorUserData,
|
} satisfies ArmorUserData,
|
||||||
|
|
||||||
onClick:
|
onClick(event) {
|
||||||
props.type === ArmorType.External
|
event.stopPropagation();
|
||||||
? undefined
|
mutateTankopediaEphemeralStore((draft) => {
|
||||||
: (event) => {
|
draft.highlightArmor = props.name;
|
||||||
event.stopPropagation();
|
});
|
||||||
mutateTankopediaEphemeralStore((draft) => {
|
},
|
||||||
draft.highlightArmor = props.name;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user