Skip to content

Commit 106b6c9

Browse files
committed
fix: fixed some wallpaper engine issues
1 parent 1852895 commit 106b6c9

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

apps/showcase/src/components/aklive2d.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -221,15 +221,14 @@ export default class AKLive2D {
221221
])
222222

223223
this.#music.link(this.#background)
224-
this.#background.link(this.#music)
225224
this.#voice.link(this.#player)
225+
this.#applyConfig()
226+
226227
this.#player.success()
227228
this.#voice.success()
228229
this.#music.success()
229230
this.#insight.success()
230231

231-
this.#applyConfig()
232-
233232
if (
234233
this.#queries.has('aklive2d') ||
235234
import.meta.env.MODE === 'development'

apps/showcase/src/components/background.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export default class Background {
2424
useVideo: false,
2525
name: null,
2626
}
27-
#musicObj
2827

2928
constructor(el) {
3029
this.#parentEl = el
@@ -59,10 +58,6 @@ export default class Background {
5958
this.resetVideo()
6059
}
6160

62-
link(musicObj) {
63-
this.#musicObj = musicObj
64-
}
65-
6661
get useVideo() {
6762
return this.#config.useVideo
6863
}
@@ -113,8 +108,8 @@ export default class Background {
113108

114109
set default(v) {
115110
this.#default.image = v
116-
this.#musicObj.music = v
117-
this.image = this.#default.location + this.#default.image
111+
if (!this.#config.name)
112+
this.image = this.#default.location + this.#default.image
118113
}
119114

120115
set custom(v) {

apps/showcase/src/components/music.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ export default class Music {
8989
reset() {
9090
document.getElementById('custom-music').value = ''
9191
document.getElementById('custom-music-clear').disabled = true
92-
this.#music.isUsingCustom = false
9392
this.#config.name = null
9493
if (this.#config.useMusic) {
9594
this.#playMusic()
@@ -99,12 +98,11 @@ export default class Music {
9998
#setMusic(data, type) {
10099
this.#audio.loop.el.src = data
101100
this.#audio.loop.el.querySelector('source').type = type
102-
this.#music.isUsingCustom = true
103101
this.#playMusic()
104102
}
105103

106104
#playMusic() {
107-
if (!this.#music.isUsingCustom) {
105+
if (!this.#config.name) {
108106
const introOgg = this.#music.mapping[this.#music.current].intro
109107
const intro = `./assets/${this.#music.location}/${introOgg}`
110108
const loop = `./assets/${this.#music.location}/${this.#music.mapping[this.#music.current].loop}`
@@ -179,13 +177,13 @@ export default class Music {
179177
}
180178

181179
get isUsingCustom() {
182-
return this.#music.isUsingCustom
180+
return this.#config.name !== null
183181
}
184182

185183
set music(name) {
186184
if (name !== null && name !== this.#music.current) {
187185
this.#music.current = name
188-
if (this.#config.useMusic && !this.#music.isUsingCustom) {
186+
if (this.#config.useMusic && !this.#config.name) {
189187
this.#audio.loop.el.pause()
190188
this.#audio.intro.el.pause()
191189
this.#playMusic()

apps/showcase/src/components/voice.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,18 @@ export default class Voice {
148148
return folders
149149
}
150150

151-
#getVoices() {
152-
return this.#charwordTable.subtitleLangs[this.#config.subtitle.language]
153-
.default
151+
#getVoices(lang = null) {
152+
return this.#charwordTable.subtitleLangs[
153+
lang ? lang : this.#config.subtitle.language
154+
].default
154155
}
155156

156157
#playEntryVoice() {
157158
this.#playSpecialVoice('问候')
158159
}
159160

160161
#playSpecialVoice(matcher) {
161-
const voices = this.#getVoices()
162+
const voices = this.#getVoices(buildConfig.voice_default_region)
162163
const voiceId = Object.keys(voices).find(
163164
(e) => voices[e].title === matcher
164165
)

0 commit comments

Comments
 (0)