[fix] function call
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
import { TakeOff } from "@icon-park/react"
|
||||
import { invoke } from "@tauri-apps/api/core"
|
||||
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
|
||||
import { steamStore } from "@/store/steam"
|
||||
import { toolStore } from "@/store/tool"
|
||||
import { useSnapshot } from "valtio"
|
||||
// import { addToast } from "@heroui/react"
|
||||
|
||||
const FastLaunch = () => {
|
||||
void toolStore.start()
|
||||
void steamStore.start()
|
||||
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
|
||||
const { dir } = useSnapshot(steamStore.state)
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
@@ -16,12 +25,12 @@ const FastLaunch = () => {
|
||||
type="button"
|
||||
onClick={() =>
|
||||
invoke("launch_game", {
|
||||
// steamPath: steam.dir + "/steam.exe",
|
||||
// launchOption: launchOptions.value[launchIndex.value] || "",
|
||||
steamPath: dir + "/steam.exe",
|
||||
launchOption: launchOptions[launchIndex] || "",
|
||||
server: "perfectworld",
|
||||
})
|
||||
}
|
||||
className="px-5 font-medium py-1.5 transition bg-red-200 rounded-full"
|
||||
className="px-5 font-medium py-1.5 transition bg-red-200 dark:bg-red-900/60 rounded-full"
|
||||
>
|
||||
启动国服
|
||||
</button>
|
||||
@@ -29,12 +38,12 @@ const FastLaunch = () => {
|
||||
type="button"
|
||||
onClick={() =>
|
||||
invoke("launch_game", {
|
||||
// steamPath: steam.dir + "/steam.exe",
|
||||
// launchOption: launchOptions.value[launchIndex.value] || "",
|
||||
steamPath: dir + "/steam.exe",
|
||||
launchOption: launchOptions[launchIndex] || "",
|
||||
server: "worldwide",
|
||||
})
|
||||
}
|
||||
className="px-5 font-medium py-1.5 transition bg-orange-200 rounded-full"
|
||||
className="px-5 font-medium py-1.5 transition bg-orange-200 dark:bg-orange-900/60 rounded-full"
|
||||
>
|
||||
启动国际服
|
||||
</button>
|
||||
|
||||
@@ -15,14 +15,14 @@ const ForceQuit = () => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => invoke("kill_steam")}
|
||||
className="px-5 font-medium py-1.5 transition bg-blue-200 rounded-full"
|
||||
className="px-5 font-medium py-1.5 transition bg-blue-200 dark:bg-blue-900/60 rounded-full"
|
||||
>
|
||||
关闭Steam
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => invoke("kill_game")}
|
||||
className="px-5 font-medium py-1.5 transition bg-orange-200 rounded-full"
|
||||
className="px-5 font-medium py-1.5 transition bg-orange-200 dark:bg-orange-900/60 rounded-full"
|
||||
>
|
||||
关闭CS2
|
||||
</button>
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
import { setValtioPath } from 'tauri-plugin-valtio';
|
||||
import {appConfigDir} from '@tauri-apps/api/path'
|
||||
import path from 'path';
|
||||
|
||||
async function init() {
|
||||
const configDir = await appConfigDir()
|
||||
const distDir = path.join(configDir, 'cstb')
|
||||
await setValtioPath(distDir);
|
||||
// console.log('init valtio', distDir);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
export const DEFAULT_STORE_CONFIG = {
|
||||
saveOnChange: true,
|
||||
saveOnExit: true,
|
||||
|
||||
Reference in New Issue
Block a user