Browse Source

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

hexiaojie 10 months ago
parent
commit
4a9ebfdca7

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

@@ -139,9 +139,12 @@ namespace GFGGame
         public List<long> RankDatas = new List<long>();
 
         private Dictionary<long, PoemGalleryData> _dicGalleryData = new Dictionary<long, PoemGalleryData>();
+        public List<long> GalleryIDList = new List<long>();
+        public int index = 10;
 
         public void Clear()
         {
+            GalleryIDList.Clear();
             _myWorksRanks.Clear();
             _dicGalleryData.Clear();
             RecommendDatas.Clear();
@@ -186,6 +189,24 @@ namespace GFGGame
             }
             return null;
         }
+        public void SetGalleryData()
+        {
+            if(_dicGalleryData.Count > 30)
+            {
+                if(GalleryIDList.Count >= 10)
+                {
+                    for (int i = 0; i < 10 && _dicGalleryData.Count > 0; i++)
+                    {
+                        long id = GalleryIDList[i];
+                        if (_dicGalleryData.ContainsKey(id))
+                        {
+                            _dicGalleryData.Remove(id);
+                        }
+                    }
+                    GalleryIDList.RemoveRange(0, 10);
+                }
+            }
+        }
         public void UpdateRoleInfo(long workId, string name, int rank = 0)
         {
             if (_dicGalleryData.ContainsKey(workId))

+ 1 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/PoemGallerySProxy.cs

@@ -64,6 +64,7 @@ namespace GFGGame
                     for (int i = 0; i < response.WorksList.Count; i++)
                     {
                         PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(response.WorksList[i].WorksId);
+                        PoemGalleryDataManager.Instance.GalleryIDList.Add(response.WorksList[i].WorksId);
                         if (data != null)
                         {
                             PoemGalleryDataManager.Instance.UpdateRoleInfo(response.WorksList[i].WorksId, response.WorksList[i].AuthorName);

+ 23 - 7
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemGalleryView.cs

@@ -69,6 +69,7 @@ namespace GFGGame
 
         private bool isPullDown = false;//是否下拉刷新中,刷新中再次下拉不会重新请求更新数据
         private bool isPullUp = false;//是否上拉刷新中,刷新中再次下拉不会重新请求更新数据
+        private int LimitNum = 30;
         public override void Dispose()
         {
             if (_ui != null)
@@ -200,6 +201,7 @@ namespace GFGGame
                 UpdateList();
                 PullDown();
                 OnPullDownRelease();
+                ViewManager.Hide<ModalStatusView>();
             }
 
             _ui.m_c1.selectedIndex = _tabIndex;
@@ -234,6 +236,7 @@ namespace GFGGame
             base.OnHide();
             ResetPullRelease();
             _ui.m_comNormal.m_comBoBox.selectedIndex = 0;
+            PoemGalleryDataManager.Instance.index = 10;
             Timers.inst.Remove(CheckGuide);
         }
 
@@ -432,7 +435,7 @@ namespace GFGGame
             bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, startIndex, PoemGalleryDataManager.pageCount);
             if (result)
             {
-                Timers.inst.StartCoroutine(PictureStorageHelper.Download(_galleryDatas, startIndex, UpdateGalleryList));
+                Timers.inst.StartCoroutine(PictureStorageHelper.Download(_galleryDatas, startIndex, UpdateGallery));
             }
         }
 
@@ -462,9 +465,21 @@ namespace GFGGame
                     _list1.numItems = Mathf.Max(0, (_galleryDatas.Count - 1) / 2);
                 }
             }
-
+        }
+        private void UpdateGallery()
+        {
             UpdateView();
             ResetPullRelease();
+            UpdateGalleryList();
+            if (_galleryDatas.Count > LimitNum && PoemGalleryDataManager.Instance.GalleryIDList.Count > LimitNum)
+            {
+                PoemGalleryDataManager.Instance.SetGalleryData();
+                int indexList = LimitNum / 6 * 2;
+                _galleryDatas.RemoveRange(0, PoemGalleryDataManager.pageCount);
+                UpdateGalleryList();
+                _list.ScrollToView(indexList);
+                _list1.ScrollToView(indexList);
+            }
         }
 
         //请求排行榜刷新
@@ -761,13 +776,14 @@ namespace GFGGame
 
             isPullDown = true;
             _scrollList.scrollPane.LockHeader(_scrollList.scrollPane.header.sourceHeight);
-
+            PoemGalleryDataManager.Instance.GalleryIDList.Clear();
             bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, 0, PoemGalleryDataManager.pageCount);
             // OnPullDownTimeComplete();
             if (result && isShowing)
             {
+                PoemGalleryDataManager.Instance.index = 10;
                 PoemGalleryDataManager.Instance.waitRelease = true;
-                Timers.inst.StartCoroutine(PictureStorageHelper.Download(_galleryDatas, 0, UpdateGalleryList));
+                Timers.inst.StartCoroutine(PictureStorageHelper.Download(_galleryDatas, 0, UpdateGallery));
             }
 
         }
@@ -799,11 +815,12 @@ namespace GFGGame
             isPullUp = true;
             _scrollList.scrollPane.LockFooter(footer.sourceHeight + 10);
 
-            bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, _galleryDatas.Count, PoemGalleryDataManager.pageCount);
+            bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, PoemGalleryDataManager.Instance.index, PoemGalleryDataManager.pageCount);
             if (result && isShowing)
             {
+                PoemGalleryDataManager.Instance.index += PoemGalleryDataManager.pageCount;
                 PoemGalleryDataManager.Instance.waitRelease = true;
-                Timers.inst.StartCoroutine(PictureStorageHelper.Download(_galleryDatas, _lastGalleryDatasCount, UpdateGalleryList));
+                Timers.inst.StartCoroutine(PictureStorageHelper.Download(_galleryDatas, _lastGalleryDatasCount, UpdateGallery));
             }
         }
 
@@ -829,7 +846,6 @@ namespace GFGGame
         {
             OnPullDownTimeComplete();
             OnPullUpTimeComplete();
-            ViewManager.Hide<ModalStatusView>();
         }
 
         private void CheckGuide(object param)