zhaoyang 2 년 전
부모
커밋
62478c50a0

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

@@ -59,7 +59,6 @@ namespace GFGGame
         }
         public static IEnumerator DownloadFile(string pictureTempUrl, Action<Texture2D> callback)
         {
-            ET.Log.Debug("PictureTempUrl:" + pictureTempUrl);
             using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(pictureTempUrl))
             {
                 yield return request.SendWebRequest();

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

@@ -185,22 +185,6 @@ namespace GFGGame
             return false;
         }
 
-        //取消点赞指定画廊作品
-        public static async ETTask<bool> ReqCancelVoteGalleryWorks(long worksId)
-        {
-            S2C_CancelLikeGalleryWorks response = null;
-            response = (S2C_CancelLikeGalleryWorks)await MessageHelper.SendToServer(new C2S_CancelLikeGalleryWorks() { WorksId = worksId });
-            if (response != null)
-            {
-                if (response.Error == ErrorCode.ERR_Success)
-                {
-                    PoemGalleryDataManager.Instance.UpdateFavoriteState(response.WorksId, false, response.BelikedCount);
-                    return true;
-                }
-            }
-            return false;
-        }
-
         //获取画廊作品排行榜
         public static async ETTask<bool> ReqRankList()
         {
@@ -210,8 +194,6 @@ namespace GFGGame
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 {
-
-                    // List<PoemGalleryData> list = PoemGalleryDataManager.Instance.RankDatas;
                     List<long> list = PoemGalleryDataManager.Instance.RankDatas;
 
                     for (int i = 0; i < response.RankList.Count; i++)
@@ -232,16 +214,7 @@ namespace GFGGame
                         data.PictureTempUrl = response.RankList[i].PictureTempUrl;
                         list.Add(data.WorkId);
                         PoemGalleryDataManager.Instance.UpdateGalleryData(data);
-                        // Timers.inst.StartCoroutine(PictureStorageHelper.DownloadFile(data.PictureTempUrl, (Texture2D texture) =>
-                        // {
-                        //     data.Ntexture = new NTexture(texture);
-                        //     list.Add(data.WorkId);
-                        //     PoemGalleryDataManager.Instance.UpdateGalleryData(data);
-                        //     if (list.Count == response.RankList.Count)
-                        //     {
-                        //         EventAgent.DispatchEvent(ConstMessage.GALLERY_RANK_DATA_CHANGE);
-                        //     }
-                        // }));
+
                     }
                     return true;
                 }

+ 4 - 5
GameClient/Assets/Game/HotUpdate/Views/DressUp/PhotographView.cs

@@ -550,12 +550,12 @@ namespace GFGGame
 
         private void OnClickBtnPhotograph()
         {
-            GRoot.inst.visible = false;
+            // GRoot.inst.visible = false;
             Timers.inst.StartCoroutine(ScreenShotTex());// ();
         }
         private void OnClickBtnGalleryJoin()
         {
-            GRoot.inst.visible = false;
+            // GRoot.inst.visible = false;
             Timers.inst.StartCoroutine(ScreenShotTex());// ();
         }
         private IEnumerator ScreenShotTex()
@@ -568,12 +568,11 @@ namespace GFGGame
             tex.ReadPixels(rect, 0, 0);//读取像素,屏幕左下角为0点
             tex.Apply();//保存像素信息
 
-            byte[] bytes = tex.EncodeToJPG();
+            GRoot.inst.visible = true;
 
             if (_ui.m_c1.selectedIndex == 0)
             {
                 ViewManager.Show<PhotographSaveView>(tex);
-                GRoot.inst.visible = true;
                 LogServerHelper.SendNodeLog((int)PlayParticipationEnum.PAI_ZHAO, 2);
             }
             else if (_ui.m_c1.selectedIndex == 1)
@@ -584,7 +583,7 @@ namespace GFGGame
                     ViewManager.Show<ModalStatusView>("上传中...");
                     string[] rsp = await PoemGallerySProxy.ReqUpLoadGalleryWorks();
                     if (rsp == null) return;
-
+                    byte[] bytes = tex.EncodeToJPG();
                     bool pushResult = await PictureStorageHelper.PushToHWCloud(rsp[0], bytes);
                     if (!pushResult) return;
 

+ 53 - 104
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemGalleryView.cs

@@ -131,8 +131,8 @@ namespace GFGGame
                 _ui.m_comNormal.m_comBoBox.selectedIndex = (int)(this.viewData as object[])[2];
                 _ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
                 _ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
-                _list.RefreshVirtualList();
-                _list1.RefreshVirtualList();
+
+                UpdateGalleryList();
             }
             else
             {
@@ -155,13 +155,7 @@ namespace GFGGame
 
             _ui.m_c1.selectedIndex = _tabIndex;
 
-
-            // _ui.m_comNormal.m_comScroll.m_listRecommend.numItems = 7;
-            // _ui.m_comNormal.m_comScroll.m_listRecommend.ResizeToFit();
-            // _ui.m_comNormal.m_comScroll.m_listRecommend1.numItems = 6;
-            // _ui.m_comNormal.m_comScroll.m_listRecommend1.ResizeToFit();
-            UpdateGalleryList();
-
+            // UpdateGalleryList();
             UpdateView();
         }
 
@@ -227,8 +221,6 @@ namespace GFGGame
         /// </summary>
         private void OnBtnJoinClick()
         {
-            // int tabIndex = _ui.m_c1.selectedIndex;
-            // int subType = _ui.m_c1.selectedIndex
             object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
             ViewManager.Show<DressUpView>(1, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas }, true);
         }
@@ -263,7 +255,6 @@ namespace GFGGame
             {
                 if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//首页
                 {
-                    // _infoType = GalleryType.Recommend;
                     if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
                     {
                         _sortType = (int)GallerySortType.Recommend;
@@ -274,13 +265,11 @@ namespace GFGGame
                         _sortType = (int)GallerySortType.Newest;
                         _galleryDatas = PoemGalleryDataManager.Instance.NewestDatas;
                     }
-                    // _list = _ui.m_comNormal.m_listRecommend;
                 }
                 else if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.FRIEND)//好友
                 {
                     _sortType = (int)GallerySortType.Friend;
                     _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
-                    // _list = _ui.m_comNormal.m_listFriend;
                 }
                 _list = _ui.m_comNormal.m_comScroll.m_listRecommend;
                 _list1 = _ui.m_comNormal.m_comScroll.m_listRecommend1;
@@ -301,13 +290,11 @@ namespace GFGGame
             {
                 _sortType = (int)GallerySortType.MyCollect;
                 _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
-                // _list = _ui.m_comFavorites.m_listFavorite;
             }
             else if (_ui.m_comFavorites.m_c1.selectedIndex == FavoritesType.MY_SELF)//我的作品
             {
                 _sortType = (int)GallerySortType.MyWorks;
                 _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
-                // _list = _ui.m_comFavorites.m_listMySelf;
             }
             _list = _ui.m_comNormal.m_comScroll.m_listRecommend;
             _list1 = _ui.m_comNormal.m_comScroll.m_listRecommend1;
@@ -319,31 +306,12 @@ namespace GFGGame
 
         /********************************************************请求更新列表*************************************************/
 
-        //分页刷新
-        // private void onScroll()
-        // {
-        //     if (_list == null) return;
-        //     int index = _list.ItemIndexToChildIndex(_list.numItems);
-        //     int itemIndex = _list.ChildIndexToItemIndex(0);
-        //     int startIndex = itemIndex + 1;
-        //     if (startIndex >= _list.numItems && startIndex % _pageCount == 0)
-        //     {
-        //         ReqGalleryList(startIndex);
-        //     }
-        // }
-
         private void onScrollEnd()
         {
-            // int index = _list.ItemIndexToChildIndex(_list.numItems);
-            // if (index <= _list.numChildren)
-            // {
-
-            // }
             if (_comScroll.scrollPane.percY == 1)
             {
                 ReqGalleryList(_list.numItems);
             }
-            // GObject obj = _list.GetChildAt(index);
         }
         //请求刷新
         private async void ReqGalleryList(int startIndex)
@@ -356,30 +324,21 @@ namespace GFGGame
         }
         private void UpdateGalleryList()
         {
-            // if (_galleryDatas.Count % 2 == 0)
-            // {
-            //     _list.numItems = _galleryDatas.Count / 2;
-            //     _list1.numItems = _galleryDatas.Count / 2;
-            // }
-            // else
-            // {
-            //     _list.numItems = (_galleryDatas.Count + 1) / 2;
-            //     _list1.numItems = (_galleryDatas.Count - 1) / 2;
-            // }
-            UpdateView();
-            int count = PoemPhotoDataManager.Instance.PersonalPhotoInfos.Count;
             if (_galleryDatas.Count % 2 == 0)
             {
-                _list.numItems = count / 2;
-                _list1.numItems = count / 2;
+                _list.numItems = _galleryDatas.Count / 2;
+                _list1.numItems = _galleryDatas.Count / 2;
             }
             else
             {
-                _list.numItems = (count + 1) / 2;
-                _list1.numItems = (count - 1) / 2;
+                _list.numItems = (_galleryDatas.Count + 1) / 2;
+                _list1.numItems = (_galleryDatas.Count - 1) / 2;
             }
+
             _list.ResizeToFit();
             _list1.ResizeToFit();
+
+            UpdateView();
         }
 
         //请求排行榜刷新
@@ -422,70 +381,63 @@ namespace GFGGame
 
         private void RenderListItem(int index, GObject obj)
         {
-            int dataIndex = index * 2;
-            long workId = PoemPhotoDataManager.Instance.PersonalPhotoInfos[index * 2].PictureId;// _galleryDatas[index * 2];
-
-            UpdateListItem(workId, obj, dataIndex);
+            long workId = _galleryDatas[index * 2];
+            UpdateListItem(workId, obj);
         }
+
         private void RenderListItem1(int index, GObject obj)
         {
-            int dataIndex = index * 2 + 1;
-            long workId = PoemPhotoDataManager.Instance.PersonalPhotoInfos[index * 2 + 1].PictureId;// _galleryDatas[index * 2 + 1];
-
-            UpdateListItem(workId, obj, dataIndex);
+            long workId = _galleryDatas[index * 2 + 1];
+            UpdateListItem(workId, obj);
         }
 
-        private void UpdateListItem(long workId, GObject obj, int dataIndex)
+        private void UpdateListItem(long workId, GObject obj)
         {
+            PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
             UI_ListItem item = UI_ListItem.Proxy(obj);
-            NTexture nTexture = PoemPhotoDataManager.Instance.PersonalPhotoInfos[dataIndex].Ntexture;
-            item.m_loaIcon.texture = nTexture;
-            item.m_loaIcon.height = item.m_loaIcon.width * item.m_loaIcon.texture.height / item.m_loaIcon.texture.width;
-            UI_ListItem.ProxyEnd();
-            // PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
-            // UI_ListItem item = UI_ListItem.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;
-            //     }));
-            // }
-            // item.m_loaIcon.SetSize(item.m_loaIcon.width, 550 + Random.Range(1, 5) * 30);
-
-            // item.m_loaIcon.texture = data.Ntexture;
-            // item.m_txtName.text = data.AuthorName;
-            // item.m_btnCollect.title = data.CollectCount.ToString();
-            // item.m_btnCollect.selected = data.CollectOrNot;
-            // item.m_btnVote.title = data.VoteCount.ToString();
-            // item.m_btnVote.selected = data.VoteOrNot;
+            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();
+            item.m_btnCollect.selected = data.CollectOrNot;
+            item.m_btnVote.title = data.VoteCount.ToString();
+            item.m_btnVote.selected = data.VoteOrNot;
 
-            // if (item.m_loaIcon.data == null)
-            // {
-            //     item.m_loaIcon.onClick.Add(OnLoaIconClick);
-            // }
-            // item.m_loaIcon.data = workId;
-            // if (item.m_btnCollect.data == null)
-            // {
-            //     item.m_btnCollect.onClick.Add(OnBtnCollectClick);
-            // }
-            // item.m_btnCollect.data = workId;
-            // if (item.m_btnVote.data == null)
-            // {
-            //     item.m_btnVote.onClick.Add(OnBtnVoteClick);
-            // }
-            // item.m_btnVote.data = workId;
-            // UI_ListItem.ProxyEnd();
+            if (item.m_loaIcon.data == null)
+            {
+                item.m_loaIcon.onClick.Add(OnLoaIconClick);
+            }
+            item.m_loaIcon.data = workId;
+            if (item.m_btnCollect.data == null)
+            {
+                item.m_btnCollect.onClick.Add(OnBtnCollectClick);
+            }
+            item.m_btnCollect.data = workId;
+            if (item.m_btnVote.data == null)
+            {
+                item.m_btnVote.onClick.Add(OnBtnVoteClick);
+            }
+            item.m_btnVote.data = workId;
+            UI_ListItem.ProxyEnd();
         }
 
         private void RenderListRankItem(int index, GObject obj)
         {
-            // long workId = _galleryDatas[index];
-            // PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
+            long workId = _galleryDatas[index];
+            PoemGalleryData data = PoemGalleryDataManager.Instance.GetGalleryDataById(workId);
             UI_ListRankItem item = UI_ListRankItem.Proxy(obj);
-            // item.m_loaIcon.height = 550 + Random.Range(40, 100);
 
             // item.target.height = item.m_loaIcon.height + 80;
             // item.m_loaIcon.texture = data.Ntexture;
@@ -590,12 +542,9 @@ namespace GFGGame
         //自动下拉
         private void PullDown()
         {
-            // if (_ui.m_comNormal.m_listRecommend.numItems > 0) _ui.m_comNormal.m_listRecommend.ScrollToView(0);
             _list.ScrollToView(0);
-            // _comScroll.scrollPane.posY = 0;
             GComponent header = _comScroll.scrollPane.header;
             header.height = header.sourceHeight;
-            // _comScroll.scrollPane.LockHeader(header.sourceHeight);
         }
 
         //下拉刷新