Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
665B

  1. using System.Collections.Generic;
  2. using Svelto.ECS;
  3. static class GroupNamesMap
  4. {
  5. #if DEBUG
  6. static GroupNamesMap() { idToName = new Dictionary<uint, string>(); }
  7. internal static readonly Dictionary<uint, string> idToName;
  8. #endif
  9. #if DEBUG
  10. public static string ToName(this in ExclusiveGroupStruct group)
  11. {
  12. var idToName = GroupNamesMap.idToName;
  13. if (idToName.TryGetValue((uint)@group, out var name) == false)
  14. name = $"<undefined:{((uint)group).ToString()}>";
  15. return name;
  16. }
  17. #else
  18. public static string ToName(this in ExclusiveGroupStruct group)
  19. {
  20. return ((uint)group).ToString();
  21. }
  22. #endif
  23. }