Mirror of Svelto.ECS because we're a fan of it
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

26 Zeilen
780B

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