feat(audio-kit): 添加主菜单环境音状态
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
Engine,
|
||||
GearBox,
|
||||
Bar,
|
||||
Dream
|
||||
Dream,
|
||||
MainMenu
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,9 @@ namespace AibisDream.Kit
|
||||
|
||||
public EventReference ambEvent;
|
||||
|
||||
[Header("AMB Settings")]
|
||||
[SerializeField] private AmbState menuAmbState = AmbState.Outside;
|
||||
|
||||
[Header("Volume Settings")]
|
||||
[Tooltip("Minimum volume in dB when slider is at 0")]
|
||||
[SerializeField] private float minDecibels = -60f;
|
||||
@@ -42,9 +45,13 @@ namespace AibisDream.Kit
|
||||
|
||||
#endregion
|
||||
|
||||
private void Start()
|
||||
public override void OnSingletonInit()
|
||||
{
|
||||
RegisterEvent();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
InitAmb();
|
||||
}
|
||||
|
||||
@@ -56,6 +63,8 @@ namespace AibisDream.Kit
|
||||
// 场景切换相关
|
||||
_removeTrigger.Add(EnumEventSystem.Global.Register<EventEnum, string>(EventEnum.SceneLoad, OnSceneLoad));
|
||||
_removeTrigger.Add(EnumEventSystem.Global.Register<EventEnum, FixSceneMode>(EventEnum.FixSceneModeChanged, OnFixSceneModeChange));
|
||||
// 主菜单 / 退出局内
|
||||
_removeTrigger.Add(EnumEventSystem.Global.Register(GameLoopEnum.AppStart, OnAppStart));
|
||||
_removeTrigger.Add(EnumEventSystem.Global.Register(GameLoopEnum.GameQuit, OnGameQuit));
|
||||
}
|
||||
|
||||
@@ -177,6 +186,11 @@ namespace AibisDream.Kit
|
||||
RuntimeManager.StudioSystem.setParameterByName(paramName, value);
|
||||
}
|
||||
|
||||
private void OnAppStart()
|
||||
{
|
||||
ChangeAmb(menuAmbState);
|
||||
}
|
||||
|
||||
private void OnSceneLoad(string loadingScene)
|
||||
{
|
||||
// 场景加载时切换AMB
|
||||
@@ -207,7 +221,7 @@ namespace AibisDream.Kit
|
||||
|
||||
_musicDict.Clear();
|
||||
_sfxDict.Clear();
|
||||
_currentAmbState = AmbState.Main;
|
||||
ChangeAmb(menuAmbState);
|
||||
}
|
||||
|
||||
private void OnFixSceneModeChange(FixSceneMode nextState)
|
||||
|
||||
Reference in New Issue
Block a user