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.
69 lines
2.0 KiB
69 lines
2.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
|
|
namespace Friend
|
|
{
|
|
#if false
|
|
public static class FriendDataOp
|
|
{
|
|
public static ref DBFriendOneStruct UpdateFriendInfoToInFriendList(ref DBFriendListStruct list, ref DBFriendSelf self)
|
|
{
|
|
for(int i =0;i<list.iCount;i++)
|
|
{
|
|
ref DBFriendOneStruct one = ref FriendOp.GetFriendOneByIndex(ref FriendOp.GetFriendInfoByUid(self.Uid), i);
|
|
if(one.oneFriend.Uid == self.Uid)
|
|
{
|
|
//update
|
|
FriendOp.UpdateSelfInfoTOFriendOne(ref self,ref one);
|
|
return ref one;
|
|
}
|
|
}
|
|
|
|
return ref FriendInfoCache.m_cacheStructFriendOne.GetByIndex(0);
|
|
}
|
|
|
|
public static bool IsFriendListFull(ref FriendCacheInfoStruct info)
|
|
{
|
|
return info.FriendList.iCount >= FriendConfig.GetFriendListCountMax();
|
|
}
|
|
|
|
public static bool CanAddNewToFriendList(long playerUid, long friendUid)
|
|
{
|
|
if(FriendOp.ISAlreadyBeenFriend(playerUid, friendUid) == 1)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
ref FriendCacheInfoStruct info = ref FriendOp.GetFriendInfoByUid(playerUid);
|
|
if (info.IsNull())
|
|
{
|
|
//满了
|
|
if (IsFriendListFull(ref info))
|
|
{
|
|
TraceLog.Debug("FriendDataOp.CanAddNewToFriendList friend list full! uid {0}", playerUid);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 陌生人列表是否已经满了
|
|
/// </summary>
|
|
/// <param name="info"></param>
|
|
/// <returns></returns>
|
|
public static bool IsStrangerListFull(ref FriendCacheInfoStruct info)
|
|
{
|
|
return info.FriendOpData.StrangerCount >= FriendConfig.GetFriendStrangerListCountMax();
|
|
}
|
|
}
|
|
|
|
#endif
|
|
}
|
|
|