diff --git a/Assets/Scripts/OCES/Audio/HandWritten/DebugInfoCollector.cs b/Assets/Scripts/OCES/Audio/HandWritten/DebugInfoCollector.cs new file mode 100644 index 0000000..fdc162a --- /dev/null +++ b/Assets/Scripts/OCES/Audio/HandWritten/DebugInfoCollector.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; +using UnityEngine.UI; + +namespace OCES.Audio.Editor +{ +#if UNITY_EDITOR + public sealed class DebugInfoCollector : MonoBehaviour + { + + public static DebugInfoCollector Instance { get; private set; } + + public Dictionary ClipConcurrentCount = new(); + public List ActiveSounds = new(); + public Dictionary ActiveStates = new(); + readonly StringBuilder m_stringBuilder = new(); + Text m_textComponent; + + void Awake() + { + if ((bool)Instance && Instance != this) + { + Destroy(gameObject); + return; + } + Instance = this; + + this.m_textComponent = GetComponent(); + } + + void Update() + { + this.m_stringBuilder.Clear(); + + this.m_stringBuilder.AppendLine("Current States:"); + foreach (KeyValuePair activeState in this.ActiveStates) + { + string enumName = Enum.GetName(activeState.Key, activeState.Value) ?? activeState.Value.ToString(); + this.m_stringBuilder.AppendLine($"{activeState.Key.Name} is {enumName}"); + } + this.m_stringBuilder.AppendLine(); + + this.m_stringBuilder.AppendLine("Clip Concurrent Count:"); + foreach (KeyValuePair clipCount in this.ClipConcurrentCount) + { + this.m_stringBuilder.AppendLine($"{clipCount.Key} is playing {clipCount.Value}"); + } + this.m_stringBuilder.AppendLine(); + + this.m_stringBuilder.Append("ActiveSounds:"); + foreach (ActiveSound activeSound in this.ActiveSounds) + { + this.m_stringBuilder.AppendLine($"{activeSound.AudioObject.Id}"); + } + + this.m_textComponent.text = this.m_stringBuilder.ToString(); + } + } +#endif +} diff --git a/Assets/Scripts/OCES/Audio/HandWritten/DebugInfoCollector.cs.meta b/Assets/Scripts/OCES/Audio/HandWritten/DebugInfoCollector.cs.meta new file mode 100644 index 0000000..5bfcda8 --- /dev/null +++ b/Assets/Scripts/OCES/Audio/HandWritten/DebugInfoCollector.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 393e3f1fc2824bcf81260ccf46ce9524 +timeCreated: 1774410875 \ No newline at end of file