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.
 
 
 
 
 
 

63 lines
2.1 KiB

using LitJson;
using ProtoCSStruct;
using Sog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Game
{
public class ChatSvc
{
//拷贝获取聊天屏蔽黑名单
public static CSErrCode ProcessCopyChatBlackList(PlayerOnGame player, ref RepeatedRoleBaseInfo_128 chatBlackList)
{
chatBlackList.CopyFrom(ref player.RoleData.ExtData.ChatBlackList);
return CSErrCode.None;
}
//检查是否能加入聊天屏蔽黑名单
public static CSErrCode ProcessCheckAddChatBlackList(PlayerOnGame player, long chatBlackUid)
{
if(chatBlackUid == 0)
{
return CSErrCode.Fail;
}
for (int i = 0; i < player.RoleData.ExtData.ChatBlackList.Count; i++)
{
if (player.RoleData.ExtData.ChatBlackList[i].Uid == chatBlackUid)
{
return CSErrCode.InSelfBlacklist;
}
}
return CSErrCode.None;
}
//解除聊天屏蔽黑名单
public static CSErrCode ProcessnDelChatBlackList(PlayerOnGame player, long chatBlackUid)
{
for (int i = 0; i < player.RoleData.ExtData.ChatBlackList.Count; i++)
{
if (player.RoleData.ExtData.ChatBlackList[i].Uid == chatBlackUid)
{
TraceLog.Trace("ChatHandler.ProcessnDelChatBlackList user {0} ChatBlackUid {1}", player.UserID, chatBlackUid);
player.RoleData.ExtData.ChatBlackList.RemoveAt(i);
AddChatBlackVer(player);//必须需要同步最新数据到chatsvr
player.MakeDirty();
return CSErrCode.None;
}
}
return CSErrCode.NotBlacklist;
}
//聊天屏蔽黑名单版本号增加
public static void AddChatBlackVer(PlayerOnGame player)
{
player.RoleData.ExtData.ChatBlackVer++;
}
}
}