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