feat: change logic of die text parse.

This commit is contained in:
Rintim 2024-05-12 19:57:05 +08:00
parent 215ead7e7b
commit 37c21700a3
No known key found for this signature in database
GPG Key ID: BE9E1EA615BACFCF
1 changed files with 10 additions and 8 deletions

View File

@ -1599,14 +1599,16 @@ export class Game {
}
if (dieAudios && dieAudios.length > 0) {
dieAudios.forEach(item => {
let key, file;
if (item.startsWith("ext:")) {
key = item.slice(4).split("/")[1];
file = item;
} else {
key = item;
file = `die/${item}.mp3`;
}
let file = lib.init.parseResourceAddress(item, path => (lib.path.extname(path) ? `audio/die/${path}.mp3` : `audio/die/${path}`)).href;
let key = file.startsWith("db:") ? file.slice(3) : file.startsWith("data:") ? file : lib.path.basename(file);
// if (item.startsWith("ext:")) {
// key = item.slice(4).split("/")[1];
// file = item;
// } else {
// key = item;
// file = `die/${item}.mp3`;
// }
const data = { key, file };
if (lib.translate[`#${key}:die`]) data.text = lib.translate[`#${key}:die`];
datas.push(data);