From 294bda0a85eb99d9975ffee3c7896da4f760a73f Mon Sep 17 00:00:00 2001 From: GeckoEidechse Date: Sat, 10 Sep 2022 20:47:04 +0200 Subject: Update button if Northstar launched --- src-ui/src/main.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src-ui/src/main.ts') diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts index 70af0999..103e5178 100644 --- a/src-ui/src/main.ts +++ b/src-ui/src/main.ts @@ -9,6 +9,7 @@ const button_in_install_string = "Installing..."; const button_update_string = "Update Northstar"; const button_in_update_string = "Updating..."; const button_play_string = "Launch Northstar"; +const button_launched_string = "Launched Northstar"; const button_manual_find_string = "Manually select Titanfall2 install location"; interface GameInstall { @@ -27,7 +28,7 @@ async function get_northstar_version_number_and_set_button_accordingly(omniButto let northstar_version_number = await invoke("get_northstar_version_number_caller", { gamePath: globalState.gamepath }) as string; if (northstar_version_number && northstar_version_number.length > 0) { globalState.installed_northstar_version = northstar_version_number; - omniButtonEl.textContent = `${button_play_string} (${northstar_version_number})`; + omniButtonEl.textContent = `${button_play_string} (v${northstar_version_number})`; await invoke("check_is_northstar_outdated", { gamePath: globalState.gamepath }) .then((message) => { console.log(message); @@ -146,7 +147,7 @@ document.addEventListener("DOMContentLoaded", async function () { break; // Launch Northstar - case `${button_play_string} (${globalState.installed_northstar_version})`: + case `${button_play_string} (v${globalState.installed_northstar_version})`: let game_install = { game_path: globalState.gamepath, install_type: installTypeHolderEl.textContent @@ -154,7 +155,7 @@ document.addEventListener("DOMContentLoaded", async function () { await invoke("launch_northstar", { gameInstall: game_install }) .then((message) => { console.log(message); - alert(message); + omniButtonEl.textContent = `${button_launched_string} (v${globalState.installed_northstar_version})`; }) .catch((error) => { console.error(error); @@ -162,9 +163,10 @@ document.addEventListener("DOMContentLoaded", async function () { }); break; - // Do nothing when clicked during install/update + // Do nothing when clicked during install/update/game-launched case button_in_update_string: case button_in_install_string: + case `${button_launched_string} (v${globalState.installed_northstar_version})`: break; // Fallback -- cgit v1.2.3