Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

DebugDisplaySettingsStats.cs 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. namespace UnityEngine.Rendering
  4. {
  5. /// <summary>
  6. /// Display stats panel
  7. /// </summary>
  8. /// <typeparam name="TProfileId">Type of ProfileId the pipeline uses</typeparam>
  9. public class DebugDisplaySettingsStats<TProfileId> : IDebugDisplaySettingsData
  10. where TProfileId : Enum
  11. {
  12. /// <summary>Current display stats</summary>
  13. public DebugDisplayStats<TProfileId> debugDisplayStats { get; }
  14. /// <summary>
  15. /// Display stats panel constructor with settings
  16. /// </summary>
  17. /// <param name="debugDisplayStats">The debug display stats object that is used for configuring settings in the stats panel.</param>
  18. public DebugDisplaySettingsStats(DebugDisplayStats<TProfileId> debugDisplayStats)
  19. {
  20. this.debugDisplayStats = debugDisplayStats;
  21. }
  22. [DisplayInfo(name = "Display Stats", order = int.MinValue)]
  23. private class StatsPanel : DebugDisplaySettingsPanel
  24. {
  25. readonly DebugDisplaySettingsStats<TProfileId> m_Data;
  26. public override DebugUI.Flags Flags => DebugUI.Flags.RuntimeOnly;
  27. public StatsPanel(DebugDisplaySettingsStats<TProfileId> displaySettingsStats)
  28. {
  29. m_Data = displaySettingsStats;
  30. m_Data.debugDisplayStats.EnableProfilingRecorders();
  31. var list = new List<DebugUI.Widget>();
  32. m_Data.debugDisplayStats.RegisterDebugUI(list);
  33. foreach (var w in list)
  34. AddWidget(w);
  35. }
  36. public override void Dispose()
  37. {
  38. m_Data.debugDisplayStats.DisableProfilingRecorders();
  39. base.Dispose();
  40. }
  41. }
  42. /// <inheritdoc/>
  43. public bool AreAnySettingsActive => false;
  44. /// <inheritdoc/>
  45. public IDebugDisplaySettingsPanelDisposable CreatePanel()
  46. {
  47. return new StatsPanel(this);
  48. }
  49. }
  50. }