aboutsummaryrefslogtreecommitdiff
path: root/src-vue/src/plugins
diff options
context:
space:
mode:
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);