Skip to content

Commit 054ed6d

Browse files
committed
fix(live): add builtin bgm bgm_event_meetup
1 parent fe0d92c commit 054ed6d

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

app/src/ts/renderer/mishiro-update.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { getMasterHash, openManifestDatabase, readMasterData } from './ipc-back'
1414
import type { MishiroConfig } from '../main/config'
1515
import { readAcb } from './audio'
1616
import type { BGM } from './back/resolve-audio-manifest'
17-
import { error } from './log'
17+
import { error, warn } from './log'
1818
const fs = window.node.fs
1919
// const path = window.node.path
2020
const { manifestPath, masterPath, bgmDir/* , iconDir */ } = getPath
@@ -210,7 +210,12 @@ export default class extends Vue {
210210
// }
211211
if (masterData.eventHappening) {
212212
const eventHca = bgmDir(`bgm_event_${masterData.eventData.id}.hca`)
213-
if (Number(masterData.eventData.type) !== 2 && Number(masterData.eventData.type) !== 6 && !fs.existsSync(eventHca)) {
213+
const downloadBGMEventType = [1, 3, 4, 5, 7, 8]
214+
const eventType = Number(masterData.eventData.type)
215+
if (eventType > 9) {
216+
warn(`Unknown event type: ${eventType}`)
217+
}
218+
if (downloadBGMEventType.includes(eventType) && !fs.existsSync(eventHca)) {
214219
const eventBgmHash = bgmManifest.filter(row => row.name === `b/bgm_event_${masterData.eventData.id}.acb`)[0].hash
215220
try {
216221
// let result = await downloader.download(

app/src/ts/renderer/the-player.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ export const bgmList: BGMList = {
4343
},
4444
rail: {
4545
src: getPath('../asset/bgm.asar/bgm_event_rail.hca')
46+
},
47+
meetup: {
48+
src: getPath('../asset/bgm.asar/bgm_event_meetup.hca')
4649
}
4750
}
4851

@@ -216,17 +219,22 @@ export default class extends Vue {
216219
break
217220
case 'live':
218221
if (this.$store.state.master.eventHappening) {
219-
if (Number(this.eventInfo.type) === 2) {
222+
const eventType = Number(this.eventInfo.type)
223+
if (eventType === 2) {
220224
if (this.playing.src !== bgmList.caravan.src) {
221225
await this.play(bgmList.caravan)
222226
}
223-
} else if (Number(this.eventInfo.type) === 6) {
227+
} else if (eventType === 6) {
224228
if (this.playing.src !== bgmList.rail.src) {
225229
await this.play(bgmList.rail)
226230
}
231+
} else if (eventType === 9) {
232+
if (this.playing.src !== bgmList.meetup.src) {
233+
await this.play(bgmList.meetup)
234+
}
227235
} else {
228236
const eventBgmSrc = getPath(`../asset/bgm/bgm_event_${this.eventInfo.id}.hca`)
229-
if (this.playing.src !== eventBgmSrc) {
237+
if (this.playing.src !== eventBgmSrc && fs.existsSync(eventBgmSrc)) {
230238
this.event.$emit('liveSelect', { src: eventBgmSrc })
231239
}
232240
}

0 commit comments

Comments
 (0)