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