/// <summary> /// 注册消息类型 /// </summary> /// <param name="key"></param> public static void Regist <T>(KeyAlreadyHave key = KeyAlreadyHave.Skip) where T : IMessage <T> { var type = typeof(T); var MSGID = type.FirstAttribute <MSGID>(); if (MSGID != null) { Regist <T>(MSGID.ID, ProtobufLUTSerializerEx.Serialize, ProtobufLUTSerializerEx.MakeD(type), key); } }
/// <summary> /// 注册消息类型 /// </summary> /// <param name="type"></param> /// <param name="key"></param> protected internal static void Regist(Type type, KeyAlreadyHave key = KeyAlreadyHave.Skip) { if (type.IsSubclassOf(typeof(IMessage <>))) { var MSGID = type.FirstAttribute <MSGID>(); if (MSGID != null) { Regist(type, MSGID.ID, ProtobufLUTSerializerEx.MakeS(type), ProtobufLUTSerializerEx.MakeD(type), key); } } }