diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-10-02 01:05:50 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-10-02 12:36:37 +0200 |
commit | e545724c89c9299d9dbfa5342ec84e35967ed66b (patch) | |
tree | bf54e72c30a9e82fba190cef3931139414002b8d /src-vue | |
parent | 2a32f80aedec671d812142cbbe2d0a461a4094e4 (diff) | |
download | FlightCore-e545724c89c9299d9dbfa5342ec84e35967ed66b.tar.gz FlightCore-e545724c89c9299d9dbfa5342ec84e35967ed66b.zip |
feat: Add initial NS launch functionality
Adds logic to launch Northstar from FligthCore
Diffstat (limited to 'src-vue')
-rw-r--r-- | src-vue/src/plugins/store.ts | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts index 7fdc7814..6914150c 100644 --- a/src-vue/src/plugins/store.ts +++ b/src-vue/src/plugins/store.ts @@ -13,6 +13,7 @@ export const store = createStore({ current_tab: Tabs.PLAY, developer_mode: false, game_path: "this/is/the/game/path", + install_type: undefined, installed_northstar_version: "", northstar_state: NorthstarState.INSTALL, @@ -77,17 +78,36 @@ export const store = createStore({ return; } - // Show an error message if Origin is not running. - if (!state.origin_is_running) { - ElNotification({ - title: 'Origin is not running', - message: "Northstar cannot launch while you're not authenticated with Origin.", - type: 'warning', - position: 'bottom-right' - }); - } + // Game is ready to play + if (state.northstar_state === NorthstarState.READY_TO_PLAY) { + // Show an error message if Origin is not running. + if (!state.origin_is_running) { + ElNotification({ + title: 'Origin is not running', + message: "Northstar cannot launch while you're not authenticated with Origin.", + type: 'warning', + position: 'bottom-right' + }); - // TODO launch game + // If Origin isn't running, end here + return; + } + + let game_install = { + game_path: state.game_path, + install_type: state.install_type + } as GameInstall; + await invoke("launch_northstar_caller", { gameInstall: game_install }) + .then((message) => { + console.log(message); + // NorthstarState.RUNNING + }) + .catch((error) => { + console.error(error); + alert(error); + }); + return; + } } } }); @@ -104,6 +124,7 @@ async function _initializeApp(state: any) { alert(err); }); state.game_path = result.game_path; + state.install_type = result.install_type; // Check installed Northstar version if found await _get_northstar_version_number(state); |