fix: add delays to game launcher and open game functions

This commit is contained in:
Moyasee
2026-01-22 09:43:08 +02:00
parent 9824f7a905
commit bdbf54f72a
3 changed files with 5 additions and 5 deletions

View File

@@ -30,7 +30,9 @@ const openGame = async (
});
// Always show the launcher window when launching a game
WindowManager.createGameLauncherWindow(shop, objectId);
await WindowManager.createGameLauncherWindow(shop, objectId);
await new Promise((resolve) => setTimeout(resolve, 2000));
if (parsedParams.length === 0) {
shell.openPath(parsedPath);

View File

@@ -188,6 +188,8 @@ const handleRunGame = async (shop: GameShop, objectId: string) => {
WindowManager.createMainWindow();
}
await new Promise((resolve) => setTimeout(resolve, 2000));
const parsedPath = parseExecutablePath(game.executablePath);
const parsedParams = parseLaunchOptions(game.launchOptions);

View File

@@ -52,7 +52,6 @@ export default function GameLauncher() {
}
}, [shop, objectId]);
// Fallback auto-close timer - game detection will usually close it sooner
useEffect(() => {
if (!windowShown) return;
@@ -91,19 +90,16 @@ export default function GameLauncher() {
}
}, []);
// Extract color as soon as we have the image URL
useEffect(() => {
if (coverImage && !colorExtracted) {
extractAccentColor(coverImage);
}
}, [coverImage, colorExtracted, extractAccentColor]);
// Only show content when both image is loaded and color is extracted successfully
const isReady = imageLoaded && colorExtracted && !colorError;
const hasFailed =
imageError || colorError || (!coverImage && gameAssets !== null);
// Show or close window based on loading state
useEffect(() => {
if (windowShown) return;