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) { if (dieAudios && dieAudios.length > 0) {
dieAudios.forEach(item => { dieAudios.forEach(item => {
let key, file; let file = lib.init.parseResourceAddress(item, path => (lib.path.extname(path) ? `audio/die/${path}.mp3` : `audio/die/${path}`)).href;
if (item.startsWith("ext:")) { let key = file.startsWith("db:") ? file.slice(3) : file.startsWith("data:") ? file : lib.path.basename(file);
key = item.slice(4).split("/")[1];
file = item; // if (item.startsWith("ext:")) {
} else { // key = item.slice(4).split("/")[1];
key = item; // file = item;
file = `die/${item}.mp3`; // } else {
} // key = item;
// file = `die/${item}.mp3`;
// }
const data = { key, file }; const data = { key, file };
if (lib.translate[`#${key}:die`]) data.text = lib.translate[`#${key}:die`]; if (lib.translate[`#${key}:die`]) data.text = lib.translate[`#${key}:die`];
datas.push(data); datas.push(data);