Types fix

This commit is contained in:
rfi
2023-10-11 20:20:26 +07:00
parent 5d772848e8
commit 7a984ca417
4 changed files with 489 additions and 480 deletions

View File

@@ -1,9 +1,6 @@
using AscNet.Common.MsgPack;
using MessagePack;
using MongoDB.Bson.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using static AscNet.GameServer.Packet;
using Newtonsoft.Json;
namespace AscNet.GameServer.Handlers
{
@@ -12,7 +9,6 @@ namespace AscNet.GameServer.Handlers
[PacketHandler("HandshakeRequest")]
public static void HandshakeRequestHandler(Session session, byte[] packet)
{
HandshakeRequest request = MessagePackSerializer.Deserialize<HandshakeRequest>(packet);
HandshakeResponse response = new()
{
Code = 0,
@@ -26,6 +22,7 @@ namespace AscNet.GameServer.Handlers
[PacketHandler("LoginRequest")]
public static void LoginRequestHandler(Session session, byte[] packet)
{
LoginRequest request = MessagePackSerializer.Deserialize<LoginRequest>(packet);
session.SendResponse(new LoginResponse
{
Code = 0,
@@ -34,7 +31,8 @@ namespace AscNet.GameServer.Handlers
UtcServerTime = (uint)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
});
session.SendPush(JsonSerializer.Deserialize<NotifyLogin>(File.ReadAllText("Data\\NotifyLogin.json")));
NotifyLogin notifyLogin = JsonConvert.DeserializeObject<NotifyLogin>(File.ReadAllText("Data/NotifyLogin.json"))!;
session.SendPush(notifyLogin);
}
}
}