瀏覽代碼

Merge remote-tracking branch 'remotes/origin/master' into xiaojie

hexiaojie 2 年之前
父節點
當前提交
d767524a87

+ 13 - 0
GameClient/Assets/Game/HotUpdate/Data/FriendDataManager.cs

@@ -169,6 +169,19 @@ namespace GFGGame
         {
             _applyDatas.Add(applyData);
         }
+
+        public bool CheckInApplyList(long roleId)
+        {
+            foreach(var friendInfo in _applyDatas)
+            {
+                if(friendInfo.roleInfo.roleId == roleId)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
         public void RemoveApplyData(long roleId)
         {
             for (int i = _applyDatas.Count - 1; i >= 0; i--)

+ 8 - 10
GameClient/Assets/Game/HotUpdate/ServerProxy/FriendSProxy.cs

@@ -1,6 +1,8 @@
 using System.Collections.Generic;
 using GFGGame;
 using ET;
+using UnityEditor.VersionControl;
+
 namespace ET
 {
     //推送好友每日重置
@@ -37,17 +39,10 @@ namespace ET
     {
         protected override async ETTask Run(Session session, S2C_NoticeApplyForFriend message)
         {
-            List<FriendInfoData> applyDatas = FriendDataManager.Instance.ApplyDatas;
-            bool isSame = false;
-            for (int i = applyDatas.Count - 1; i >= 0; i--)
+            if(FriendDataManager.Instance.CheckInApplyList(message.FriendInfo.RoleInfo.RoleId))
             {
-                if (applyDatas[i].roleInfo.roleId == message.FriendInfo.RoleInfo.RoleId)
-                {
-                    isSame = true;
-                    break;
-                }
+                return;
             }
-            if (isSame) return;
 
             OtherRoleInfoData roleInfo = new OtherRoleInfoData();
             roleInfo.roleId = message.FriendInfo.RoleInfo.RoleId;
@@ -161,7 +156,10 @@ namespace GFGGame
                         }
                         else if (response.FriendList[i].Type == FriendType.Apply)
                         {
-                            FriendDataManager.Instance.AddApplyData(friendInfo);
+                            if (!FriendDataManager.Instance.CheckInApplyList(friendInfo.roleInfo.roleId))
+                            {
+                                FriendDataManager.Instance.AddApplyData(friendInfo);
+                            }
                         }
                     }
                     EventAgent.DispatchEvent(ConstMessage.FRIEND_ADD);

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/Friend/FriendAddView.cs

@@ -196,7 +196,7 @@ namespace GFGGame
             bool result = await FriendSProxy.ReqAcceptApplyForFriend(roleId);
             if (result)
             {
-                _ui.m_listApply.numItems = FriendDataManager.Instance.ApplyDatas.Count;
+                UpdateApplyList();
             }
         }
 
@@ -208,7 +208,7 @@ namespace GFGGame
             bool result = await FriendSProxy.ReqRefuseApplyForFriend(roleId);
             if (result)
             {
-                _ui.m_listApply.numItems = FriendDataManager.Instance.ApplyDatas.Count;
+                UpdateApplyList();
             }
         }