mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 07:34:36 +01:00
Implement semi-working custom backgrounds
This commit is contained in:
@@ -27,11 +27,11 @@ select:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.App {
|
.App {
|
||||||
/*background: url("https://webstatic.hoyoverse.com/upload/event/2020/11/04/7fd661b5184e1734f91f628b6f89a31f_7367318474207189623.png") no-repeat center center fixed; */
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
-webkit-background-size: cover;
|
-webkit-background-size: cover;
|
||||||
-moz-background-size: cover;
|
-moz-background-size: cover;
|
||||||
-o-background-size: cover;
|
-o-background-size: cover;
|
||||||
background-size: cover;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.TopButton {
|
.TopButton {
|
||||||
|
|||||||
@@ -75,21 +75,24 @@ class App extends React.Component<IProps, IState> {
|
|||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
const cert_generated = await getConfigOption('cert_generated')
|
const cert_generated = await getConfigOption('cert_generated')
|
||||||
const game_exe = await getConfigOption('game_install_path')
|
const game_exe = await getConfigOption('game_install_path')
|
||||||
|
const custom_bg = await getConfigOption('customBackground')
|
||||||
const game_path = game_exe.substring(0, game_exe.lastIndexOf('\\'))
|
const game_path = game_exe.substring(0, game_exe.lastIndexOf('\\'))
|
||||||
const root_path = game_path.substring(0, game_path.lastIndexOf('\\'))
|
const root_path = game_path.substring(0, game_path.lastIndexOf('\\'))
|
||||||
|
|
||||||
if (game_path) {
|
if(!custom_bg) {
|
||||||
// Get the bg by invoking, then set the background to that bg
|
if(game_path) {
|
||||||
const bgLoc: string = await invoke('get_bg_file', {
|
// Get the bg by invoking, then set the background to that bg.
|
||||||
bgPath: root_path,
|
const bgLoc: string = await invoke('get_bg_file', {
|
||||||
})
|
bgPath: root_path
|
||||||
|
})
|
||||||
|
|
||||||
if (bgLoc) {
|
bgLoc && this.setState({
|
||||||
this.setState({
|
|
||||||
bgFile: bgLoc
|
bgFile: bgLoc
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
} else this.setState({
|
||||||
|
bgFile: custom_bg
|
||||||
|
})
|
||||||
|
|
||||||
if (!cert_generated) {
|
if (!cert_generated) {
|
||||||
// Generate the certificate
|
// Generate the certificate
|
||||||
@@ -106,13 +109,15 @@ class App extends React.Component<IProps, IState> {
|
|||||||
isDownloading: downloadHandler.getDownloads().filter(d => d.status !== 'finished')?.length > 0
|
isDownloading: downloadHandler.getDownloads().filter(d => d.status !== 'finished')?.length > 0
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
|
console.log('mounting app component with background: ' + this.state.bgFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="App" style={
|
<div className="App" style={
|
||||||
this.state.bgFile ? {
|
this.state.bgFile ? {
|
||||||
background: `url(${this.state.bgFile}) no-repeat center center fixed`,
|
background: `url(${this.state.bgFile} fixed`,
|
||||||
} : {}
|
} : {}
|
||||||
}>
|
}>
|
||||||
<TopBar
|
<TopBar
|
||||||
|
|||||||
Reference in New Issue
Block a user