mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: camouflage
This commit is contained in:
1 parent
38870ca3f7
commit
561b59d235
7 files changed
+81
-41
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { readDVPLFile } from '../../src/core/blitz/readDVPLFile';
|
||||
import { commitAssets } from '../../src/core/blitzkrieg/commitAssets';
|
||||
import { FileChange } from '../../src/core/blitzkrieg/commitMultipleFiles';
|
||||
import { DATA, POI } from './constants';
|
||||
|
||||
export async function camouflageIcons(production: boolean) {
|
||||
console.log('Building camouflage icons...');
|
||||
const content = await readDVPLFile(
|
||||
`${DATA}/${POI.defaultCamoIcon.replace('.webp', '.packed.webp.dvpl')}`,
|
||||
).then((content) => content.toString('base64'));
|
||||
const changes: FileChange[] = [
|
||||
{
|
||||
content,
|
||||
encoding: 'base64',
|
||||
path: 'icons/camo.webp',
|
||||
},
|
||||
];
|
||||
|
||||
await commitAssets('camo icons', changes, production);
|
||||
}
|
||||
@@ -24,4 +24,5 @@ export const POI = {
|
||||
consumableIcons: 'Gfx/UI/InventoryIcons/Big/Consumables',
|
||||
equipmentItemImageMappings:
|
||||
'UI/Screens3/Lobby/Inventory/Equipment/EquipmentItemImage.style.yaml',
|
||||
defaultCamoIcon: 'Gfx/UI/Hangar/IconCamouflage.webp',
|
||||
} as const;
|
||||
@@ -1,5 +1,6 @@
|
||||
import { config } from 'dotenv';
|
||||
import { argv } from 'process';
|
||||
import { camouflageIcons } from './camouflageIcons';
|
||||
import { buildCircleFlags } from './circleFlags';
|
||||
import { buildConsumableIcons } from './consumableIcons';
|
||||
import { buildDefinitions } from './definitions';
|
||||
@@ -22,41 +23,22 @@ const production = argv.includes('--production');
|
||||
|
||||
if (!targets && !allTargets) throw new Error('No target(s) specified');
|
||||
|
||||
if (allTargets || targets?.includes('tankModels')) {
|
||||
await buildTankModels(production);
|
||||
}
|
||||
const methods = [
|
||||
buildTankModels,
|
||||
buildTankArmors,
|
||||
buildDefinitions,
|
||||
buildTankIcons,
|
||||
buildScratchedFlags,
|
||||
buildCircleFlags,
|
||||
buildShellIcons,
|
||||
buildModuleIcons,
|
||||
equipmentIcons,
|
||||
buildConsumableIcons,
|
||||
camouflageIcons,
|
||||
];
|
||||
|
||||
if (allTargets || targets?.includes('tankArmor')) {
|
||||
await buildTankArmors(production);
|
||||
}
|
||||
|
||||
if (allTargets || targets?.includes('definitions')) {
|
||||
await buildDefinitions(production);
|
||||
}
|
||||
|
||||
if (allTargets || targets?.includes('tankIcons')) {
|
||||
await buildTankIcons(production);
|
||||
}
|
||||
|
||||
if (allTargets || targets?.includes('scratchedFlags')) {
|
||||
await buildScratchedFlags(production);
|
||||
}
|
||||
|
||||
if (allTargets || targets?.includes('circleFlags')) {
|
||||
await buildCircleFlags(production);
|
||||
}
|
||||
|
||||
if (allTargets || targets?.includes('shellIcons')) {
|
||||
await buildShellIcons(production);
|
||||
}
|
||||
|
||||
if (allTargets || targets?.includes('moduleIcons')) {
|
||||
await buildModuleIcons(production);
|
||||
}
|
||||
if (allTargets || targets?.includes('equipmentIcons')) {
|
||||
equipmentIcons(production);
|
||||
}
|
||||
|
||||
if (allTargets || targets?.includes('consumableIcons')) {
|
||||
await buildConsumableIcons(production);
|
||||
for (const method of methods) {
|
||||
if (allTargets || targets?.includes(method.name)) {
|
||||
await method(production);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Flex, Heading } from '@radix-ui/themes';
|
||||
import { ModuleButton } from '../../../../../../../components/ModuleButton';
|
||||
import {
|
||||
mutateTankopediaTemporary,
|
||||
useTankopediaTemporary,
|
||||
} from '../../../../../../../stores/tankopedia';
|
||||
|
||||
export function Camouflage() {
|
||||
const camouflage = useTankopediaTemporary((state) => state.camouflage);
|
||||
|
||||
return (
|
||||
<Flex gap="2" direction="column">
|
||||
<Heading size="4">Camouflage</Heading>
|
||||
|
||||
<ModuleButton
|
||||
selected={camouflage}
|
||||
first
|
||||
last
|
||||
type="camouflage"
|
||||
onClick={() => {
|
||||
mutateTankopediaTemporary((draft) => {
|
||||
draft.camouflage = !camouflage;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Flex, Heading } from '@radix-ui/themes';
|
||||
import { Camouflage } from './components/Camouflage';
|
||||
import { Consumables } from './components/Consumables';
|
||||
import { Equipments } from './components/Equipments';
|
||||
import { Modules } from './components/Modules';
|
||||
@@ -12,6 +13,7 @@ export function Configure() {
|
||||
<Modules />
|
||||
<Equipments />
|
||||
<Consumables />
|
||||
<Camouflage />
|
||||
</Flex>
|
||||
|
||||
{/*
|
||||
@@ -19,10 +21,6 @@ export function Configure() {
|
||||
<Heading size="5">Camouflage</Heading>
|
||||
</Flex>
|
||||
|
||||
<Flex gap="4" direction="column">
|
||||
<Heading size="5">Consumables</Heading>
|
||||
</Flex>
|
||||
|
||||
<Flex gap="4" direction="column">
|
||||
<Heading size="5">Provisions</Heading>
|
||||
</Flex> */}
|
||||
|
||||
@@ -25,6 +25,9 @@ type ModuleButtonProps = Omit<ComponentProps<typeof Button>, 'type'> & {
|
||||
type: 'consumable';
|
||||
consumable: number;
|
||||
}
|
||||
| {
|
||||
type: 'camouflage';
|
||||
}
|
||||
);
|
||||
|
||||
export function ModuleButton({
|
||||
@@ -49,6 +52,10 @@ export function ModuleButton({
|
||||
imageStyles.top = '50%';
|
||||
imageStyles.left = '50%';
|
||||
imageStyles.transform = 'translate(calc(-50% + 2px), calc(-50% + 2px))';
|
||||
} else if (props.type === 'camouflage') {
|
||||
imageStyles.top = '50%';
|
||||
imageStyles.left = '50%';
|
||||
imageStyles.transform = 'translate(calc(-50% + 4px), calc(-50% + 4px))';
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -80,7 +87,9 @@ export function ModuleButton({
|
||||
? `icons/shells/${props.shell}.webp`
|
||||
: props.type === 'consumable'
|
||||
? `icons/consumables/${props.consumable}.webp`
|
||||
: `icons/equipment/${props.equipment}.webp`,
|
||||
: props.type === 'camouflage'
|
||||
? `icons/camo.webp`
|
||||
: `icons/equipment/${props.equipment}.webp`,
|
||||
)}
|
||||
style={imageStyles}
|
||||
/>
|
||||
|
||||
@@ -58,6 +58,7 @@ interface TankopediaTemporary {
|
||||
equipmentMatrix: EquipmentMatrix;
|
||||
mode: TankopediaMode;
|
||||
consumables: number[];
|
||||
camouflage: boolean;
|
||||
}
|
||||
|
||||
export const useTankopediaPersistent = create<TankopediaPersistent>()(
|
||||
@@ -106,6 +107,7 @@ export const useTankopediaTemporary = create<TankopediaTemporary>()(
|
||||
],
|
||||
mode: 'model',
|
||||
consumables: [],
|
||||
camouflage: false,
|
||||
})),
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user