mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +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',
|
consumableIcons: 'Gfx/UI/InventoryIcons/Big/Consumables',
|
||||||
equipmentItemImageMappings:
|
equipmentItemImageMappings:
|
||||||
'UI/Screens3/Lobby/Inventory/Equipment/EquipmentItemImage.style.yaml',
|
'UI/Screens3/Lobby/Inventory/Equipment/EquipmentItemImage.style.yaml',
|
||||||
|
defaultCamoIcon: 'Gfx/UI/Hangar/IconCamouflage.webp',
|
||||||
} as const;
|
} as const;
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { config } from 'dotenv';
|
import { config } from 'dotenv';
|
||||||
import { argv } from 'process';
|
import { argv } from 'process';
|
||||||
|
import { camouflageIcons } from './camouflageIcons';
|
||||||
import { buildCircleFlags } from './circleFlags';
|
import { buildCircleFlags } from './circleFlags';
|
||||||
import { buildConsumableIcons } from './consumableIcons';
|
import { buildConsumableIcons } from './consumableIcons';
|
||||||
import { buildDefinitions } from './definitions';
|
import { buildDefinitions } from './definitions';
|
||||||
@@ -22,41 +23,22 @@ const production = argv.includes('--production');
|
|||||||
|
|
||||||
if (!targets && !allTargets) throw new Error('No target(s) specified');
|
if (!targets && !allTargets) throw new Error('No target(s) specified');
|
||||||
|
|
||||||
if (allTargets || targets?.includes('tankModels')) {
|
const methods = [
|
||||||
await buildTankModels(production);
|
buildTankModels,
|
||||||
}
|
buildTankArmors,
|
||||||
|
buildDefinitions,
|
||||||
|
buildTankIcons,
|
||||||
|
buildScratchedFlags,
|
||||||
|
buildCircleFlags,
|
||||||
|
buildShellIcons,
|
||||||
|
buildModuleIcons,
|
||||||
|
equipmentIcons,
|
||||||
|
buildConsumableIcons,
|
||||||
|
camouflageIcons,
|
||||||
|
];
|
||||||
|
|
||||||
if (allTargets || targets?.includes('tankArmor')) {
|
for (const method of methods) {
|
||||||
await buildTankArmors(production);
|
if (allTargets || targets?.includes(method.name)) {
|
||||||
}
|
await method(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);
|
|
||||||
}
|
}
|
||||||
@@ -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 { Flex, Heading } from '@radix-ui/themes';
|
||||||
|
import { Camouflage } from './components/Camouflage';
|
||||||
import { Consumables } from './components/Consumables';
|
import { Consumables } from './components/Consumables';
|
||||||
import { Equipments } from './components/Equipments';
|
import { Equipments } from './components/Equipments';
|
||||||
import { Modules } from './components/Modules';
|
import { Modules } from './components/Modules';
|
||||||
@@ -12,6 +13,7 @@ export function Configure() {
|
|||||||
<Modules />
|
<Modules />
|
||||||
<Equipments />
|
<Equipments />
|
||||||
<Consumables />
|
<Consumables />
|
||||||
|
<Camouflage />
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
{/*
|
{/*
|
||||||
@@ -19,10 +21,6 @@ export function Configure() {
|
|||||||
<Heading size="5">Camouflage</Heading>
|
<Heading size="5">Camouflage</Heading>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex gap="4" direction="column">
|
|
||||||
<Heading size="5">Consumables</Heading>
|
|
||||||
</Flex>
|
|
||||||
|
|
||||||
<Flex gap="4" direction="column">
|
<Flex gap="4" direction="column">
|
||||||
<Heading size="5">Provisions</Heading>
|
<Heading size="5">Provisions</Heading>
|
||||||
</Flex> */}
|
</Flex> */}
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ type ModuleButtonProps = Omit<ComponentProps<typeof Button>, 'type'> & {
|
|||||||
type: 'consumable';
|
type: 'consumable';
|
||||||
consumable: number;
|
consumable: number;
|
||||||
}
|
}
|
||||||
|
| {
|
||||||
|
type: 'camouflage';
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export function ModuleButton({
|
export function ModuleButton({
|
||||||
@@ -49,6 +52,10 @@ export function ModuleButton({
|
|||||||
imageStyles.top = '50%';
|
imageStyles.top = '50%';
|
||||||
imageStyles.left = '50%';
|
imageStyles.left = '50%';
|
||||||
imageStyles.transform = 'translate(calc(-50% + 2px), calc(-50% + 2px))';
|
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 (
|
return (
|
||||||
@@ -80,7 +87,9 @@ export function ModuleButton({
|
|||||||
? `icons/shells/${props.shell}.webp`
|
? `icons/shells/${props.shell}.webp`
|
||||||
: props.type === 'consumable'
|
: props.type === 'consumable'
|
||||||
? `icons/consumables/${props.consumable}.webp`
|
? `icons/consumables/${props.consumable}.webp`
|
||||||
: `icons/equipment/${props.equipment}.webp`,
|
: props.type === 'camouflage'
|
||||||
|
? `icons/camo.webp`
|
||||||
|
: `icons/equipment/${props.equipment}.webp`,
|
||||||
)}
|
)}
|
||||||
style={imageStyles}
|
style={imageStyles}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ interface TankopediaTemporary {
|
|||||||
equipmentMatrix: EquipmentMatrix;
|
equipmentMatrix: EquipmentMatrix;
|
||||||
mode: TankopediaMode;
|
mode: TankopediaMode;
|
||||||
consumables: number[];
|
consumables: number[];
|
||||||
|
camouflage: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useTankopediaPersistent = create<TankopediaPersistent>()(
|
export const useTankopediaPersistent = create<TankopediaPersistent>()(
|
||||||
@@ -106,6 +107,7 @@ export const useTankopediaTemporary = create<TankopediaTemporary>()(
|
|||||||
],
|
],
|
||||||
mode: 'model',
|
mode: 'model',
|
||||||
consumables: [],
|
consumables: [],
|
||||||
|
camouflage: false,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user