mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-23 10:51:02 +00:00
fix: add delays to game launcher and open game functions
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user