Browse Source

画廊下拉刷新判断缓存上限并清理

zhangyuqian 10 months ago
parent
commit
8d297524a4

+ 14 - 0
GameClient/Assets/Game/HotUpdate/Data/PoemGalleryDataManager.cs

@@ -207,6 +207,20 @@ namespace GFGGame
                 }
             }
         }
+        public void RemoveGalleryData()
+        {
+            if (_dicGalleryData.Count > 30)
+            {
+                for (int i = 0; i < GalleryIDList.Count; i++)
+                {
+                    long id = GalleryIDList[i];
+                    if (_dicGalleryData.ContainsKey(id))
+                    {
+                        _dicGalleryData.Remove(id);
+                    }
+                }           
+             }
+        }
         public void UpdateRoleInfo(long workId, string name, int rank = 0)
         {
             if (_dicGalleryData.ContainsKey(workId))

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemGalleryView.cs

@@ -776,6 +776,7 @@ namespace GFGGame
 
             isPullDown = true;
             _scrollList.scrollPane.LockHeader(_scrollList.scrollPane.header.sourceHeight);
+            PoemGalleryDataManager.Instance.RemoveGalleryData();
             PoemGalleryDataManager.Instance.GalleryIDList.Clear();
             bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, 0, PoemGalleryDataManager.pageCount);
             // OnPullDownTimeComplete();