Archived
1
0
Fork 0
forked from Moux23333/FreeSR
This repository has been archived on 2024-03-30. You can view files and clone it, but cannot push or open issues or pull requests.
FreeSR/FreeSR.Gateserver/Network/Factory/ProtoFactory.cs

54 lines
2.2 KiB
C#
Raw Normal View History

2024-01-27 13:06:07 +00:00
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>()
{
2024-01-27 13:08:24 +00:00
{CmdType.CmdPlayerGetTokenCsReq, typeof(PlayerGetTokenCsReq)},
{CmdType.CmdPlayerLoginCsReq, typeof(PlayerLoginCsReq)},
{CmdType.CmdGetAvatarDataCsReq, typeof(GetAvatarDataCsReq)},
2024-01-27 13:06:07 +00:00
2024-01-27 13:08:24 +00:00
{CmdType.CmdGetAllLineupDataCsReq, typeof(GetAllLineupDataCsReq)},
{CmdType.CmdGetCurLineupDataCsReq, typeof(GetCurLineupDataCsReq)},
{CmdType.CmdChangeLineupLeaderCsReq, typeof(ChangeLineupLeaderCsReq)},
2024-01-27 13:06:07 +00:00
2024-01-27 13:08:24 +00:00
{CmdType.CmdGetMissionStatusCsReq, typeof(GetMissionStatusCsReq)},
//{CmdType.CmdGetQuestDataCsReq, typeof(GetQuestDataCsReq)},
//{CmdType.CmdGetChallengeCsReq, typeof(GetChallengeCsReq)},
{CmdType.CmdGetCurSceneInfoCsReq, typeof(GetCurSceneInfoCsReq)},
2024-01-27 13:06:07 +00:00
2024-01-27 13:08:24 +00:00
{CmdType.CmdGetBasicInfoCsReq, typeof(GetBasicInfoCsReq)},
{CmdType.CmdGetHeroBasicTypeInfoCsReq, typeof(Hlbbodklpbo)},
{CmdType.CmdPlayerHeartBeatCsReq, typeof(PlayerHeartBeatCsReq)},
2024-01-27 13:06:07 +00:00
2024-01-27 13:08:24 +00:00
//{CmdType.CmdGetGachaInfoCsReq, typeof(GetGachaInfoCsReq)},
//{CmdType.CmdDoGachaCsReq, typeof(DoGachaCsReq)},
2024-01-27 13:06:07 +00:00
2024-01-27 13:08:24 +00:00
{CmdType.CmdGetNpcTakenRewardCsReq, typeof(Eddbhmdjadb)},
{CmdType.CmdGetFirstTalkByPerformanceNpcCsReq, typeof(Jknjlicadhe)},
2024-01-27 13:06:07 +00:00
2024-01-27 13:08:24 +00:00
//{CmdType.CmdGetBagCsReq, typeof(GetBagCsReq)}
2024-01-27 13:06:07 +00:00
});
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;
}
}
}