You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.7 KiB
76 lines
2.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
|
|
namespace World
|
|
{
|
|
public static class ChatSvc
|
|
{
|
|
public static void OnChatLoginReq(uint remoteAppId, StructPacket packet)
|
|
{
|
|
ref CSChatLoginReq req = ref packet.GetMessage<CSChatLoginReq>();
|
|
req.Ret = CSErrCode.Fail;
|
|
PlayerInfoWorld player = WorldServerUtils.GetPlayerTableOp().GetPlayerInfo(req.PlayerUid);
|
|
if (player == null)
|
|
{
|
|
TraceLog.Trace("ChatSvc.OnChatLoginReq player {0} = null", packet.ObjectID);
|
|
return;
|
|
}
|
|
req.Ret = CSErrCode.None;
|
|
req.RoleBase.CopyFrom(ref player.roleBase);
|
|
req.Lang.SetString(player.Lang);
|
|
req.SysData.CopyFrom(ref player.sysData);
|
|
req.ExtData.CopyFrom(ref player.extData);
|
|
player.ChatServerID = remoteAppId;
|
|
req.NeedSycClient = true;
|
|
req.RealmId = player.RealmID;
|
|
req.LoginToken = player.LoginToken;
|
|
req.EnableMsgTime = player.GagChatEndTime;
|
|
|
|
WorldServerUtils.GetPacketSender().SendToChatServer<CSChatLoginReq>((int)CSGameMsgID.ChatloginReq, ref req, req.PlayerUid);
|
|
return;
|
|
}
|
|
public static void OnChatReq(uint remoteAppId, StructPacket packet)
|
|
{
|
|
ref CSChatReq req = ref packet.GetMessage<CSChatReq>();
|
|
|
|
PlayerInfoWorld player = WorldServerUtils.GetPlayerTableOp().GetPlayerInfo(packet.ObjectID);
|
|
|
|
if (player == null)
|
|
{
|
|
TraceLog.Error("ChatSvc.OnChatReq player {0} = null", packet.ObjectID);
|
|
return;
|
|
}
|
|
|
|
//发给好友聊天
|
|
if (req.ChatChannelType == ChatChannelType.Friend)
|
|
{
|
|
WorldServerUtils.GetPacketSender().SendToFriendServer((int)CSGameMsgID.ChatReq, ref req, player.UserID);
|
|
}
|
|
else
|
|
{
|
|
TraceLog.Trace("ChatSvc.OnChatRes Error ChatChannelType {0}", req.ChatChannelType);
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
//没有逻辑用的,暂时还不知道做啥用的??
|
|
public static void OnChatConsumeRes(uint remoteAppId, StructPacket packet)
|
|
{
|
|
PlayerInfoWorld player = WorldServerUtils.GetPlayerTableOp().GetPlayerInfo(packet.ObjectID);
|
|
if (player == null)
|
|
{
|
|
TraceLog.Error("ChatSvc.OnChatConsumeRes player {0} = null", packet.ObjectID);
|
|
return;
|
|
}
|
|
|
|
ref SSChatConsumeRes consumeres = ref packet.GetMessage<SSChatConsumeRes>();
|
|
var req = consumeres.Chat;
|
|
}
|
|
}
|
|
}
|
|
|