forked from Moux23333/FreeSR
53 lines
2.2 KiB
C#
53 lines
2.2 KiB
C#
namespace FreeSR.Gateserver.Network.Factory
|
|
{
|
|
using FreeSR.Proto;
|
|
using ProtoBuf;
|
|
using System.Collections.Immutable;
|
|
|
|
internal static class ProtoFactory
|
|
{
|
|
private static readonly ImmutableDictionary<CmdType, Type> s_types;
|
|
|
|
static ProtoFactory()
|
|
{
|
|
var builder = ImmutableDictionary.CreateBuilder<CmdType, Type>();
|
|
builder.AddRange(new Dictionary<CmdType, Type>()
|
|
{
|
|
{CmdType.CmdPlayerGetTokenCsReq, typeof(PlayerGetTokenCsReq)},
|
|
{CmdType.CmdPlayerLoginCsReq, typeof(PlayerLoginCsReq)},
|
|
{CmdType.CmdGetAvatarDataCsReq, typeof(GetAvatarDataCsReq)},
|
|
|
|
{CmdType.CmdGetAllLineupDataCsReq, typeof(GetAllLineupDataCsReq)},
|
|
{CmdType.CmdGetCurLineupDataCsReq, typeof(GetCurLineupDataCsReq)},
|
|
{CmdType.CmdChangeLineupLeaderCsReq, typeof(ChangeLineupLeaderCsReq)},
|
|
|
|
{CmdType.CmdGetMissionStatusCsReq, typeof(GetMissionStatusCsReq)},
|
|
//{CmdType.CmdGetQuestDataCsReq, typeof(GetQuestDataCsReq)},
|
|
//{CmdType.CmdGetChallengeCsReq, typeof(GetChallengeCsReq)},
|
|
{CmdType.CmdGetCurSceneInfoCsReq, typeof(GetCurSceneInfoCsReq)},
|
|
|
|
{CmdType.CmdGetBasicInfoCsReq, typeof(GetBasicInfoCsReq)},
|
|
{CmdType.CmdGetHeroBasicTypeInfoCsReq, typeof(Hlbbodklpbo)},
|
|
{CmdType.CmdPlayerHeartBeatCsReq, typeof(PlayerHeartBeatCsReq)},
|
|
|
|
//{CmdType.CmdGetGachaInfoCsReq, typeof(GetGachaInfoCsReq)},
|
|
//{CmdType.CmdDoGachaCsReq, typeof(DoGachaCsReq)},
|
|
|
|
{CmdType.CmdGetNpcTakenRewardCsReq, typeof(Eddbhmdjadb)},
|
|
{CmdType.CmdGetFirstTalkByPerformanceNpcCsReq, typeof(Jknjlicadhe)},
|
|
|
|
//{CmdType.CmdGetBagCsReq, typeof(GetBagCsReq)}
|
|
});
|
|
|
|
s_types = builder.ToImmutable();
|
|
}
|
|
|
|
public static object Deserialize(int id, byte[] rawData)
|
|
{
|
|
if (s_types.TryGetValue((CmdType)id, out var type))
|
|
return Serializer.Deserialize(type, new MemoryStream(rawData));
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|