From fc77521b7897edecd794e84e024dbc4ae6f2dd89 Mon Sep 17 00:00:00 2001 From: Rintim Date: Sun, 8 Oct 2023 03:10:38 +0800 Subject: [PATCH] fix: `audioname2` cannot appear in `ui.click.charactercard`. --- game/game.js | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/game/game.js b/game/game.js index 5db47fa43..8b765dd45 100644 --- a/game/game.js +++ b/game/game.js @@ -54793,17 +54793,13 @@ } else if(typeof audioinfo=="object"&&"type" in audioinfo&&audioinfo.type=="direct"&&"files" in audioinfo){ let audioFiles=audioinfo.files; - if(typeof audioFiles!="object") return; - if(!Array.isArray(audioFiles)){ - if(!player)return; - if(player.name&&player.name in audioFiles&&(!info.audioname2||!info.audioname2[player.name]))audioFiles=audioFiles[player.name]; - else if(player.name1&&player.name1 in audioFiles&&(!info.audioname2||!info.audioname2[player.name1]))audioFiles=audioFiles[player.name1]; - else if(player.name2&&player.name2 in audioFiles&&(!info.audioname2||!info.audioname2[player.name2]))audioFiles=audioFiles[player.name2]; + if(typeof audioFiles=="object"){ + if(!Array.isArray(audioFiles)&&playername&&playername in audioFiles)audioFiles=audioFiles[playername]; + if(Array.isArray(audioFiles)){ + const length=audioFiles.length; + game.playAudio(audioFiles[getIndex(length)-1]); + } } - if(!Array.isArray(audioFiles))return; - const length=audioFiles.length; - //game.playAudio(`${audioInfo[0]}:${audioInfo[1]}`,`${audioName}${+1}.${audioInfo[3]||'mp3'}`); - game.playAudio(audioFiles[getIndex(length)-1]); } else if(audioinfo){ if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername; @@ -55068,17 +55064,13 @@ } else if(typeof audioinfo=="object"&&"type" in audioinfo&&audioinfo.type=="direct"&&"files" in audioinfo){ let audioFiles=audioinfo.files; - if(typeof audioFiles!="object") return; - if(!Array.isArray(audioFiles)){ - if(!player)return; - if(player.name&&player.name in audioFiles&&(!info.audioname2||!info.audioname2[player.name]))audioFiles=audioFiles[player.name]; - else if(player.name1&&player.name1 in audioFiles&&(!info.audioname2||!info.audioname2[player.name1]))audioFiles=audioFiles[player.name1]; - else if(player.name2&&player.name2 in audioFiles&&(!info.audioname2||!info.audioname2[player.name2]))audioFiles=audioFiles[player.name2]; + if(typeof audioFiles=="object"){ + if(!Array.isArray(audioFiles)&&playername&&playername in audioFiles)audioFiles=audioFiles[playername]; + if(Array.isArray(audioFiles)){ + const length=audioFiles.length; + game.playAudio(audioFiles[getIndex(length)-1]); + } } - if(!Array.isArray(audioFiles))return; - const length=audioFiles.length; - //game.playAudio(`${audioInfo[0]}:${audioInfo[1]}`,`${audioName}${+1}.${audioInfo[3]||'mp3'}`); - game.playAudio(audioFiles[getIndex(length)-1]); } else if(audioinfo){ if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername;