2021-04-20 13:58:00 +08:00
|
|
|
|
local FightEffectAudioConfig = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local this = FightEffectAudioConfig
|
|
|
|
|
|
|
|
|
|
function FightEffectAudioConfig.Init()
|
|
|
|
|
if not this.config then
|
|
|
|
|
this.config = {}
|
|
|
|
|
local audioConfig = ConfigManager.GetConfig(ConfigName.AudioConfig)
|
|
|
|
|
for _, data in ConfigPairs(audioConfig) do
|
|
|
|
|
if data.Type == 4 or data.Type == 5 or data.Type == 6 or data.Type == 7 then
|
|
|
|
|
if not data.EffectName or data.EffectName == "" then
|
2021-01-09 14:20:06 +08:00
|
|
|
|
-- Log("AudioConfig表错误,特效音频未注册特效名,音频名:"..data.Name)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
local effectNameList = string.split(data.EffectName, "#")
|
|
|
|
|
for _, effectName in ipairs(effectNameList) do
|
|
|
|
|
-- if this.config[effectName] then
|
|
|
|
|
-- Log("AudioConfig表错误,特效音频注册重复,特效名:"..effectName)
|
|
|
|
|
-- else
|
|
|
|
|
-- this.config[effectName] = {name = data.Name}
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
if not this.config[effectName] then
|
|
|
|
|
this.config[effectName] = {}
|
|
|
|
|
end
|
|
|
|
|
table.insert(this.config[effectName], {name = data.Name})
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function FightEffectAudioConfig.GetAudioData(effectName)
|
|
|
|
|
if not this.config then
|
|
|
|
|
this.Init()
|
|
|
|
|
end
|
|
|
|
|
local data = this.config[effectName]
|
|
|
|
|
if not data or #data == 0 then
|
|
|
|
|
if effectName ~= "FloatingText" and effectName ~= "BuffFloatingText" and effectName ~= "fx_Effect_enemy_birth" then
|
2021-01-09 14:20:06 +08:00
|
|
|
|
-- Log("没有找到特效 ".. effectName .." 的相关音效配置")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
return data[math.random(1, #data)]
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return FightEffectAudioConfig
|