Browse Source

画廊切到换装,待资源释放后放回画廊会报错

zhaoyang 2 years ago
parent
commit
ffeaafdfc9

+ 1 - 1
FGUIProject/assets/poem/componentsGallery/ComNormal.xml

@@ -39,7 +39,7 @@
       <gearDisplay controller="c1" pages="0,1"/>
       <relation target="" sidePair="height-height"/>
     </component>
-    <component id="n38_v95q" name="comOpenLoad" src="r9ri12p" fileName="componentsGallery/ComPullHead.xml" xy="460,489" touchable="false"/>
+    <component id="n38_v95q" name="comOpenLoad" src="r9ri12p" fileName="componentsGallery/ComPullHead.xml" xy="460,489" visible="false" touchable="false"/>
     <list id="n23_r9ri" name="listRank" xy="43,483" size="997,1136" overflow="scroll" lineGap="20" defaultItem="ui://iyz778gkr9ri10y" align="center" autoClearItems="true">
       <gearDisplay controller="c1" pages="2"/>
       <relation target="" sidePair="top-top,bottomext-bottom"/>

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/Handler/RoleDataHandler.cs

@@ -20,7 +20,7 @@ namespace GFGGame
 
         private static void OnUpdate(object param)
         {
-            if(AntiAddictionController.CheckAntiAddictionWhenPlay())
+            if (AntiAddictionController.CheckAntiAddictionWhenPlay())
             {
                 StopUpdate();
                 return;

+ 54 - 40
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemGalleryView.cs

@@ -97,10 +97,8 @@ namespace GFGGame
 
             _ui.m_comNormal.m_comScroll.target.scrollPane.onPullDownRelease.Add(onPullDownRelease);
             _ui.m_comNormal.m_comScroll.target.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
-            // _ui.m_comNormal.m_comScroll.target.scrollPane.onScrollEnd.Add(onScrollEnd);
             _ui.m_comFavorites.m_comScroll.target.scrollPane.onPullDownRelease.Add(onPullDownRelease);
             _ui.m_comFavorites.m_comScroll.target.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
-            // _ui.m_comFavorites.m_comScroll.target.scrollPane.onScrollEnd.Add(onScrollEnd);
 
             _ui.m_comNormal.m_comScroll.m_listRecommend.itemRenderer = RenderListItem;
             _ui.m_comNormal.m_comScroll.m_listRecommend1.itemRenderer = RenderListItem1;
@@ -116,9 +114,8 @@ namespace GFGGame
             _ui.m_comNormal.m_c1.onChanged.Add(OnNormalTabChange);
             _ui.m_comFavorites.m_c1.onChanged.Add(OnFavoritesTabChange);
 
-
-
         }
+
         protected override void AddEventListener()
         {
             base.AddEventListener();
@@ -126,6 +123,7 @@ namespace GFGGame
             EventAgent.AddEventListener(ConstMessage.GALLERY_DATA_CHANGE, UpdateGalleryList);
             // EventAgent.AddEventListener(ConstMessage.GALLERY_RANK_DATA_CHANGE, UpdateGalleryRankList);
         }
+
         protected override async void OnShown()
         {
             base.OnShown();
@@ -136,6 +134,9 @@ namespace GFGGame
                 _tabIndex = (int)(this.viewData as object[])[0];
                 _subtabIndex = (int)(this.viewData as object[])[1];
                 _ui.m_comNormal.m_comBoBox.selectedIndex = (int)(this.viewData as object[])[2];
+
+                UpdateList();
+                UpdateGalleryList();
                 if (_tabIndex == TabType.RECOVER)
                 {
                     _ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
@@ -144,8 +145,6 @@ namespace GFGGame
                 {
                     _ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
                 }
-
-                UpdateGalleryList();
             }
             else
             {
@@ -170,7 +169,8 @@ namespace GFGGame
 
                 // OnFavoritesTabChange();
                 // OnNormalTabChange();
-                _ui.m_comNormal.m_comOpenLoad.target.visible = true;
+                // _ui.m_comNormal.m_comOpenLoad.target.visible = true;
+                ViewManager.Show<ModalStatusView>();
                 UpdateList();
                 PullDown();
                 onPullDownRelease();
@@ -233,8 +233,11 @@ namespace GFGGame
         /// </summary>
         private void OnBtnRecoverClick()
         {
+            int lastTabIndex = _tabIndex;
 
-            if (_tabIndex == TabType.RECOVER)//当前在推荐页要刷新
+            _tabIndex = _ui.m_c1.selectedIndex;
+            _subtabIndex = _ui.m_comNormal.m_c1.selectedIndex;
+            if (lastTabIndex == TabType.RECOVER)//当前在推荐页要刷新
             {
                 if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//重新拉取数据
                 {
@@ -252,10 +255,6 @@ namespace GFGGame
                 UpdateList();
                 UpdateGalleryList();
             }
-            _tabIndex = _ui.m_c1.selectedIndex;
-            _subtabIndex = _ui.m_comNormal.m_c1.selectedIndex;
-            _comScroll = _ui.m_comNormal.m_comScroll.target;
-
         }
 
         /// <summary>
@@ -276,7 +275,6 @@ namespace GFGGame
 
             ResetPullRelease();
             _tabIndex = _ui.m_c1.selectedIndex;
-            _comScroll = _ui.m_comFavorites.m_comScroll.target;
             _ui.m_comFavorites.m_c1.selectedIndex = FavoritesType.FAVORITE;
             _subtabIndex = _ui.m_comFavorites.m_c1.selectedIndex;
             OnFavoritesTabChange();
@@ -309,28 +307,52 @@ namespace GFGGame
         }
         private void UpdateList()
         {
-
-            if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//首页
+            if (_tabIndex == TabType.RECOVER)
             {
-                _ui.m_comNormal.m_comScroll.target.scrollPane.header.visible = true;
-                if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
+                if (_subtabIndex == RecommendType.RECOMMEND)//首页
                 {
-                    _sortType = (int)GallerySortType.Recommend;
-                    _galleryDatas = PoemGalleryDataManager.Instance.RecommendDatas;
+                    _ui.m_comNormal.m_comScroll.target.scrollPane.header.visible = true;
+                    if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
+                    {
+                        _sortType = (int)GallerySortType.Recommend;
+                        _galleryDatas = PoemGalleryDataManager.Instance.RecommendDatas;
+                    }
+                    else//最新
+                    {
+                        _sortType = (int)GallerySortType.Newest;
+                        _galleryDatas = PoemGalleryDataManager.Instance.NewestDatas;
+                    }
+                }
+                else if (_subtabIndex == RecommendType.FRIEND)//好友
+                {
+                    _sortType = (int)GallerySortType.Friend;
+                    _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
                 }
-                else//最新
+                else if (_subtabIndex == RecommendType.RANK)
                 {
-                    _sortType = (int)GallerySortType.Newest;
-                    _galleryDatas = PoemGalleryDataManager.Instance.NewestDatas;
+                    _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
                 }
+                _list = _ui.m_comNormal.m_comScroll.m_listRecommend;
+                _list1 = _ui.m_comNormal.m_comScroll.m_listRecommend1;
+                _comScroll = _ui.m_comNormal.m_comScroll.target;
             }
-            else if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.FRIEND)//好友
+            else if (_tabIndex == TabType.FAVORITES)
             {
-                _sortType = (int)GallerySortType.Friend;
-                _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
+                if (_subtabIndex == FavoritesType.FAVORITE)//我的收藏
+                {
+                    _sortType = (int)GallerySortType.MyCollect;
+                    _galleryDatas = PoemGalleryDataManager.Instance.FavoriteDatas;
+                }
+                else if (_subtabIndex == FavoritesType.MY_SELF)//我的作品
+                {
+                    _sortType = (int)GallerySortType.MyWorks;
+                    _galleryDatas = PoemGalleryDataManager.Instance.MySelfDatas;
+                }
+                _list = _ui.m_comFavorites.m_comScroll.m_listRecommend;
+                _list1 = _ui.m_comFavorites.m_comScroll.m_listRecommend1;
+                _comScroll = _ui.m_comFavorites.m_comScroll.target;
             }
-            _list = _ui.m_comNormal.m_comScroll.m_listRecommend;
-            _list1 = _ui.m_comNormal.m_comScroll.m_listRecommend1;
+
         }
         /// <summary>
         /// 切换收藏页签
@@ -339,18 +361,7 @@ namespace GFGGame
         {
             _ui.m_comFavorites.m_comScroll.target.scrollPane.header.visible = false;
             _subtabIndex = _ui.m_comFavorites.m_c1.selectedIndex;
-            if (_ui.m_comFavorites.m_c1.selectedIndex == FavoritesType.FAVORITE)//我的收藏
-            {
-                _sortType = (int)GallerySortType.MyCollect;
-                _galleryDatas = PoemGalleryDataManager.Instance.FavoriteDatas;
-            }
-            else if (_ui.m_comFavorites.m_c1.selectedIndex == FavoritesType.MY_SELF)//我的作品
-            {
-                _sortType = (int)GallerySortType.MyWorks;
-                _galleryDatas = PoemGalleryDataManager.Instance.MySelfDatas;
-            }
-            _list = _ui.m_comFavorites.m_comScroll.m_listRecommend;
-            _list1 = _ui.m_comFavorites.m_comScroll.m_listRecommend1;
+            UpdateList();
             if (_list.numItems > 0) _list.ScrollToView(0);
             if (_list1.numItems > 0) _list.ScrollToView(0);
             ReqGalleryList(0);
@@ -642,6 +653,7 @@ namespace GFGGame
         }
         private void OnPullDownTimeComplete()
         {
+            if (_comScroll == null) return;
             GComponent header = _comScroll.scrollPane.header;
             Transition transition = header.GetTransition("t0");
             transition.Stop();
@@ -681,6 +693,7 @@ namespace GFGGame
 
         private void OnPullUpTimeComplete()
         {
+            if (_comScroll == null) return;
             GComponent footer = _comScroll.scrollPane.footer;
             Transition transition = footer.GetTransition("t0");
             transition.Stop();
@@ -696,7 +709,8 @@ namespace GFGGame
             OnPullDownTimeComplete();
             // Timers.inst.Remove(OnPullUpTimeComplete);
             OnPullUpTimeComplete();
-            _ui.m_comNormal.m_comOpenLoad.target.visible = false;
+            // _ui.m_comNormal.m_comOpenLoad.target.visible = false;
+            ViewManager.Hide<ModalStatusView>();
         }
     }
 }

BIN
GameClient/Assets/ResIn/UI/Poem/Poem_fui.bytes