aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/stores/game.svelte.ts
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-01-18 12:24:29 +0800
committerGitHub <noreply@github.com>2026-01-18 12:24:29 +0800
commitfd00ac6878b2cee9337b9e92d0c990ecdce9a346 (patch)
treebb5540f763dc0061877c9d9ac53747d79193eecc /ui/src/stores/game.svelte.ts
parentad36e0ce82770f9b3509ddb1cf96bc3422969806 (diff)
parent6d82ab2275130f3bafdb7ec664297eb700321526 (diff)
downloadDropOut-fd00ac6878b2cee9337b9e92d0c990ecdce9a346.tar.gz
DropOut-fd00ac6878b2cee9337b9e92d0c990ecdce9a346.zip
Merge pull request #58 from HsiangNianian/main
Diffstat (limited to 'ui/src/stores/game.svelte.ts')
-rw-r--r--ui/src/stores/game.svelte.ts25
1 files changed, 19 insertions, 6 deletions
diff --git a/ui/src/stores/game.svelte.ts b/ui/src/stores/game.svelte.ts
index 28b2db5..1e4119f 100644
--- a/ui/src/stores/game.svelte.ts
+++ b/ui/src/stores/game.svelte.ts
@@ -2,6 +2,7 @@ import { invoke } from "@tauri-apps/api/core";
import type { Version } from "../types";
import { uiState } from "./ui.svelte";
import { authState } from "./auth.svelte";
+import { instancesState } from "./instances.svelte";
export class GameState {
versions = $state<Version[]>([]);
@@ -14,10 +15,8 @@ export class GameState {
async loadVersions() {
try {
this.versions = await invoke<Version[]>("get_versions");
- if (this.versions.length > 0) {
- const latest = this.versions.find((v) => v.type === "release");
- this.selectedVersion = latest ? latest.id : this.versions[0].id;
- }
+ // Don't auto-select version here - let BottomBar handle version selection
+ // based on installed versions only
} catch (e) {
console.error("Failed to fetch versions:", e);
uiState.setStatus("Error fetching versions: " + e);
@@ -36,10 +35,24 @@ export class GameState {
return;
}
+ if (!instancesState.activeInstanceId) {
+ alert("Please select an instance first!");
+ uiState.setView("instances");
+ return;
+ }
+
uiState.setStatus("Preparing to launch " + this.selectedVersion + "...");
- console.log("Invoking start_game for version:", this.selectedVersion);
+ console.log(
+ "Invoking start_game for version:",
+ this.selectedVersion,
+ "instance:",
+ instancesState.activeInstanceId,
+ );
try {
- const msg = await invoke<string>("start_game", { versionId: this.selectedVersion });
+ const msg = await invoke<string>("start_game", {
+ instanceId: instancesState.activeInstanceId,
+ versionId: this.selectedVersion,
+ });
console.log("Response:", msg);
uiState.setStatus(msg);
} catch (e) {