diff --git a/Assets/Scenes/Persistence.unity b/Assets/Scenes/Persistence.unity index 6cc9b97bd..781adf282 100644 --- a/Assets/Scenes/Persistence.unity +++ b/Assets/Scenes/Persistence.unity @@ -6927,6 +6927,8 @@ MonoBehaviour: Data3: 1610383794 Data4: -1468709119 Path: event:/Amb/amb + minDecibels: -40 + maxDecibels: 0 --- !u!1 &381795661 GameObject: m_ObjectHideFlags: 0 @@ -9709,7 +9711,7 @@ Transform: m_GameObject: {fileID: 519420028} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.009999275, y: 0, z: -10} + m_LocalPosition: {x: 0, y: 0, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Assets/Scripts/Framework/AudioKit/AudioManager.cs b/Assets/Scripts/Framework/AudioKit/AudioManager.cs index 15884d217..6ecd0dc5f 100644 --- a/Assets/Scripts/Framework/AudioKit/AudioManager.cs +++ b/Assets/Scripts/Framework/AudioKit/AudioManager.cs @@ -16,6 +16,13 @@ namespace AibisDream.Kit private const string AmbStateName = "scene"; public EventReference ambEvent; + + [Header("Volume Settings")] + [Tooltip("Minimum volume in dB when slider is at 0")] + [SerializeField] private float minDecibels = -60f; + + [Tooltip("Maximum volume in dB when slider is at 1")] + [SerializeField] private float maxDecibels = 0f; #region Event实例 @@ -149,7 +156,6 @@ namespace AibisDream.Kit private void OnGameQuit() { - ChangeAmb(AmbState.Main); // 清除当前播放的所有东西 foreach (var music in _musicDict.Values) { @@ -316,10 +322,15 @@ namespace AibisDream.Kit #region 调整音量 - public void SetVolume(float volumeValue) + public void SetVolume(float normalizedVolume) { + // 将 0~1 映射到 minDecibels ~ maxDecibels,再转换为线性幅度 + // 使用对数曲线匹配人耳听觉特性 + float db = Mathf.Lerp(minDecibels, maxDecibels, normalizedVolume); + float linearVolume = Mathf.Pow(10f, db / 20f); + var masterVca = RuntimeManager.GetBus("bus:/"); - masterVca.setVolume(volumeValue); + masterVca.setVolume(linearVolume); } #endregion diff --git a/Assets/Scripts/SceneManagement/SceneCenter/OutsideCenter.cs b/Assets/Scripts/SceneManagement/SceneCenter/OutsideCenter.cs index e33a8df91..953cb06d5 100644 --- a/Assets/Scripts/SceneManagement/SceneCenter/OutsideCenter.cs +++ b/Assets/Scripts/SceneManagement/SceneCenter/OutsideCenter.cs @@ -1,4 +1,4 @@ -using AibisDream.Kit; +using AibisDream.Kit; using UnityEngine; using UnityEngine.Playables; using System.Collections; @@ -13,8 +13,6 @@ namespace AibisDream public override void OnSingletonInit() { // 加载气泡 - Debug.Log("OutsideCenter: LoadBubbles"); - Debug.Log("OutsideCenter: " + bubbleSlotGroup.CollectData().dialogViewType); DialogUIManager.Instance.LoadBubbles(bubbleSlotGroup.CollectData()); }