[feat] video setting panel and mock

This commit is contained in:
Purp1e
2025-03-23 16:42:13 +08:00
parent 08017293b0
commit 2860408ec0
7 changed files with 238 additions and 17 deletions

View File

@@ -2,15 +2,42 @@ import { store } from "@tauri-store/valtio"
import { useSnapshot } from "valtio"
import { DEFAULT_STORE_CONFIG } from "./config"
interface LaunchOption {
option: string
name: string
}
export interface VideoSetting {
width: number; // 分辨率宽度
height: number; // 分辨率高度
fullscreen: string; // 全屏
vsync: string; // 垂直同步
enhanceCharacterContrast: string; // 增强角色对比度
cmaa2AntiAliasing: string; // CMAA2抗锯齿
msaaAntiAliasing: string; // 多重采样抗锯齿
globalShadowQuality: string; // 全局阴影效果
dynamicShadows: string; // 动态阴影
modelTextureDetail: string; // 模型/贴图细节
textureFilteringMode: string; // 贴图过滤模式
lightShadowDetail: string; // 光影细节
particleDetail: string; // 粒子细节
ambientOcclusion: string; // 环境光遮蔽
hdr: string; // 高动态范围
fidelityFxSuperResolution: string; // Fidelity FX 超级分辨率
}
const defaultValue = {
launchOptions: [
"-novid -high -freq 144 -fullscreen",
"-novid -high -w 1920 -h 1080 -freq 144 -sw -noborder",
"-novid -high -freq 144 -fullscreen -allow_third_party_software",
] as string[],
{ option: "-novid -high -freq 144 -fullscreen", name: "" },
{ option: "-novid -high -w 1920 -h 1080 -freq 144 -sw -noborder", name: "" },
{ option: "-novid -high -freq 144 -fullscreen -allow_third_party_software", name: "" },
] as LaunchOption[],
launchIndex: 0,
powerPlan: 0,
videoSetting: {
width: 1920,
height: 1080
} as VideoSetting,
}
export const toolStore = store(
@@ -30,12 +57,13 @@ export const useToolStore = () => {
setLaunchOptions,
setLaunchIndex,
setPowerPlan,
setVideoSetting,
addLaunchOption,
resetToolStore,
}
}
const setLaunchOption = (option: string, index: number) => {
const setLaunchOption = (option: LaunchOption, index: number) => {
toolStore.state.launchOptions = [
...toolStore.state.launchOptions.slice(0, index),
option,
@@ -43,7 +71,7 @@ const setLaunchOption = (option: string, index: number) => {
]
}
const setLaunchOptions = (options: string[]) => {
const setLaunchOptions = (options: LaunchOption[]) => {
toolStore.state.launchOptions = options
}
@@ -55,7 +83,11 @@ const setPowerPlan = (plan: number) => {
toolStore.state.powerPlan = plan
}
const addLaunchOption = (option: string) => {
const setVideoSetting = (setting: VideoSetting) => {
toolStore.state.videoSetting = setting
}
const addLaunchOption = (option: LaunchOption) => {
// 限制最高10个
if (toolStore.state.launchOptions.length >= 10) {
return
@@ -67,4 +99,5 @@ const resetToolStore = () => {
setLaunchOptions(defaultValue.launchOptions)
setLaunchIndex(defaultValue.launchIndex)
setPowerPlan(defaultValue.powerPlan)
setVideoSetting(defaultValue.videoSetting)
}