fix: fixed several wallpaper enginer related issues
This commit is contained in:
@@ -221,15 +221,14 @@ export default class AKLive2D {
|
||||
])
|
||||
|
||||
this.#music.link(this.#background)
|
||||
this.#background.link(this.#music)
|
||||
this.#voice.link(this.#player)
|
||||
this.#applyConfig()
|
||||
|
||||
this.#player.success()
|
||||
this.#voice.success()
|
||||
this.#music.success()
|
||||
this.#insight.success()
|
||||
|
||||
this.#applyConfig()
|
||||
|
||||
if (
|
||||
this.#queries.has('aklive2d') ||
|
||||
import.meta.env.MODE === 'development'
|
||||
|
||||
@@ -24,7 +24,6 @@ export default class Background {
|
||||
useVideo: false,
|
||||
name: null,
|
||||
}
|
||||
#musicObj
|
||||
|
||||
constructor(el) {
|
||||
this.#parentEl = el
|
||||
@@ -59,10 +58,6 @@ export default class Background {
|
||||
this.resetVideo()
|
||||
}
|
||||
|
||||
link(musicObj) {
|
||||
this.#musicObj = musicObj
|
||||
}
|
||||
|
||||
get useVideo() {
|
||||
return this.#config.useVideo
|
||||
}
|
||||
@@ -113,8 +108,8 @@ export default class Background {
|
||||
|
||||
set default(v) {
|
||||
this.#default.image = v
|
||||
this.#musicObj.music = v
|
||||
this.image = this.#default.location + this.#default.image
|
||||
if (!this.#config.name)
|
||||
this.image = this.#default.location + this.#default.image
|
||||
}
|
||||
|
||||
set custom(v) {
|
||||
|
||||
@@ -15,7 +15,7 @@ export default class Logo {
|
||||
#default = {
|
||||
location: `${import.meta.env.BASE_URL}assets/`,
|
||||
image: `${buildConfig.logo_filename}.png`,
|
||||
useInvertFilter: buildConfig.invert_filter === 'true',
|
||||
useInvertFilter: buildConfig.invert_filter,
|
||||
ratio: 61.8,
|
||||
opacity: 30,
|
||||
hidden: false,
|
||||
|
||||
@@ -89,7 +89,6 @@ export default class Music {
|
||||
reset() {
|
||||
document.getElementById('custom-music').value = ''
|
||||
document.getElementById('custom-music-clear').disabled = true
|
||||
this.#music.isUsingCustom = false
|
||||
this.#config.name = null
|
||||
if (this.#config.useMusic) {
|
||||
this.#playMusic()
|
||||
@@ -99,12 +98,11 @@ export default class Music {
|
||||
#setMusic(data, type) {
|
||||
this.#audio.loop.el.src = data
|
||||
this.#audio.loop.el.querySelector('source').type = type
|
||||
this.#music.isUsingCustom = true
|
||||
this.#playMusic()
|
||||
}
|
||||
|
||||
#playMusic() {
|
||||
if (!this.#music.isUsingCustom) {
|
||||
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}`
|
||||
@@ -179,13 +177,13 @@ export default class Music {
|
||||
}
|
||||
|
||||
get isUsingCustom() {
|
||||
return this.#music.isUsingCustom
|
||||
return this.#config.name !== null
|
||||
}
|
||||
|
||||
set music(name) {
|
||||
if (name !== null && name !== this.#music.current) {
|
||||
this.#music.current = name
|
||||
if (this.#config.useMusic && !this.#music.isUsingCustom) {
|
||||
if (this.#config.useMusic && !this.#config.name) {
|
||||
this.#audio.loop.el.pause()
|
||||
this.#audio.intro.el.pause()
|
||||
this.#playMusic()
|
||||
|
||||
@@ -116,7 +116,7 @@ export default class Player {
|
||||
document.dispatchEvent(Events.Ready.handler())
|
||||
},
|
||||
}
|
||||
if (buildConfig.use_json === 'true') {
|
||||
if (buildConfig.use_json) {
|
||||
playerConfig.jsonUrl = `./assets/${buildConfig.filename}.json`
|
||||
} else {
|
||||
playerConfig.skelUrl = `./assets/${buildConfig.filename}.skel`
|
||||
|
||||
@@ -148,9 +148,10 @@ export default class Voice {
|
||||
return folders
|
||||
}
|
||||
|
||||
#getVoices() {
|
||||
return this.#charwordTable.subtitleLangs[this.#config.subtitle.language]
|
||||
.default
|
||||
#getVoices(lang = null) {
|
||||
return this.#charwordTable.subtitleLangs[
|
||||
lang ? lang : this.#config.subtitle.language
|
||||
].default
|
||||
}
|
||||
|
||||
#playEntryVoice() {
|
||||
@@ -158,7 +159,7 @@ export default class Voice {
|
||||
}
|
||||
|
||||
#playSpecialVoice(matcher) {
|
||||
const voices = this.#getVoices()
|
||||
const voices = this.#getVoices(buildConfig.voice_default_region)
|
||||
const voiceId = Object.keys(voices).find(
|
||||
(e) => voices[e].title === matcher
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user