Mirror of Svelto.ECS because we're a fan of it
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
726B

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