zhaoyang 2 年之前
父节点
当前提交
f2c9f4a2d2

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

@@ -79,13 +79,41 @@ namespace GFGGame
                         list.Add(data.WorkId);
                         PoemGalleryDataManager.Instance.UpdateGalleryData(data);
                     }
-
                     return true;
                 }
             }
             return false;
         }
 
+        public static IEnumerator Download(List<long> list)
+        {
+            // ET.Log.Debug("zoya000");
+            for (int i = 0; i < list.Count; i++)
+            {
+                // ET.Log.Debug("zoya111:  " + list[i]);
+
+                PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(list[i]);
+                using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(data.PictureTempUrl))
+                {
+                    yield return request.SendWebRequest();
+                    if (request.result == UnityWebRequest.Result.ProtocolError || request.result == UnityWebRequest.Result.ConnectionError)
+                    {
+                        PromptController.Instance.ShowFloatTextPrompt("下载失败");
+                        yield return null;
+                    }
+                    else
+                    {
+                        Texture2D texture = (request.downloadHandler as DownloadHandlerTexture).texture;
+                        data.Ntexture = new NTexture(texture);
+                    }
+                }
+                // ET.Log.Debug("zoya222:  " + list[i]);
+            }
+            // ET.Log.Debug("zoya333:  ");
+            EventAgent.DispatchEvent(ConstMessage.GALLERY_DATA_CHANGE);
+        }
+
+
         //请求投稿画廊作品
         public static async ETTask<object[]> ReqUpLoadGalleryWorks()
         {

+ 15 - 29
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemGalleryView.cs

@@ -120,7 +120,7 @@ namespace GFGGame
         {
             base.AddEventListener();
 
-            // EventAgent.AddEventListener(ConstMessage.GALLERY_DATA_CHANGE, UpdateGalleryList);
+            EventAgent.AddEventListener(ConstMessage.GALLERY_DATA_CHANGE, UpdateGalleryList);
             // EventAgent.AddEventListener(ConstMessage.GALLERY_RANK_DATA_CHANGE, UpdateGalleryRankList);
         }
         protected override void OnShown()
@@ -340,7 +340,7 @@ namespace GFGGame
             bool result = await PoemGallerySProxy.ReqGalleryList(_sortType, startIndex, _pageCount);
             if (result)
             {
-                UpdateGalleryList();
+                Timers.inst.StartCoroutine(PoemGallerySProxy.Download(_galleryDatas));
             }
         }
         private void UpdateGalleryList()
@@ -380,20 +380,6 @@ namespace GFGGame
             UpdateView();
         }
 
-        // private void RefreshList()
-        // {
-        //     if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)
-        //     {
-        //         _ui.m_comNormal.m_listRank.numItems = _galleryDatas.Count;
-        //     }
-        //     else
-        //     {
-        //         _list.numItems = _galleryDatas.Count;
-        //         _list1.numItems = _galleryDatas.Count;
-        //     }
-        //     UpdateView();
-        // }
-
 
         /********************************************************界面更新*************************************************/
         private void UpdateView()
@@ -466,19 +452,19 @@ namespace GFGGame
             long workId = _galleryDatas[index];
             PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
             UI_ListRankItem item = UI_ListRankItem.Proxy(obj);
-            // if (data.Ntexture == null)
-            // {
-            //     Timers.inst.StartCoroutine(PictureStorageHelper.DownloadFile(data.PictureTempUrl, (Texture2D texture) =>
-            //     {
-            //         data.Ntexture = new NTexture(texture);
-            //         item.m_loaIcon.texture = data.Ntexture;
-            //     }));
-            // }
-            // else
-            // {
-            //     item.m_loaIcon.texture = data.Ntexture;
-            // }
-            // item.m_loaIcon.height = item.m_loaIcon.width * item.m_loaIcon.texture.height / item.m_loaIcon.texture.width;
+            if (data.Ntexture == null)
+            {
+                Timers.inst.StartCoroutine(PictureStorageHelper.DownloadFile(data.PictureTempUrl, (Texture2D texture) =>
+                {
+                    data.Ntexture = new NTexture(texture);
+                    item.m_loaIcon.texture = data.Ntexture;
+                }));
+            }
+            else
+            {
+                item.m_loaIcon.texture = data.Ntexture;
+            }
+            item.m_loaIcon.height = item.m_loaIcon.width * item.m_loaIcon.texture.height / item.m_loaIcon.texture.width;
 
             item.m_txtName.text = data.AuthorName;
             item.m_btnCollect.title = data.CollectCount.ToString();

二进制
GameClient/Assets/ResIn/Config/excelConfig.sqlite.bytes