AxibugEmuOnline/AxibugEmuOnline.Server/Manager/ChatManager.cs

29 lines
1004 B
C#
Raw Permalink Normal View History

2024-06-28 17:43:55 +08:00
using AxibugProtobuf;
using AxibugEmuOnline.Server.Common;
using AxibugEmuOnline.Server.NetWork;
using System.Net.Sockets;
namespace AxibugEmuOnline.Server.Manager
{
public class ChatManager
{
public ChatManager()
{
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdChatmsg, RecvPlayerChatMsg);
}
public void RecvPlayerChatMsg(Socket sk, byte[] reqData)
{
2024-07-09 17:22:09 +08:00
ClientInfo _c = AppSrv.g_ClientMgr.GetClientForSocket(sk);
AppSrv.g_Log.Debug("收到聊天消息请求");
2024-06-28 17:43:55 +08:00
Protobuf_ChatMsg msg = ProtoBufHelper.DeSerizlize<Protobuf_ChatMsg>(reqData);
byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_ChatMsg_RESP()
{
ChatMsg = msg.ChatMsg,
NickName = _c.Account,
Date = Helper.GetNowTimeStamp()
});
2024-07-09 17:22:09 +08:00
AppSrv.g_ClientMgr.ClientSendALL((int)CommandID.CmdChatmsg, (int)ErrorCode.ErrorOk, respData);
2024-06-28 17:43:55 +08:00
}
}
}