using System; using System.Collections.Generic; namespace DCFApixels.DragonECS { namespace Internal { internal static class EcsTypeCode { private static readonly Dictionary _codes = new Dictionary(); private static int _incremetn = 1; public static int GetCode(Type type) { if (!_codes.TryGetValue(type, out int code)) { code = _incremetn++; _codes.Add(type, code); } return code; } public static int Count => _codes.Count; internal static class Cache { public static readonly int code = EcsTypeCode.GetCode(typeof(T)); } } } }