mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 23:54:48 +01:00
save options
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from 'react'
|
||||
import { getConfig } from '../../../utils/configuration'
|
||||
import { getConfig, saveConfig } from '../../../utils/configuration'
|
||||
import Checkbox from '../common/Checkbox'
|
||||
import Menu from './Menu'
|
||||
|
||||
@@ -42,11 +42,22 @@ export class ExtrasMenu extends React.Component<IProps, IState> {
|
||||
this.setState({
|
||||
migoto: config.migoto_path,
|
||||
akebi: config.akebi_path,
|
||||
launch_akebi: config?.last_extras?.akebi ?? false,
|
||||
launch_migoto: config?.last_extras?.migoto ?? false,
|
||||
// TODO reshade
|
||||
})
|
||||
}
|
||||
|
||||
async launchPreprograms() {
|
||||
const config = await getConfig()
|
||||
|
||||
config.last_extras = {
|
||||
migoto: this.state.launch_migoto,
|
||||
akebi: this.state.launch_akebi,
|
||||
}
|
||||
|
||||
await saveConfig(config)
|
||||
|
||||
// This injects independent of the game
|
||||
if (this.state.launch_migoto) {
|
||||
await this.launchMigoto()
|
||||
|
||||
@@ -51,6 +51,10 @@ export interface Configuration {
|
||||
// Swag stuff
|
||||
akebi_path?: string
|
||||
migoto_path?: string
|
||||
last_extras?: {
|
||||
migoto: boolean
|
||||
akebi: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export async function setConfigOption<K extends keyof Configuration>(key: K, value: Configuration[K]): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user