Files
hjha-server/GameModule/GlobalManager/PlayerDataAsycExtension.cs
xiaoou e9616125ce feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) +
game logic (GameFix/GameDAL/ServerData) +
network layer (NetWorkMessage) +
data layer (ObjectModel) +
utilities (MrWu/Core/Config/CloudAPI/dll) +
adapters (zyxAdapter/base)

.NET 8.0 C# solution, 16 projects, 958 source files
2026-07-07 12:02:15 +08:00

57 lines
1.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Text;
using GameData;
using MrWu.Debug;
using Server.Data;
namespace Server
{
public static class PlayerDataAsycExtension
{
public static void SendPack2Client(this PlayerDataAsyc self,PackHead head,byte[] data,bool native,ref string jsonMessage)
{
if (self == null)
{
Debug.Error("发送给空的玩家!");
return;
}
if (self.isRobot)
{
return;
}
//Debug.Info($"发送包数据,客户端版本:{self.ClientVer}");
if (self.ClientVer > 46)
{
//新的客户端
GameNet.SendPack(self,head,data);
}
else
{
SendPack2ClientV1_Old(self, head, data, native, ref jsonMessage);
}
}
/// <summary>
/// 过时的版本给客户端版本小于等于46的玩家发送数据
/// </summary>
private static void SendPack2ClientV1_Old(this PlayerDataAsyc self,PackHead head,byte[] data,bool native,ref string jsonMessage)
{
if (jsonMessage == null)
{
if (native)
{
//原生的
jsonMessage = Convert.ToBase64String(data);
}
else
{
jsonMessage = Encoding.UTF8.GetString(data);
}
}
GameNet.SendPack(self,head,jsonMessage);
}
}
}