feat(sounds): integrate sound effects for game actions in Minesweeper
This commit is contained in:
parent
b9999fceff
commit
3faa01353d
2 changed files with 9 additions and 6 deletions
|
|
@ -20,6 +20,7 @@ import { PROFILE_UPDATE_EVENT } from "@/hooks/useGameTick";
|
||||||
import { useSessionExpired } from "@/hooks/useSessionExpired";
|
import { useSessionExpired } from "@/hooks/useSessionExpired";
|
||||||
import { LoginLink } from "@/components/frontend/auth/LoginLink";
|
import { LoginLink } from "@/components/frontend/auth/LoginLink";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
import { playClear, playExplosion, playFlag, playReveal, playXp } from "./sounds";
|
||||||
|
|
||||||
type Phase = "ready" | "playing" | "over";
|
type Phase = "ready" | "playing" | "over";
|
||||||
type GameMode = EodDifficulty | "custom";
|
type GameMode = EodDifficulty | "custom";
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
import { spawnSync } from "child_process";
|
import { spawnSync } from "child_process";
|
||||||
import { existsSync, mkdirSync, readFileSync } from "fs";
|
import { existsSync, mkdirSync, readFileSync } from "fs";
|
||||||
import { dirname, join } from "path";
|
import { dirname, join } from "path";
|
||||||
|
import { getPayload } from "payload";
|
||||||
|
import config from "@payload-config";
|
||||||
|
|
||||||
interface CliOpts {
|
interface CliOpts {
|
||||||
catalog?: string[];
|
catalog?: string[];
|
||||||
|
|
@ -43,8 +45,9 @@ function parseCli(argv: string[]): CliOpts {
|
||||||
if (a === "--approve") { opts.approve = true; continue; }
|
if (a === "--approve") { opts.approve = true; continue; }
|
||||||
if (a === "--dry-run") { opts["dry-run"] = true; continue; }
|
if (a === "--dry-run") { opts["dry-run"] = true; continue; }
|
||||||
if (a.startsWith("--") && i + 1 < argv.length && !argv[i + 1].startsWith("--")) {
|
if (a.startsWith("--") && i + 1 < argv.length && !argv[i + 1].startsWith("--")) {
|
||||||
const key = a.slice(2) as keyof CliOpts;
|
const key = a.slice(2) as Exclude<keyof CliOpts, "approve" | "dry-run">;
|
||||||
(opts[key] ??= []).push(argv[++i]);
|
const value = argv[++i];
|
||||||
|
(opts[key] ??= []).push(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return opts;
|
return opts;
|
||||||
|
|
@ -135,7 +138,7 @@ function planImport(
|
||||||
const ref = iconRef || pictureRef;
|
const ref = iconRef || pictureRef;
|
||||||
const paaPath = ref ? resolvePaaPath(ref, lookups.paaRoot) : "";
|
const paaPath = ref ? resolvePaaPath(ref, lookups.paaRoot) : "";
|
||||||
const pngPath = paaPath
|
const pngPath = paaPath
|
||||||
? convertPaaToPng(lookups.hemtt, paaPath, join(lookups.outDir))
|
? (convertPaaToPng(lookups.hemtt, paaPath, join(lookups.outDir)) ?? "")
|
||||||
: "";
|
: "";
|
||||||
const screenshotPath = lookups.screenshots
|
const screenshotPath = lookups.screenshots
|
||||||
? (["png", "webp", "jpg"].map((e) => join(lookups.screenshots, clazz + "." + e)).find(existsSync) ?? "")
|
? (["png", "webp", "jpg"].map((e) => join(lookups.screenshots, clazz + "." + e)).find(existsSync) ?? "")
|
||||||
|
|
@ -151,7 +154,7 @@ async function resolveFuelConfig(payload: { find: (args: any) => Promise<{ docs:
|
||||||
}
|
}
|
||||||
|
|
||||||
async function writeEntry(
|
async function writeEntry(
|
||||||
payload: { create: (args: { collection: string; data: any }) => Promise<any>; update: (args: { collection: string; id: number; data: any }) => Promise<any> },
|
payload: any,
|
||||||
plan: ImportPlan,
|
plan: ImportPlan,
|
||||||
opts: { outDir: string },
|
opts: { outDir: string },
|
||||||
fuelId: number,
|
fuelId: number,
|
||||||
|
|
@ -229,8 +232,7 @@ async function main() {
|
||||||
|
|
||||||
if (dryRun) { console.log(`\nDry run: ${plans.length} would import, 0 applied.`); return; }
|
if (dryRun) { console.log(`\nDry run: ${plans.length} would import, 0 applied.`); return; }
|
||||||
|
|
||||||
const { getPayload } = await import("@payload-config");
|
const payload = await getPayload({ config });
|
||||||
const payload = await getPayload({ config: (await import("@payload-config")).default });
|
|
||||||
const fuel = await resolveFuelConfig(payload);
|
const fuel = await resolveFuelConfig(payload);
|
||||||
let ok = 0, err = 0;
|
let ok = 0, err = 0;
|
||||||
for (const plan of plans) {
|
for (const plan of plans) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue