feat(background): updated the name of background options
This commit is contained in:
3
.env
3
.env
@@ -9,4 +9,5 @@ VITE_VIEWPORT_BOTTOM=0
|
||||
VITE_INVERT_FILTER=true
|
||||
VITE_IMAGE_WIDTH=2048
|
||||
VITE_IMAGE_HEIGHT=2048
|
||||
VITE_BACKGROUND_FILES=["background/operator_bg.png","background/bg_anniversary_1.png","background/bg_iberia_1.png","background/bg_kazimierz_1.png","background/bg_main_victoria_1.png","background/bg_rhodes_day.png","background/bg_rhodes_night.png","background/bg_rogue_1.png","background/bg_siesta_1.png","background/bg_ursus_1.png","background/bg_yan_1.png"]
|
||||
VITE_BACKGROUND_FILES=["operator_bg.png","bg_anniversary_1.png","bg_iberia_1.png","bg_kazimierz_1.png","bg_main_victoria_1.png","bg_rhodes_day.png","bg_rhodes_night.png","bg_rogue_1.png","bg_siesta_1.png","bg_ursus_1.png","bg_yan_1.png"]
|
||||
VITE_BACKGROUND_FOLDER=background
|
||||
@@ -1,9 +1,11 @@
|
||||
export default class EnvGenerator {
|
||||
#config
|
||||
#assets
|
||||
#operatorConfig
|
||||
|
||||
constructor(config, operatorName, assets) {
|
||||
this.#config = config.operators[operatorName]
|
||||
this.#config = config
|
||||
this.#operatorConfig = config.operators[operatorName]
|
||||
this.#assets = assets
|
||||
}
|
||||
|
||||
@@ -14,18 +16,19 @@ export default class EnvGenerator {
|
||||
#promise() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve([
|
||||
`VITE_TITLE="${this.#config.title}"`,
|
||||
`VITE_FILENAME=${this.#config.filename.replace('#', '%23')}`,
|
||||
`VITE_LOGO_FILENAME=${this.#config.logo}`,
|
||||
`VITE_FALLBACK_FILENAME=${this.#config.fallback_name.replace('#', '%23')}`,
|
||||
`VITE_VIEWPORT_LEFT=${this.#config.viewport_left}`,
|
||||
`VITE_VIEWPORT_RIGHT=${this.#config.viewport_right}`,
|
||||
`VITE_VIEWPORT_TOP=${this.#config.viewport_top}`,
|
||||
`VITE_VIEWPORT_BOTTOM=${this.#config.viewport_bottom}`,
|
||||
`VITE_INVERT_FILTER=${this.#config.invert_filter}`,
|
||||
`VITE_TITLE="${this.#operatorConfig.title}"`,
|
||||
`VITE_FILENAME=${this.#operatorConfig.filename.replace('#', '%23')}`,
|
||||
`VITE_LOGO_FILENAME=${this.#operatorConfig.logo}`,
|
||||
`VITE_FALLBACK_FILENAME=${this.#operatorConfig.fallback_name.replace('#', '%23')}`,
|
||||
`VITE_VIEWPORT_LEFT=${this.#operatorConfig.viewport_left}`,
|
||||
`VITE_VIEWPORT_RIGHT=${this.#operatorConfig.viewport_right}`,
|
||||
`VITE_VIEWPORT_TOP=${this.#operatorConfig.viewport_top}`,
|
||||
`VITE_VIEWPORT_BOTTOM=${this.#operatorConfig.viewport_bottom}`,
|
||||
`VITE_INVERT_FILTER=${this.#operatorConfig.invert_filter}`,
|
||||
`VITE_IMAGE_WIDTH=2048`,
|
||||
`VITE_IMAGE_HEIGHT=2048`,
|
||||
`VITE_BACKGROUND_FILES=${JSON.stringify(this.#assets.backgrounds)}`,
|
||||
`VITE_BACKGROUND_FOLDER=${this.#config.folder.background}`,
|
||||
].join('\n'))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -65,9 +65,7 @@ async function main() {
|
||||
|
||||
rmdir(OPERATOR_RELEASE_FOLDER)
|
||||
|
||||
const backgrounds = ['operator_bg.png', ...background.files].map((f) => {
|
||||
return `${config.folder.background}/${f}`
|
||||
})
|
||||
const backgrounds = ['operator_bg.png', ...background.files]
|
||||
|
||||
const projectJson = new ProjectJson(config, OPERATOR_NAME, __dirname, OPERATOR_SHARE_FOLDER, {
|
||||
backgrounds
|
||||
|
||||
@@ -126,7 +126,7 @@ export default class Settings {
|
||||
}
|
||||
|
||||
setDefaultBackground(e) {
|
||||
const backgroundURL = `url("${import.meta.env.BASE_URL}assets/${e}")`
|
||||
const backgroundURL = `url("${import.meta.env.BASE_URL}assets/${import.meta.env.VITE_BACKGROUND_FOLDER}/${e}")`
|
||||
if (document.getElementById("custom_background_clear").disabled && !document.body.style.backgroundImage.startsWith("url(\"file:")) {
|
||||
this.setBackgoundImage(backgroundURL)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user