SanAndreasUnity/Assets/Scripts/Utilities/Stats.cs

32 lines
923 B
C#
Raw Normal View History

2019-05-25 23:40:05 +00:00
using System.Collections.Generic;
using System.Linq;
namespace SanAndreasUnity.Utilities
{
public class Stats
{
public class Entry
{
public string category = "";
public string text = null;
public System.Action onGUI = null;
}
static Dictionary<string, List<Entry>> s_entries = new Dictionary<string, List<Entry>>();
public static IEnumerable<KeyValuePair<string, List<Entry>>> Entries => s_entries;
public static IEnumerable<string> Categories => s_entries.Select(pair => pair.Key);
2019-05-26 00:50:38 +00:00
public static UnityEngine.Rect DisplayRect { get; set; }
2019-05-25 23:40:05 +00:00
public static void RegisterStat(Entry entry)
{
if (s_entries.ContainsKey(entry.category))
s_entries[entry.category].Add(entry);
else
s_entries[entry.category] = new List<Entry>(){entry};
}
}
}