Files
AudioSystem/Assets/Scripts/OCES/Audio/HandWritten/DebugInfoCollector.cs
T
Oliver 340b52e6b4 feat: Add haptic system integration and audio test UI
- Add new audio assets and PlaySoundBind script for testing audio playback via UI input field.
- Implement haptic feedback integration in SfxSystem and fix initialization timing in HapticSystem.
- Update project settings with correct Android target architecture.
- Adjust DSP buffer size and enable development build debug logging.
2026-04-14 10:18:34 +08:00

63 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
namespace OCES.Audio.Editor
{
#if UNITY_EDITOR || DEVELOPMENT_BUILD
public sealed class DebugInfoCollector : MonoBehaviour
{
public static DebugInfoCollector Instance { get; private set; }
public Dictionary<uint, int> ClipConcurrentCount = new();
public List<ActiveSound> ActiveSounds = new();
public Dictionary<Type, int> 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<Text>();
}
void Update()
{
this.m_stringBuilder.Clear();
this.m_stringBuilder.AppendLine("Current States:");
foreach (KeyValuePair<Type, int> 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<uint, int> 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
}