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

64 lines
2.8 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-02-21 06:41:22 +00:00
{CmdType.CmdGetSceneMapInfoCsReq, typeof(GetSceneMapInfoCsReq)},
2024-01-27 13:06:07 +00:00
2024-01-27 13:08:24 +00:00
{CmdType.CmdGetBasicInfoCsReq, typeof(GetBasicInfoCsReq)},
2024-02-21 06:41:22 +00:00
{CmdType.CmdGetHeroBasicTypeInfoCsReq, typeof(GetHeroBasicTypeInfoCsReq)},
2024-01-27 13:08:24 +00:00
{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-02-21 06:41:22 +00:00
{CmdType.CmdGetNpcTakenRewardCsReq, typeof(GetNpcTakenRewardCsReq)},
{CmdType.CmdGetFirstTalkByPerformanceNpcCsReq, typeof(GetFirstTalkByPerformanceNpcCsReq)},
2024-01-27 13:06:07 +00:00
{CmdType.CmdSceneEntityMoveCsReq, typeof(SceneEntityMoveCsReq)},
{CmdType.CmdReplaceLineupCsReq, typeof(ReplaceLineupCsReq)},
{CmdType.CmdJoinLineupCsReq, typeof(JoinLineupCsReq)},
{CmdType.CmdQuitLineupCsReq, typeof(QuitLineupCsReq)},
{CmdType.CmdSwapLineupCsReq, typeof(SwapLineupCsReq)},
{CmdType.CmdSetLineupNameCsReq, typeof(SetLineupNameCsReq)},
{CmdType.CmdStartCocoonStageCsReq, typeof(StartCocoonStageCsReq)},
{CmdType.CmdPVEBattleResultCsReq, typeof(PVEBattleResultCsReq)}
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;
}
}
}