mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
game mode banners
This commit is contained in:
1 parent
36dbb24572
commit
996c9c05df
4 files changed
+25
-18
No files matched your search
+2
-1
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"words": [
|
||||
"gamemodes",
|
||||
"Tankopedia"
|
||||
]
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -33,7 +33,7 @@ export function Equalizer() {
|
||||
style={{
|
||||
cursor: "pointer",
|
||||
borderRadius: "var(--radius-3)",
|
||||
backgroundImage: "url(/api/icons/game_mode_banners/45.webp)",
|
||||
backgroundImage: "url(/api/gamemodes/45/banner.webp)",
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
overflow: "hidden",
|
||||
|
||||
@@ -37,7 +37,7 @@ export function GameModeSection() {
|
||||
direction="column"
|
||||
style={{
|
||||
borderRadius: "var(--radius-3)",
|
||||
background: `url(/api/icons/game_mode_banners/${id}.webp)`,
|
||||
background: `url(/api/gamemodes/${id}/banner.webp)`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
}}
|
||||
@@ -45,7 +45,7 @@ export function GameModeSection() {
|
||||
<Box
|
||||
flexGrow="1"
|
||||
style={{
|
||||
background: `url(/api/icons/game_mode_banners/${id}.webp)`,
|
||||
background: `url(/api/gamemodes/${id}/banner.webp)`,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
}}
|
||||
|
||||
+20
-14
@@ -1,12 +1,13 @@
|
||||
import type { SquadBattleTypeStylesYaml } from "@blitzkit/core";
|
||||
import type { APIContext, GetStaticPathsItem } from "astro";
|
||||
import sharp from "sharp";
|
||||
import { AssetUploader } from "../core/github/assetUploader";
|
||||
import { vfs } from "./constants";
|
||||
import { SquadBattleTypeStylesYaml } from "./definitions";
|
||||
import { mixStaticPaths } from "../../../../core/blitzkit/mixStaticPaths";
|
||||
import { vfs } from "../../../../core/blitzkit/vfs";
|
||||
import { getStaticPaths as _getStaticPaths } from "../../_index";
|
||||
|
||||
export async function gameModeBanners() {
|
||||
console.log("Building game mode banners...");
|
||||
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
|
||||
const paths: GetStaticPathsItem[] = [];
|
||||
|
||||
using uploader = new AssetUploader("game mode banners");
|
||||
const gameTypeSelectorStyles = await vfs.yaml<SquadBattleTypeStylesYaml>(
|
||||
`Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`,
|
||||
);
|
||||
@@ -34,15 +35,20 @@ export async function gameModeBanners() {
|
||||
path = `/Gfx/UI/Hangar/GameTypes/battle-type_${name.toLowerCase()}`;
|
||||
}
|
||||
|
||||
const content = await sharp(await vfs.file(`Data${path}.packed.webp`))
|
||||
.trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } })
|
||||
.toBuffer();
|
||||
|
||||
await uploader.add({
|
||||
path: `icons/game_mode_banners/${id}.webp`,
|
||||
content,
|
||||
paths.push({
|
||||
params: { id },
|
||||
props: { path: `Data${path}.packed.webp` },
|
||||
});
|
||||
}
|
||||
|
||||
await uploader.flush();
|
||||
return paths;
|
||||
});
|
||||
|
||||
export async function GET({ props }: APIContext<{ path: string }>) {
|
||||
const buffer = await sharp(await vfs.file(props.path))
|
||||
.trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } })
|
||||
.toBuffer();
|
||||
const bytes = new Uint8Array(buffer);
|
||||
|
||||
return new Response(bytes);
|
||||
}
|
||||
Reference in new issue
Block a user