【m】04.AudioCore [1.1.3] - 2026-01-12
### Added - 添加背景音乐缓出接口 ### Fixed - 修复背景音乐播放时不循环的问题
This commit is contained in:
12
Assets/04.AudioCore/CHANGELOG.md
Normal file
12
Assets/04.AudioCore/CHANGELOG.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Changelog
|
||||
此包的所有更新日志会被记录在此文件中
|
||||
|
||||
## [1.1.3] - 2026-01-12
|
||||
### Added
|
||||
- 添加背景音乐缓出接口
|
||||
### Fixed
|
||||
- 修复背景音乐播放时不循环的问题
|
||||
|
||||
## [1.1.2] - 2026-01-09
|
||||
### Fixed
|
||||
- 修复背景音乐无法播放的问题
|
||||
7
Assets/04.AudioCore/CHANGELOG.md.meta
Normal file
7
Assets/04.AudioCore/CHANGELOG.md.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a22131ad87896114c900d929c8588c8b
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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;
|
||||
|
||||
@@ -168,8 +168,7 @@ namespace Stary.Evo.AudioCore
|
||||
/// <summary>
|
||||
/// 停止播放背景音乐
|
||||
/// </summary>
|
||||
/// <param name="fadeDuration">自然过渡时间</param>
|
||||
public static void StopMusic(float fadeDuration = 1f)
|
||||
public static void StopMusic()
|
||||
{
|
||||
if (Music == null)
|
||||
{
|
||||
@@ -180,6 +179,21 @@ namespace Stary.Evo.AudioCore
|
||||
Music.Stop();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停止播放背景音乐
|
||||
/// </summary>
|
||||
/// <param name="fadeDuration">自然过渡时间</param>
|
||||
public static void FadeAllMusic(float fadeDuration = 1)
|
||||
{
|
||||
if (Music == null)
|
||||
{
|
||||
Debug.LogError("AudioCoreManager: Music is null, please initialize it first.");
|
||||
return;
|
||||
}
|
||||
|
||||
Music.FadeAllMusic(fadeDuration);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.audiocore",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"displayName": "04.AudioCore",
|
||||
"description": "音频播放工具",
|
||||
"unity": "2021.3",
|
||||
|
||||
Reference in New Issue
Block a user