优化audio为数组时的skill获取

This commit is contained in:
mengxinzxz 2023-11-28 15:56:35 +08:00
parent af454aa7b6
commit 64fad7e280
1 changed files with 20 additions and 12 deletions

View File

@ -10677,9 +10677,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
skills.forEach(skill=>{ skills.forEach(skill=>{
var info=lib.skill[skill]; var info=lib.skill[skill];
if(info){
if(!info.audioname2) info.audioname2={}; if(!info.audioname2) info.audioname2={};
if(info.audioname&&info.audioname.includes(character)){ if(info.audioname&&info.audioname.includes(character)){
if(info.audio&&typeof info.audio=='string') skill=info.audio; if(info.audio){
if(typeof info.audio=='string') skill=info.audio;
if(Array.isArray(info.audio)) skill=info.audio[0];
}
if(!lib.skill[skill+'_'+character]) lib.skill[skill+'_'+character]={audio:2}; if(!lib.skill[skill+'_'+character]) lib.skill[skill+'_'+character]={audio:2};
info.audioname2[name]=(skill+'_'+character); info.audioname2[name]=(skill+'_'+character);
} }
@ -10687,9 +10691,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
info.audioname2[name]=info.audioname2[character]; info.audioname2[name]=info.audioname2[character];
} }
else{ else{
if(info.audio&&typeof info.audio=='string') skill=info.audio; if(info.audio){
if(typeof info.audio=='string') skill=info.audio;
if(Array.isArray(info.audio)) skill=info.audio[0];
}
info.audioname2[name]=skill; info.audioname2[name]=skill;
} }
}
}); });
}, },
mark:true, mark:true,