[feat] enable replay analysis workflow but json file is not parsed
This commit is contained in:
@@ -1,4 +1,66 @@
|
||||
"use client"
|
||||
|
||||
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "@/components/window/Card"
|
||||
import { MovieBoard } from "@icon-park/react"
|
||||
import { ToolButton } from "@/components/window/ToolButton"
|
||||
import { invoke } from "@tauri-apps/api/core"
|
||||
import path from "path"
|
||||
import { useSteamStore } from "@/store/steam"
|
||||
import { addToast } from "@heroui/react"
|
||||
// import { Command } from "@tauri-apps/plugin-shell"
|
||||
|
||||
export default function Page() {
|
||||
return <div>Movie</div>
|
||||
const steam = useSteamStore()
|
||||
const testDemo = async (demo_name: string) => {
|
||||
const res = await invoke("analyze_replay", {
|
||||
path: path.resolve(
|
||||
steam.cs2BaseDir(),
|
||||
"game",
|
||||
"csgo",
|
||||
"replays",
|
||||
"test.dem"
|
||||
),
|
||||
})
|
||||
console.log("test.dem", "→", res)
|
||||
// const demo_path = path.resolve(
|
||||
// '"',
|
||||
// steam.cs2BaseDir(),
|
||||
// "game",
|
||||
// "csgo",
|
||||
// "replays",
|
||||
// demo_name,
|
||||
// '"'
|
||||
// )
|
||||
// const command = Command.sidecar("bin/csda", [
|
||||
// "-demo-path",
|
||||
// "D:\\Programs\\Steam\\steamapps\\common\\Counter-Strike Global Offensive\\game\\csgo\\replays",
|
||||
// "-format",
|
||||
// "json",
|
||||
// "-minify",
|
||||
// ])
|
||||
// const output = await command.execute()
|
||||
// console.log("output", output)
|
||||
addToast({ title: "解析成功" })
|
||||
}
|
||||
return (
|
||||
<section className="flex flex-col gap-4 overflow-hidden">
|
||||
<Card className="overflow-hidden">
|
||||
<CardHeader>
|
||||
<CardIcon>
|
||||
<MovieBoard /> 录像
|
||||
</CardIcon>
|
||||
<CardTool>
|
||||
<ToolButton
|
||||
onClick={async () => {
|
||||
await testDemo("test.dem")
|
||||
}}
|
||||
>
|
||||
读取
|
||||
</ToolButton>
|
||||
</CardTool>
|
||||
</CardHeader>
|
||||
<CardBody className="overflow-y-hidden">录像</CardBody>
|
||||
</Card>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user