aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/plugins
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2022-10-02 17:28:42 +0200
committerGitHub <noreply@github.com>2022-10-02 17:28:42 +0200
commit7fee06ec0b746340667e12c003ff7b9f0e2f1143 (patch)
tree536ead7786940a30afed5b719243813bf0e23cef /src-vue/src/plugins
parent2a32f80aedec671d812142cbbe2d0a461a4094e4 (diff)
parent52394a3e86373801f5285843d6931a692a619be1 (diff)
downloadFlightCore-7fee06ec0b746340667e12c003ff7b9f0e2f1143.tar.gz
FlightCore-7fee06ec0b746340667e12c003ff7b9f0e2f1143.zip
Merge pull request #3 from GeckoEidechse/add-launch-functionality
Add launch functionality
Diffstat (limited to 'src-vue/src/plugins')
-rw-r--r--src-vue/src/plugins/store.ts42
1 files changed, 32 insertions, 10 deletions
diff --git a/src-vue/src/plugins/store.ts b/src-vue/src/plugins/store.ts
index 7fdc7814..87c8921f 100644
--- a/src-vue/src/plugins/store.ts
+++ b/src-vue/src/plugins/store.ts
@@ -1,6 +1,7 @@
import { createStore } from 'vuex';
import { listen, Event as TauriEvent } from "@tauri-apps/api/event";
import {Tabs} from "../utils/Tabs";
+import {InstallType} from "../utils/InstallType";
import {invoke} from "@tauri-apps/api";
import {GameInstall} from "../utils/GameInstall";
import {ReleaseCanal} from "../utils/ReleaseCanal";
@@ -13,6 +14,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 +79,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 +125,7 @@ async function _initializeApp(state: any) {
alert(err);
});
state.game_path = result.game_path;
+ state.install_type = result.install_type as InstallType;
// Check installed Northstar version if found
await _get_northstar_version_number(state);