public static uint GetNextTypeId(ref uint nextId) { ++nextId; for (; nextId < uint.MaxValue; ++nextId) { if (!Default.IsDefaultMessage(nextId) && MessageTypes.GetType(nextId) == null) { return(nextId); } } Debug.LogError($"Exceeded max INetMessage count of {uint.MaxValue}. Critical failure!"); return(0u); }
public static string GetDescription(this MessageTypes value) { FieldInfo fi = value.GetType().GetField(value.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes( typeof(DescriptionAttribute), false); if (attributes != null && attributes.Length > 0) { return(attributes[0].Description); } else { return(value.ToString()); } }