【m】04.AudioCore [1.1.3] - 2026-01-12
### Added - 添加背景音乐缓出接口 ### Fixed - 修复背景音乐播放时不循环的问题
This commit is contained in:
@@ -64,6 +64,7 @@ namespace Stary.Evo.AudioCore
|
||||
{
|
||||
audioSource1.clip = audioData.clip;
|
||||
audioSource1.volume = audioData.volume;
|
||||
audioSource1.loop = true;
|
||||
|
||||
// 设置2D与3D音频
|
||||
if (audioData.is3DAudio)
|
||||
@@ -97,6 +98,7 @@ namespace Stary.Evo.AudioCore
|
||||
{
|
||||
audioSource2.clip = audioData.clip;
|
||||
audioSource2.volume = audioData.volume;
|
||||
audioSource2.loop = true;
|
||||
|
||||
// 设置2D与3D音频
|
||||
if (audioData.is3DAudio)
|
||||
@@ -139,7 +141,7 @@ namespace Stary.Evo.AudioCore
|
||||
|
||||
public override void StopAll()
|
||||
{
|
||||
FadeAllMusic();
|
||||
FadeAllMusic(0);
|
||||
}
|
||||
|
||||
public override AudioSource GetAudioSource()
|
||||
@@ -153,7 +155,7 @@ namespace Stary.Evo.AudioCore
|
||||
/// <param name="audioData">{[fadeDuration:自然过渡时间]}</param>
|
||||
public override void Stop()
|
||||
{
|
||||
FadeAllMusic();
|
||||
FadeAllMusic(0f);
|
||||
}
|
||||
|
||||
|
||||
@@ -199,13 +201,11 @@ namespace Stary.Evo.AudioCore
|
||||
FadeOutMusic(source2, fadeDuration);
|
||||
}
|
||||
|
||||
|
||||
private void FadeAllMusic()
|
||||
public void FadeAllMusic(float fadeDuration)
|
||||
{
|
||||
currentAudioSource = null;
|
||||
|
||||
audioSource1.Stop();
|
||||
audioSource2.Stop();
|
||||
FadeOutMusic(audioSource1, fadeDuration);
|
||||
FadeOutMusic(audioSource2, fadeDuration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -222,7 +222,7 @@ namespace Stary.Evo.AudioCore
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
FadeAllMusic();
|
||||
FadeAllMusic(0f);
|
||||
Object.Destroy(audioSource1.gameObject);
|
||||
Object.Destroy(audioSource2.gameObject);
|
||||
audioSource1 = null;
|
||||
|
||||
Reference in New Issue
Block a user