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