HaoYueTunnel/ServerCore/Manager/ChatManager.cs

29 lines
990 B
C#
Raw Normal View History

2023-05-25 13:24:51 +08:00
using AxibugProtobuf;
using ServerCore.Common;
2023-05-25 18:30:22 +08:00
using ServerCore.NetWork;
2023-05-25 13:24:51 +08:00
using System.Net.Sockets;
2023-05-25 18:30:22 +08:00
namespace ServerCore.Manager
2023-05-25 13:24:51 +08:00
{
public class ChatManager
{
2023-05-25 18:30:22 +08:00
public ChatManager()
{
NetMsg.Instance.RegNetMsgEvent((int)CommandID.CmdChatmsg, RecvPlayerChatMsg);
}
2023-05-25 13:24:51 +08:00
public void RecvPlayerChatMsg(Socket sk, byte[] reqData)
{
ClientInfo _c = ServerManager.g_ClientMgr.GetClientForSocket(sk);
ServerManager.g_Log.Debug("收到新的登录请求");
2023-05-25 18:30:22 +08:00
Protobuf_ChatMsg msg = ProtoBufHelper.DeSerizlize<Protobuf_ChatMsg>(reqData);
byte[] respData = ProtoBufHelper.Serizlize(new Protobuf_ChatMsg_RESP()
2023-05-25 13:24:51 +08:00
{
ChatMsg = msg.ChatMsg,
2023-05-25 18:30:22 +08:00
NickName = _c.NickName,
2023-05-25 13:24:51 +08:00
Date = Helper.GetNowTimeStamp()
});
ServerManager.g_ClientMgr.ClientSendALL((int)CommandID.CmdChatmsg, (int)ErrorCode.ErrorOk, respData);
}
}
}