zhaoyang 3 vuotta sitten
vanhempi
commit
ff0d0f00bf

+ 21 - 5
GameClient/Assets/Game/HotUpdate/ServerProxy/FriendSProxy.cs

@@ -26,6 +26,18 @@ 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 (applyDatas[i].roleInfo.roleId == message.FriendInfo.RoleInfo.RoleId)
+                {
+                    isSame = true;
+                    break;
+                }
+            }
+            if (isSame) return;
+
             RoleInfoData roleInfo = new RoleInfoData();
             roleInfo.roleId = message.FriendInfo.RoleInfo.RoleId;
             roleInfo.roleName = message.FriendInfo.RoleInfo.RoleName;
@@ -40,6 +52,7 @@ namespace ET
 
             FriendDataManager.Instance.AddApplyData(friendInfo);
             EventAgent.DispatchEvent(ConstMessage.FRIEND_APPLY_CHANGE);
+            EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
 
             await ETTask.CompletedTask;
         }
@@ -245,11 +258,14 @@ namespace GFGGame
                 {
                     RoleInfoDetailData roleInfoDetail = new RoleInfoDetailData();
                     roleInfoDetail.slogan = response.Signature;
-                    roleInfoDetail.customSuitData.pos = response.CustomSuit.Pos;
-                    roleInfoDetail.customSuitData.bg = response.CustomSuit.BgId;
-                    roleInfoDetail.customSuitData.suitId = response.CustomSuit.SuitId;
-                    roleInfoDetail.customSuitData.equipDatas = response.CustomSuit.EquipIds;
-                    roleInfoDetail.customSuitData.pic = response.CustomSuit.Pic;
+                    if (response.CustomSuit != null)
+                    {
+                        roleInfoDetail.customSuitData.pos = response.CustomSuit.Pos;
+                        roleInfoDetail.customSuitData.bg = response.CustomSuit.BgId;
+                        roleInfoDetail.customSuitData.suitId = response.CustomSuit.SuitId;
+                        roleInfoDetail.customSuitData.equipDatas = response.CustomSuit.EquipIds;
+                        roleInfoDetail.customSuitData.pic = response.CustomSuit.Pic;
+                    }
 
                     return roleInfoDetail;
                 }

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

@@ -168,7 +168,7 @@ namespace GFGGame
         private void RenderListApplyItem(int index, GObject obj)
         {
             FriendInfoData data = FriendDataManager.Instance.ApplyDatas[index];
-            UI_ListApplyItem item = UI_ListApplyItem.Proxy();
+            UI_ListApplyItem item = UI_ListApplyItem.Proxy(obj);
             item.m_txtName.text = data.roleInfo.roleName;
             item.m_txtLvl.text = data.roleInfo.roleLv.ToString();
             if (item.m_btnAgree.data == null)
@@ -188,8 +188,8 @@ namespace GFGGame
         //通过好友申请
         private async void OnBtnAgreeClick(EventContext context)
         {
-            GObject obj = context.data as GObject;
-            int roleId = (int)obj.data;
+            GObject obj = context.sender as GObject;
+            long roleId = (long)obj.data;
             bool result = await FriendSProxy.ReqAcceptApplyForFriend(roleId);
             if (result)
             {

+ 6 - 1
GameClient/Assets/Game/HotUpdate/Views/Friend/FriendView.cs

@@ -79,6 +79,7 @@ namespace GFGGame
             }
 
             RefreshView();
+            UpdaterRed();
         }
 
         protected override void OnHide()
@@ -206,6 +207,7 @@ namespace GFGGame
 
         private void RefreshAddFriend()
         {
+            if (_ui.m_list.numItems <= 0) return;
             int childIndex = _ui.m_list.ItemIndexToChildIndex(_ui.m_list.selectedIndex);
             GButton item = _ui.m_list.GetChildAt(childIndex).asButton.GetChild("btnSend").asButton;
             FriendInfoData friendInfo = item.data as FriendInfoData;
@@ -240,17 +242,20 @@ namespace GFGGame
         {
             if (_sceneObject == null)
             {
-                _ui.m_txtName.text = string.Format("我的套装{0}", NumberUtil.GetChiniseNumberText(suitSavedData.pos + 1));
                 _sceneObject = GameObject.Instantiate(_scenePrefab);
                 EquipDataCache.cacher.setSceneObj(_sceneObject);
             }
             if (suitSavedData != null)
             {
                 EquipDataCache.cacher.PutOnSuitMemory(suitSavedData);
+                _ui.m_txtName.text = string.Format("我的套装{0}", NumberUtil.GetChiniseNumberText(suitSavedData.pos + 1));
+
             }
             else
             {
                 EquipDataCache.cacher.PutOnDefaultSuitSaved();
+                _ui.m_txtName.text = string.Format("我的套装{0}", NumberUtil.GetChiniseNumberText(1));
+
             }
         }