refactor(audio): restructure audio constants and remove deprecated files
- Add AudioConsts.cs with Cues, NameDictionaries, and Parameters classes - Remove AudioEnumIds.cs, AudioEnums.cs, and AudioObjectDefinitions.cs - Update AudioObject.cs to include CueName property and serialization - Update AudioSystem.cs to use new NameDictionaries and Parameters classes - Update SetStateBind.cs to use Parameters.GameState type - Change UI text from "PlaySound" to "StopSound" in SampleScene.unity - Update binary audio data file AudioObject.bytes
This commit is contained in:
@@ -68,13 +68,13 @@ namespace OCES.Audio
|
||||
[Obsolete("Use Play(uint) instead")]
|
||||
public void Play(string audioName)
|
||||
{
|
||||
if (!AudioObjectDefinitions.NameToId.TryGetValue(audioName, out uint id))
|
||||
if (!NameDictionaries.NameToId.TryGetValue(audioName, out uint id))
|
||||
{
|
||||
Debug.LogWarning($"[Audio] Name '{audioName}' not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (AudioObjectDefinitions.AmbiguousNames.Contains(audioName))
|
||||
if (NameDictionaries.AmbiguousNames.Contains(audioName))
|
||||
{
|
||||
Debug.LogWarning(
|
||||
$"[AudioSystem] Name '{audioName}' is ambiguous. Using first matched ID: {id}. " +
|
||||
@@ -82,7 +82,7 @@ namespace OCES.Audio
|
||||
);
|
||||
}
|
||||
|
||||
if (AudioObjectDefinitions.SharedIdNames.Contains(audioName))
|
||||
if (NameDictionaries.SharedIdNames.Contains(audioName))
|
||||
{
|
||||
Debug.LogWarning(
|
||||
$"[AudioSystem] Name '{audioName}' is a item of a container AudioObject (ID: {id}). " +
|
||||
@@ -244,7 +244,7 @@ namespace OCES.Audio
|
||||
this.m_musicSystem.OnGrid += id => this.OnGrid?.Invoke(id);
|
||||
|
||||
// ── 注册 StateGroup ──
|
||||
EnumIds.RegisterAllGameState();
|
||||
Parameters.EnumIds.RegisterAllGameState();
|
||||
|
||||
ActiveStates = new Dictionary<Type, Enum>();
|
||||
}
|
||||
@@ -255,7 +255,7 @@ namespace OCES.Audio
|
||||
// 触发一次初始状态,让音乐系统从默认状态开始匹配
|
||||
if (this.startWithMusic)
|
||||
{
|
||||
SetState(GameState.Home);
|
||||
SetState(Parameters.GameState.Home);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user