mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 20:19:49 +02:00
feat: game definitions
This commit is contained in:
1 parent
0ece1f4b18
commit
4ba45b8fd8
3 files changed
+100
-90
No files matched your search
@@ -3,6 +3,7 @@ import { parse as parsePath } from 'path';
|
|||||||
import { Vector3Tuple } from 'three';
|
import { Vector3Tuple } from 'three';
|
||||||
import { parse as parseYaml } from 'yaml';
|
import { parse as parseYaml } from 'yaml';
|
||||||
import { TankClass } from '../../src/components/Tanks';
|
import { TankClass } from '../../src/components/Tanks';
|
||||||
|
import { readStringDVPL } from '../../src/core/blitz/readStringDVPL';
|
||||||
import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL';
|
import { readXMLDVPL } from '../../src/core/blitz/readXMLDVPL';
|
||||||
import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL';
|
import { readYAMLDVPL } from '../../src/core/blitz/readYAMLDVPL';
|
||||||
import { toUniqueId } from '../../src/core/blitz/toUniqueId';
|
import { toUniqueId } from '../../src/core/blitz/toUniqueId';
|
||||||
@@ -16,6 +17,7 @@ import {
|
|||||||
EquipmentPreset,
|
EquipmentPreset,
|
||||||
EquipmentRow,
|
EquipmentRow,
|
||||||
} from '../../src/core/blitzkrieg/equipmentDefinitions';
|
} from '../../src/core/blitzkrieg/equipmentDefinitions';
|
||||||
|
import { GameDefinitions } from '../../src/core/blitzkrieg/gameDefinitions';
|
||||||
import {
|
import {
|
||||||
ModelArmor,
|
ModelArmor,
|
||||||
ModelDefinitions,
|
ModelDefinitions,
|
||||||
@@ -336,6 +338,13 @@ const missingStrings: Record<string, string> = {
|
|||||||
export async function definitions(production: boolean) {
|
export async function definitions(production: boolean) {
|
||||||
console.log('Building definitions...');
|
console.log('Building definitions...');
|
||||||
|
|
||||||
|
const gameDefinitions: GameDefinitions = {
|
||||||
|
version: (await readStringDVPL(`${DATA}/version.txt.dvpl`))
|
||||||
|
.split(' ')[0]
|
||||||
|
.split('.')
|
||||||
|
.slice(0, 3)
|
||||||
|
.join('.'),
|
||||||
|
};
|
||||||
const tankDefinitions: TankDefinitions = {};
|
const tankDefinitions: TankDefinitions = {};
|
||||||
const modelDefinitions: ModelDefinitions = {};
|
const modelDefinitions: ModelDefinitions = {};
|
||||||
const equipmentDefinitions: EquipmentDefinitions = {
|
const equipmentDefinitions: EquipmentDefinitions = {
|
||||||
@@ -1101,6 +1110,11 @@ export async function definitions(production: boolean) {
|
|||||||
await commitAssets(
|
await commitAssets(
|
||||||
'definitions',
|
'definitions',
|
||||||
[
|
[
|
||||||
|
{
|
||||||
|
content: superCompress(gameDefinitions),
|
||||||
|
encoding: 'base64',
|
||||||
|
path: 'definitions/game.cdon.lz4',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
content: superCompress(tankDefinitions),
|
content: superCompress(tankDefinitions),
|
||||||
encoding: 'base64',
|
encoding: 'base64',
|
||||||
|
|||||||
+76
-90
@@ -1,21 +1,27 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { CaretRightIcon } from '@radix-ui/react-icons';
|
import {
|
||||||
import { AlertDialog, Button, Flex, Text, Theme } from '@radix-ui/themes';
|
AlertDialog,
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
Flex,
|
||||||
|
ScrollArea,
|
||||||
|
Text,
|
||||||
|
Theme,
|
||||||
|
} from '@radix-ui/themes';
|
||||||
import '@radix-ui/themes/styles.css';
|
import '@radix-ui/themes/styles.css';
|
||||||
import { config } from 'dotenv';
|
import { config } from 'dotenv';
|
||||||
import { Roboto_Flex } from 'next/font/google';
|
import { Roboto_Flex } from 'next/font/google';
|
||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
import { ReactNode, useEffect, useState } from 'react';
|
import { ReactNode, use, useEffect, useState } from 'react';
|
||||||
import { SkyLine } from '../assets/art/SkyLine';
|
import packageJSON from '../../package.json';
|
||||||
import { Analytics } from '../components/Analytics';
|
import { Analytics } from '../components/Analytics';
|
||||||
import Navbar from '../components/Navbar';
|
import Navbar from '../components/Navbar';
|
||||||
import PageWrapper from '../components/PageWrapper';
|
import { gameDefinitions } from '../core/blitzkrieg/gameDefinitions';
|
||||||
import isDev from '../core/blitzkrieg/isDev';
|
import isDev from '../core/blitzkrieg/isDev';
|
||||||
import { isLocalhost } from '../core/blitzkrieg/isLocalhost';
|
import { isLocalhost } from '../core/blitzkrieg/isLocalhost';
|
||||||
import { useFullScreen } from '../hooks/useFullScreen';
|
import { useFullScreen } from '../hooks/useFullScreen';
|
||||||
import { useApp } from '../stores/app';
|
import { useApp } from '../stores/app';
|
||||||
import { mintTheme } from '../themes/mint';
|
|
||||||
|
|
||||||
config();
|
config();
|
||||||
|
|
||||||
@@ -31,6 +37,7 @@ const robotoFlex = Roboto_Flex({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default function RootLayout({ children }: RootLayoutProps) {
|
export default function RootLayout({ children }: RootLayoutProps) {
|
||||||
|
const awaitedGameDefinitions = use(gameDefinitions);
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const isEmbed = pathname.split('/')[1] === 'embeds';
|
const isEmbed = pathname.split('/')[1] === 'embeds';
|
||||||
const [showDevBuildAlert, setShowDevBuildAlert] = useState(false);
|
const [showDevBuildAlert, setShowDevBuildAlert] = useState(false);
|
||||||
@@ -59,7 +66,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
<body
|
<body
|
||||||
style={{
|
style={{
|
||||||
margin: 0,
|
margin: 0,
|
||||||
paddingTop: isEmbed ? 0 : '3.25rem',
|
// paddingTop: isEmbed ? 0 : '3.25rem',
|
||||||
backgroundColor: isEmbed ? 'transparent' : undefined,
|
backgroundColor: isEmbed ? 'transparent' : undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -70,93 +77,72 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
suppressHydrationWarning
|
suppressHydrationWarning
|
||||||
suppressContentEditableWarning
|
suppressContentEditableWarning
|
||||||
>
|
>
|
||||||
{!isEmbed && <Navbar />}
|
<ScrollArea
|
||||||
<AlertDialog.Root open={showDevBuildAlert}>
|
style={{
|
||||||
<AlertDialog.Content>
|
height: '100vh',
|
||||||
<AlertDialog.Title>Experimental version!</AlertDialog.Title>
|
}}
|
||||||
<AlertDialog.Description>
|
>
|
||||||
This version may have a lot of issues. Report issues to{' '}
|
<Flex direction="column" style={{ height: '100%' }}>
|
||||||
<a href="https://discord.gg/nDt7AjGJQH" target="_blank">
|
{!isEmbed && <Navbar />}
|
||||||
the official Discord server
|
<AlertDialog.Root open={showDevBuildAlert}>
|
||||||
</a>
|
<AlertDialog.Content>
|
||||||
. Also consider using{' '}
|
<AlertDialog.Title>Experimental version!</AlertDialog.Title>
|
||||||
<a href="https://blitz-krieg.vercel.app/">
|
<AlertDialog.Description>
|
||||||
the more stable release version
|
This version may have a lot of issues. Report issues to{' '}
|
||||||
</a>
|
<a href="https://discord.gg/nDt7AjGJQH" target="_blank">
|
||||||
. You will be asked again in 8 days.
|
the official Discord server
|
||||||
</AlertDialog.Description>
|
</a>
|
||||||
|
. Also consider using{' '}
|
||||||
|
<a href="https://blitz-krieg.vercel.app/">
|
||||||
|
the more stable release version
|
||||||
|
</a>
|
||||||
|
. You will be asked again in 8 days.
|
||||||
|
</AlertDialog.Description>
|
||||||
|
|
||||||
<Flex justify="end">
|
<Flex justify="end">
|
||||||
<Button
|
<Button
|
||||||
variant="solid"
|
variant="solid"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowDevBuildAlert(false);
|
setShowDevBuildAlert(false);
|
||||||
useApp.setState({ devBuildAgreementTime: Date.now() });
|
useApp.setState({ devBuildAgreementTime: Date.now() });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
|
||||||
</AlertDialog.Content>
|
|
||||||
</AlertDialog.Root>
|
|
||||||
|
|
||||||
<Flex direction="column">{children}</Flex>
|
|
||||||
|
|
||||||
{!isEmbed && !isFullScreen && (
|
|
||||||
<PageWrapper>
|
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://www.patreon.com/tresabhi"
|
|
||||||
style={{ textDecoration: 'none' }}
|
|
||||||
>
|
|
||||||
<Flex
|
|
||||||
align="center"
|
|
||||||
style={{
|
|
||||||
padding: 16,
|
|
||||||
borderRadius: 8,
|
|
||||||
backgroundColor: mintTheme.colors.componentInteractive,
|
|
||||||
position: 'relative',
|
|
||||||
overflow: 'hidden',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Flex
|
|
||||||
direction="column"
|
|
||||||
gap="1"
|
|
||||||
style={{
|
|
||||||
flex: 1,
|
|
||||||
zIndex: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text size="4" color="mint">
|
|
||||||
Blitzkrieg. Free forever. For everyone.
|
|
||||||
</Text>
|
|
||||||
<Text color="mint">
|
|
||||||
<b>Consider supporting today 🍀</b>
|
|
||||||
</Text>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
|
</AlertDialog.Content>
|
||||||
|
</AlertDialog.Root>
|
||||||
|
|
||||||
<Text
|
<Flex direction="column">{children}</Flex>
|
||||||
color="mint"
|
|
||||||
style={{
|
|
||||||
zIndex: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Flex>
|
|
||||||
<CaretRightIcon width={32} height={32} />
|
|
||||||
</Flex>
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<SkyLine
|
{!isEmbed && !isFullScreen && (
|
||||||
style={{
|
<>
|
||||||
position: 'absolute',
|
<div style={{ flex: 1 }} />
|
||||||
right: 'min(8vw, 15%)',
|
|
||||||
top: '5%',
|
<Theme radius="none">
|
||||||
}}
|
<Card>
|
||||||
/>
|
<Flex justify="center">
|
||||||
</Flex>
|
<Flex
|
||||||
</a>
|
justify="between"
|
||||||
</PageWrapper>
|
style={{
|
||||||
)}
|
flex: 1,
|
||||||
|
maxWidth: 800,
|
||||||
|
padding: '0 16px',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text color="gray">
|
||||||
|
Blitzkrieg {packageJSON.version} for WoTB 10.7
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text color="gray">Free forever, for everyone.</Text>
|
||||||
|
</Flex>
|
||||||
|
</Flex>
|
||||||
|
</Card>
|
||||||
|
</Theme>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Flex>
|
||||||
|
</ScrollArea>
|
||||||
</Theme>
|
</Theme>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { asset } from './asset';
|
||||||
|
import { fetchCdonLz4 } from './fetchCdonLz4';
|
||||||
|
|
||||||
|
export interface GameDefinitions {
|
||||||
|
version: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const gameDefinitions = fetchCdonLz4<GameDefinitions>(
|
||||||
|
asset('definitions/game.cdon.lz4'),
|
||||||
|
);
|
||||||
Reference in new issue
Block a user