Merge pull request #490 from nofficalfs/PR-Enhancement-SkillAudioFullPath
[Enhancement] 技能的配音文件可以直接给语音地址
This commit is contained in:
commit
808f0ee48b
41
game/game.js
41
game/game.js
|
@ -35040,7 +35040,9 @@
|
|||
if(Array.isArray(audioInfo)){
|
||||
audioName=audioInfo[0];
|
||||
if(!fixedNum) fixedNum=audioInfo[1];//数组会取第一个指定语音数
|
||||
audioInfo=lib.skill[audioName].audio;
|
||||
// TODO: 判断不完整,但现在无合适的方法,先放着 @kuangshen04
|
||||
if(audioName in lib.skill) audioInfo=lib.skill[audioName].audio;
|
||||
else audioInfo=parseInt(fixedNum);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
@ -35076,6 +35078,23 @@
|
|||
if(fixedNum) audioInfo=Math.min(audioInfo, fixedNum);
|
||||
game.playAudio('skill',`${audioName}${Math.floor(audioInfo*Math.random())+1}`);
|
||||
}
|
||||
//直接指定配音文件名的新格式
|
||||
else if(typeof audioInfo=="object"){
|
||||
if(!("type" in audioInfo&&audioInfo.type=="direct"&&"files" in audioInfo)) return;
|
||||
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(!Array.isArray(audioFiles)) return;
|
||||
let length=audioFiles.length;
|
||||
if(fixedNum)length=Math.min(length,fixedNum);
|
||||
//game.playAudio(`${audioInfo[0]}:${audioInfo[1]}`,`${audioName}${+1}.${audioInfo[3]||'mp3'}`);
|
||||
game.playAudio(audioFiles[Math.floor(length*Math.random())]);
|
||||
}
|
||||
else if(audioInfo) game.playAudio('skill',audioName);
|
||||
else if(info.audio!==false) game.playSkillAudio(audioName);
|
||||
},
|
||||
|
@ -54775,6 +54794,16 @@
|
|||
if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername;
|
||||
game.playAudio('skill',audioname+getIndex(audioinfo));
|
||||
}
|
||||
else if(typeof audioinfo=="object"&&"type" in audioinfo&&audioinfo.type=="direct"&&"files" in audioinfo){
|
||||
let audioFiles=audioinfo.files;
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(audioinfo){
|
||||
if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername;
|
||||
game.playAudio('skill',audioname);
|
||||
|
@ -55036,6 +55065,16 @@
|
|||
if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername;
|
||||
game.playAudio('skill',audioname+getIndex(audioinfo));
|
||||
}
|
||||
else if(typeof audioinfo=="object"&&"type" in audioinfo&&audioinfo.type=="direct"&&"files" in audioinfo){
|
||||
let audioFiles=audioinfo.files;
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(audioinfo){
|
||||
if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername;
|
||||
game.playAudio('skill',audioname);
|
||||
|
|
Loading…
Reference in New Issue