mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 23:24:35 +01:00
remove redundant option
This commit is contained in:
@@ -19,7 +19,6 @@ interface IProps {
|
||||
|
||||
interface IState {
|
||||
game_install_path: string;
|
||||
game_executable: string;
|
||||
grasscutter_path: string;
|
||||
java_path: string;
|
||||
grasscutter_with_game: boolean;
|
||||
@@ -37,7 +36,6 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
|
||||
this.state = {
|
||||
game_install_path: '',
|
||||
game_executable: '',
|
||||
grasscutter_path: '',
|
||||
java_path: '',
|
||||
grasscutter_with_game: false,
|
||||
@@ -49,7 +47,6 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
encryption: false,
|
||||
}
|
||||
|
||||
this.setGamePath = this.setGamePath.bind(this)
|
||||
this.setGameExecutable = this.setGameExecutable.bind(this)
|
||||
this.setGrasscutterJar = this.setGrasscutterJar.bind(this)
|
||||
this.setJavaPath = this.setJavaPath.bind(this)
|
||||
@@ -69,7 +66,6 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
|
||||
this.setState({
|
||||
game_install_path: config.game_install_path || '',
|
||||
game_executable: config.game_executable || '',
|
||||
grasscutter_path: config.grasscutter_path || '',
|
||||
java_path: config.java_path || '',
|
||||
grasscutter_with_game: config.grasscutter_with_game || false,
|
||||
@@ -84,7 +80,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
this.forceUpdate()
|
||||
}
|
||||
|
||||
setGamePath(value: string) {
|
||||
setGameExecutable(value: string) {
|
||||
setConfigOption('game_install_path', value)
|
||||
|
||||
this.setState({
|
||||
@@ -92,24 +88,6 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
})
|
||||
}
|
||||
|
||||
setGameExecutable(value: string) {
|
||||
if (this.state.game_install_path != '') {
|
||||
if (value.includes(this.state.game_install_path)) {
|
||||
value = value.replace(this.state.game_install_path + '\\', '')
|
||||
|
||||
setConfigOption('game_executable', value)
|
||||
|
||||
this.setState({
|
||||
game_executable: value,
|
||||
})
|
||||
} else {
|
||||
alert('Game executable must be inside the game folder!')
|
||||
}
|
||||
} else {
|
||||
alert('Please set the game install path first!')
|
||||
}
|
||||
}
|
||||
|
||||
setGrasscutterJar(value: string) {
|
||||
setConfigOption('grasscutter_path', value)
|
||||
|
||||
@@ -199,15 +177,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
<Tr text="options.game_path" />
|
||||
</div>
|
||||
<div className="OptionValue" id="menuOptionsDirGamePath">
|
||||
<DirInput onChange={this.setGamePath} value={this.state?.game_install_path} folder={true} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="OptionSection" id="menuOptionsContainerGameExecutable">
|
||||
<div className="OptionLabel" id="menuOptionsLabelGameExecutable">
|
||||
<Tr text="options.game_executable" />
|
||||
</div>
|
||||
<div className="OptionValue" id="menuOptionsDirGameExecutable">
|
||||
<DirInput onChange={this.setGameExecutable} value={this.state?.game_executable} folder={false} extensions={['exe']} openFolder={this.state?.game_install_path} />
|
||||
<DirInput onChange={this.setGameExecutable} value={this.state?.game_install_path} extensions={['exe']} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="OptionSection" id="menuOptionsContainerGCJar">
|
||||
|
||||
@@ -7,8 +7,7 @@ let defaultConfig: Configuration
|
||||
(async() => {
|
||||
defaultConfig = {
|
||||
toggle_grasscutter: false,
|
||||
game_install_path: 'C:\\Program Files\\Genshin Impact\\Genshin Impact game',
|
||||
game_executable: 'GenshinImpact.exe',
|
||||
game_install_path: 'C:\\Program Files\\Genshin Impact\\Genshin Impact game\\GenshinImpact.exe',
|
||||
grasscutter_with_game: false,
|
||||
grasscutter_path: '',
|
||||
java_path: '',
|
||||
@@ -31,7 +30,6 @@ let defaultConfig: Configuration
|
||||
export interface Configuration {
|
||||
toggle_grasscutter: boolean
|
||||
game_install_path: string
|
||||
game_executable: string
|
||||
grasscutter_with_game: boolean
|
||||
grasscutter_path: string
|
||||
java_path: string
|
||||
|
||||
@@ -7,6 +7,6 @@ export async function getGameExecutable() {
|
||||
return null
|
||||
}
|
||||
|
||||
const pathArr = config.game_executable.replace(/\\/g, '/').split('/')
|
||||
const pathArr = config.game_install_path.replace(/\\/g, '/').split('/')
|
||||
return pathArr[pathArr.length - 1].replace('.exe', '')
|
||||
}
|
||||
@@ -9,8 +9,7 @@ export async function patchMetadata() {
|
||||
})
|
||||
|
||||
if (!metadataExists) {
|
||||
alert('Global metadata not found!')
|
||||
return
|
||||
return false
|
||||
}
|
||||
|
||||
console.log('Copying unpatched metadata to backup location')
|
||||
@@ -23,7 +22,6 @@ export async function patchMetadata() {
|
||||
})
|
||||
|
||||
if (!copiedMeta) {
|
||||
alert('Failed to backup metadata!')
|
||||
console.log(await getBackupMetadataPath())
|
||||
return false
|
||||
}
|
||||
@@ -37,7 +35,6 @@ export async function patchMetadata() {
|
||||
})
|
||||
|
||||
if (!patchedMeta) {
|
||||
alert('Failed to patch metadata!')
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -51,7 +48,6 @@ export async function patchMetadata() {
|
||||
})
|
||||
|
||||
if (!replacedMeta) {
|
||||
alert('Failed to replace game metadata!')
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user