feat: separate steam build and directory build to save space
This commit is contained in:
@@ -13,7 +13,7 @@ export default class Background {
|
||||
#parentEl
|
||||
#videoEl
|
||||
#default = {
|
||||
location: `${import.meta.env.BASE_URL}assets/${buildConfig.background_folder}/`,
|
||||
location: `${import.meta.env.BASE_URL}${buildConfig.build_assets_dir}${buildConfig.background_folder}/`,
|
||||
image: buildConfig.default_background,
|
||||
}
|
||||
#config = {
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class Fallback {
|
||||
this.#el.innerHTML = `
|
||||
<div id="fallback-container">
|
||||
<div id="fallback"
|
||||
style="background-image: url(./assets/${buildConfig.fallback_name}.png)"
|
||||
style="background-image: url(${import.meta.env.BASE_URL}${buildConfig.default_assets_dir}${buildConfig.fallback_name}.png)"
|
||||
/>
|
||||
</div>
|
||||
`
|
||||
|
||||
@@ -13,7 +13,7 @@ export default class Logo {
|
||||
#imageEl
|
||||
#parentEl
|
||||
#default = {
|
||||
location: `${import.meta.env.BASE_URL}assets/`,
|
||||
location: `${import.meta.env.BASE_URL}${buildConfig.build_assets_dir}${buildConfig.logo_dir}`,
|
||||
image: `${buildConfig.logo_filename}.png`,
|
||||
useInvertFilter: buildConfig.invert_filter,
|
||||
ratio: 61.8,
|
||||
|
||||
@@ -104,8 +104,8 @@ export default class Music {
|
||||
#playMusic() {
|
||||
if (!this.#config.name) {
|
||||
const introOgg = this.#music.mapping[this.#music.current].intro
|
||||
const intro = `./assets/${this.#music.location}/${introOgg}`
|
||||
const loop = `./assets/${this.#music.location}/${this.#music.mapping[this.#music.current].loop}`
|
||||
const intro = `${import.meta.env.BASE_URL}${buildConfig.build_assets_dir}${this.#music.location}/${introOgg}`
|
||||
const loop = `${import.meta.env.BASE_URL}${buildConfig.build_assets_dir}${this.#music.location}/${this.#music.mapping[this.#music.current].loop}`
|
||||
this.#audio.loop.el.src = loop
|
||||
this.#audio.loop.el.querySelector('source').type = 'audio/ogg'
|
||||
if (introOgg) {
|
||||
|
||||
@@ -45,7 +45,7 @@ export default class Player {
|
||||
async init() {
|
||||
const _this = this
|
||||
const playerConfig = {
|
||||
atlasUrl: `./assets/${buildConfig.filename}.atlas`,
|
||||
atlasUrl: `${import.meta.env.BASE_URL}${buildConfig.default_assets_dir}${buildConfig.filename}.atlas`,
|
||||
premultipliedAlpha: true,
|
||||
alpha: true,
|
||||
backgroundColor: '#00000000',
|
||||
@@ -115,9 +115,9 @@ export default class Player {
|
||||
},
|
||||
}
|
||||
if (buildConfig.use_json) {
|
||||
playerConfig.jsonUrl = `./assets/${buildConfig.filename}.json`
|
||||
playerConfig.jsonUrl = `${import.meta.env.BASE_URL}${buildConfig.default_assets_dir}${buildConfig.filename}.json`
|
||||
} else {
|
||||
playerConfig.skelUrl = `./assets/${buildConfig.filename}.skel`
|
||||
playerConfig.skelUrl = `${import.meta.env.BASE_URL}${buildConfig.default_assets_dir}${buildConfig.filename}.skel`
|
||||
}
|
||||
this.#spine = new SpinePlayer(this.#el, playerConfig)
|
||||
}
|
||||
|
||||
@@ -83,7 +83,9 @@ export default class Voice {
|
||||
}
|
||||
|
||||
async init() {
|
||||
const res = await fetch('./assets/charword_table.json')
|
||||
const res = await fetch(
|
||||
`${import.meta.env.BASE_URL}${buildConfig.default_assets_dir}charword_table.json`
|
||||
)
|
||||
this.#charwordTable = await res.json()
|
||||
this.#voice.languages = Object.keys(
|
||||
this.#charwordTable.voiceLangs[this.#default.region]
|
||||
@@ -170,7 +172,7 @@ export default class Voice {
|
||||
if (!this.useVoice) return
|
||||
this.#voice.id.last = this.#voice.id.current
|
||||
this.#voice.id.current = id
|
||||
this.#audio.el.src = `./assets/${this.#getVoiceLocation()}/${id}.ogg`
|
||||
this.#audio.el.src = `${import.meta.env.BASE_URL}${buildConfig.default_assets_dir}${this.#getVoiceLocation()}/${id}.ogg`
|
||||
let startPlayPromise = this.#audio.el.play()
|
||||
if (startPlayPromise !== undefined) {
|
||||
startPlayPromise
|
||||
|
||||
Reference in New Issue
Block a user