fix: 审查修复4个Critical + 1个Warning
C-1: rouletteResult getwinResult(7)→(8) C-2: rouletteResult 补上 audioMp3().Play() C-3: nnResult 三卡用 tc_ 前缀而非 nn_ C-4: 色碟 case4 文字 odd→even W-1: bufferCache 用 fullKey(含语言前缀) 避免切语言后播错
This commit is contained in:
@@ -88,22 +88,22 @@ bindUnlock()
|
|||||||
* Returns null if the key doesn't exist or decoding fails.
|
* Returns null if the key doesn't exist or decoding fails.
|
||||||
*/
|
*/
|
||||||
async function getBuffer(key) {
|
async function getBuffer(key) {
|
||||||
if (bufferCache.has(key)) return bufferCache.get(key)
|
|
||||||
|
|
||||||
const ctx = getAudioContext()
|
|
||||||
if (!ctx) return null
|
|
||||||
|
|
||||||
const soundList = $store.state.config.soundList
|
const soundList = $store.state.config.soundList
|
||||||
const language =
|
const language =
|
||||||
$store.state.config.$Type === "cn" || $store.state.config.$Type === "tw"
|
$store.state.config.$Type === "cn" || $store.state.config.$Type === "tw"
|
||||||
? "cn"
|
? "cn"
|
||||||
: "en"
|
: "en"
|
||||||
const fullKey = `${language}_${key}`
|
const fullKey = `${language}_${key}`
|
||||||
|
|
||||||
|
if (bufferCache.has(fullKey)) return bufferCache.get(fullKey)
|
||||||
|
|
||||||
|
const ctx = getAudioContext()
|
||||||
|
if (!ctx) return null
|
||||||
|
|
||||||
const blob = soundList[fullKey]
|
const blob = soundList[fullKey]
|
||||||
if (!blob) return null
|
if (!blob) return null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Blob.arrayBuffer() may not exist on older mobile browsers; fallback to FileReader
|
|
||||||
let arrayBuffer
|
let arrayBuffer
|
||||||
if (typeof blob.arrayBuffer === "function") {
|
if (typeof blob.arrayBuffer === "function") {
|
||||||
arrayBuffer = await blob.arrayBuffer()
|
arrayBuffer = await blob.arrayBuffer()
|
||||||
@@ -115,11 +115,10 @@ async function getBuffer(key) {
|
|||||||
reader.readAsArrayBuffer(blob)
|
reader.readAsArrayBuffer(blob)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// decodeAudioData: some older browsers only support callback form
|
|
||||||
const audioBuffer = await new Promise((resolve, reject) => {
|
const audioBuffer = await new Promise((resolve, reject) => {
|
||||||
ctx.decodeAudioData(arrayBuffer, resolve, reject)
|
ctx.decodeAudioData(arrayBuffer, resolve, reject)
|
||||||
})
|
})
|
||||||
bufferCache.set(key, audioBuffer)
|
bufferCache.set(fullKey, audioBuffer)
|
||||||
return audioBuffer
|
return audioBuffer
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn("[sound] decode failed:", key, err)
|
console.warn("[sound] decode failed:", key, err)
|
||||||
|
|||||||
+9
-8
@@ -669,27 +669,28 @@ export default {
|
|||||||
data.round.win_player_3 == 0
|
data.round.win_player_3 == 0
|
||||||
) {
|
) {
|
||||||
text = Lang.value[Type.value].msg_banker_win
|
text = Lang.value[Type.value].msg_banker_win
|
||||||
mp3list.push("nn_banker")
|
const prefix = data.game_id == 5 ? "tc" : "nn"
|
||||||
|
mp3list.push(`${prefix}_banker`)
|
||||||
win.push("player_1_banker", "player_2_banker", "player_3_banker")
|
win.push("player_1_banker", "player_2_banker", "player_3_banker")
|
||||||
win
|
|
||||||
} else {
|
} else {
|
||||||
|
const prefix = data.game_id == 5 ? "tc" : "nn"
|
||||||
if (data.round.win_player_1 == 1) {
|
if (data.round.win_player_1 == 1) {
|
||||||
text = text + Lang.value[Type.value].player1
|
text = text + Lang.value[Type.value].player1
|
||||||
mp3list.push("nn_player_1")
|
mp3list.push(`${prefix}_player_1`)
|
||||||
win.push("player_1")
|
win.push("player_1")
|
||||||
} else {
|
} else {
|
||||||
win.push("player_1_banker")
|
win.push("player_1_banker")
|
||||||
}
|
}
|
||||||
if (data.round.win_player_2 == 1) {
|
if (data.round.win_player_2 == 1) {
|
||||||
text = text + Lang.value[Type.value].player2
|
text = text + Lang.value[Type.value].player2
|
||||||
mp3list.push("nn_player_2")
|
mp3list.push(`${prefix}_player_2`)
|
||||||
win.push("player_2")
|
win.push("player_2")
|
||||||
} else {
|
} else {
|
||||||
win.push("player_2_banker")
|
win.push("player_2_banker")
|
||||||
}
|
}
|
||||||
if (data.round.win_player_3 == 1) {
|
if (data.round.win_player_3 == 1) {
|
||||||
text = text + Lang.value[Type.value].player3
|
text = text + Lang.value[Type.value].player3
|
||||||
mp3list.push("nn_player_3")
|
mp3list.push(`${prefix}_player_3`)
|
||||||
win.push("player_3")
|
win.push("player_3")
|
||||||
} else {
|
} else {
|
||||||
win.push("player_3_banker")
|
win.push("player_3_banker")
|
||||||
@@ -740,7 +741,7 @@ export default {
|
|||||||
win.push("toning_four", "toning_plural", "toning_big")
|
win.push("toning_four", "toning_plural", "toning_big")
|
||||||
mp3list.push("toning_4_red", "toning_even", "toning_big")
|
mp3list.push("toning_4_red", "toning_even", "toning_big")
|
||||||
// text = "四红,双,大"
|
// text = "四红,双,大"
|
||||||
text = `${language.four} ${language.red},${language.odd},${language.big}`
|
text = `${language.four} ${language.red},${language.even},${language.big}`
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
audioMp3(mp3list).Play()
|
audioMp3(mp3list).Play()
|
||||||
@@ -787,13 +788,13 @@ export default {
|
|||||||
// 轮盘
|
// 轮盘
|
||||||
const rouletteResult = (data) => {
|
const rouletteResult = (data) => {
|
||||||
showRouletteResult.value = true
|
showRouletteResult.value = true
|
||||||
getwinResult(7)
|
getwinResult(8)
|
||||||
let mp3list = [],
|
let mp3list = [],
|
||||||
text = ""
|
text = ""
|
||||||
const result = data.round.result
|
const result = data.round.result
|
||||||
text = result
|
text = result
|
||||||
mp3list.push(`${result}_point`)
|
mp3list.push(`${result}_point`)
|
||||||
// console.log(result, mp3list)
|
audioMp3(mp3list).Play()
|
||||||
showSubtitle(text, 3000)
|
showSubtitle(text, 3000)
|
||||||
winArray.value = data.round.result_parse
|
winArray.value = data.round.result_parse
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user