音效2倍速效果优化
parent
09f27f8d3d
commit
d79633c288
|
@ -1,7 +1,7 @@
|
|||
--region *.lua
|
||||
--Date
|
||||
--此文件由[BabeLua]插件自动生成
|
||||
local _IsLog = false
|
||||
local _IsLog = true
|
||||
local function __DebugLog(content)
|
||||
if _IsLog then
|
||||
Log("<color=#aaaa55>"..content.."</color>")
|
||||
|
@ -229,15 +229,29 @@ local function _SetAudioUnit(audioUnit, resName, auildType, volume)
|
|||
-- 是否循环
|
||||
local config = AudioConfig[resName]
|
||||
local isLoop = config and config.isLoop
|
||||
|
||||
local pitch = 1
|
||||
if auildType == eAudioType.uiAudio then
|
||||
if config and config.mixType ~= SoundDef[11] then
|
||||
if UIManager.IsOpen(UIName.BattlePanel) then
|
||||
local scale = BattleManager.GetTimeScale()
|
||||
pitch = math.floor(scale + 0.5)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Log("音效播放速度:"..pitch)
|
||||
-- 播放新音效
|
||||
if not config or config.mixType == SoundDef[1] or config.mixType == SoundDef[2] or isLoop then
|
||||
audioUnit.audio.clip = clipNew
|
||||
audioUnit.audio.volume = volume
|
||||
audioUnit.audioType = auildType
|
||||
audioUnit.audio.loop = isLoop
|
||||
audioUnit.audio.pitch = pitch
|
||||
audioUnit.audio:Play()
|
||||
else
|
||||
audioUnit.audio:PlayOneShot(clipNew, volume)
|
||||
audioUnit.audio.pitch = pitch
|
||||
end
|
||||
setAudioMixer(resName, audioUnit)
|
||||
end
|
||||
|
@ -507,9 +521,9 @@ function SoundManager.SetAudioSpeed(speed)
|
|||
-- for _, unit in ipairs(_backgroundSound) do
|
||||
-- unit.audio.pitch = speed
|
||||
-- end
|
||||
for _, unit in ipairs(_soundChannel) do
|
||||
unit.audio.pitch = speed
|
||||
end
|
||||
-- for _, unit in ipairs(_soundChannel) do
|
||||
-- unit.audio.pitch = speed
|
||||
-- end
|
||||
-- for _, unit in ipairs(_AmbientChannel) do
|
||||
-- unit.audio.pitch = speed
|
||||
-- end
|
||||
|
|
Loading…
Reference in New Issue