zhaoyang 2 年之前
父節點
當前提交
1119dd1fd9

+ 2 - 2
FGUIProject/assets/poem/PoemGalleryPreviewUI.xml

@@ -16,9 +16,9 @@
     <image id="n10_r9ri" name="n10" src="r9ri126" fileName="imagesGallery/hl_hyxxk.png" xy="165,35" group="n12_r9ri"/>
     <component id="n9_r9ri" name="comHead" src="r9ri12m" fileName="componentsGallery/ComRoleHead.xml" xy="200,62" group="n12_r9ri"/>
     <text id="n4_r9ri" name="txtName" xy="361,103" size="71,46" group="n12_r9ri" fontSize="34" color="#9d7f5c" text="老六"/>
-    <component id="n7_r9ri" name="btnAddFriend" src="r9ri10v" fileName="componentsGallery/Button9.xml" xy="787,95" size="198,59" group="n12_r9ri">
+    <component id="n7_r9ri" name="btnAddFriend" src="r9ri12j" fileName="componentsGallery/Button10.xml" xy="787,95" size="198,59" group="n12_r9ri">
       <gearDisplay controller="c1" pages="0,1,3"/>
-      <Button icon="ui://iyz778gkr9ri129"/>
+      <Button icon="ui://iyz778gkr9ri129" selectedIcon="ui://iyz778gkr9ri12u"/>
     </component>
     <component id="n8_r9ri" name="btnDelete" src="r9ri10v" fileName="componentsGallery/Button9.xml" xy="787,95" size="198,59" group="n12_r9ri">
       <gearDisplay controller="c1" pages="5"/>

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

@@ -3,7 +3,7 @@
   <controller name="button" pages="0,up,1,down,2,over,3,selectedOver" selected="0"/>
   <displayList>
     <loader id="n4_r9ri" name="icon" xy="0,0" size="32,30" url="ui://iyz778gkr9ri124" autoSize="true"/>
-    <text id="n3_r9ri" name="title" xy="34,-2" size="78,34" fontSize="24" color="#ac9370" align="center" vAlign="middle" singleLine="true" text="50000">
+    <text id="n3_r9ri" name="title" xy="34,-2" size="10,34" fontSize="24" color="#ac9370" align="center" vAlign="middle" singleLine="true" text="">
       <relation target="" sidePair="width-width,height-height"/>
     </text>
   </displayList>

二進制
FGUIProject/assets/poem/imagesGallery/hl_sqanniu_3.png


+ 1 - 0
FGUIProject/assets/poem/package.xml

@@ -115,6 +115,7 @@
     <image id="r9ri12r" name="hl_txkuang1.png" path="/imagesGallery/"/>
     <image id="r9ri12s" name="hl_jzhjz_1.png" path="/imagesGallery/"/>
     <image id="r9ri12t" name="hl_jzhjz.png" path="/imagesGallery/"/>
+    <image id="r9ri12u" name="hl_sqanniu_3.png" path="/imagesGallery/"/>
   </resources>
   <publish name="" path="..\GameClient\Assets\ResIn\UI\Poem" packageCount="2" genCode="true"/>
 </packageDescription>

+ 9 - 0
GameClient/Assets/Game/HotUpdate/Data/FriendDataManager.cs

@@ -178,5 +178,14 @@ namespace GFGGame
             return 3;
         }
 
+        public FriendInfoData GetFriendDataById(long roleId)
+        {
+            if (_friendDic.ContainsKey(roleId))
+            {
+                return _friendDic[roleId];
+            }
+            return null;
+        }
+
     }
 }

+ 22 - 5
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemGalleryPreviewView.cs

@@ -61,12 +61,13 @@ namespace GFGGame
             _ui.m_btnCollect.title = _galleryData.CollectCount.ToString();
             _ui.m_btnVote.selected = _galleryData.VoteOrNot;
             _ui.m_btnVote.title = _galleryData.VoteCount.ToString();
+            _ui.m_btnAddFriend.visible = FriendDataManager.Instance.GetFriendDataById(_galleryData.AuthorId) == null;
         }
 
         protected override void OnHide()
         {
             base.OnHide();
-
+            _ui.m_btnAddFriend.selected = false;
         }
 
         protected override void RemoveEventListener()
@@ -114,17 +115,33 @@ namespace GFGGame
                 _galleryData.VoteOrNot = true;
                 _galleryData.CollectCount = _galleryData.CollectCount + 1;
                 UpdateView();
+                int Count = GameGlobal.myNumericComponent.GetAsInt(NumericType.LikeGalleryWorksCountDaily);
+                GalleryIntegralCfg integralCfg = GalleryIntegralCfgArray.Instance.GetCfg(Count);
+                if (integralCfg != null)
+                {
+                    ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(integralCfg.itemId);
+                    PromptController.Instance.ShowFloatTextPrompt(string.Format("{0} +{1}", itemCfg.name, integralCfg.Count));
+                }
             }
         }
 
-        private void OnBtnAddFriendClick(EventContext context)
+        private async void OnBtnAddFriendClick(EventContext context)
         {
-
+            if (_ui.m_btnAddFriend.selected == true) return;
+            bool result = await FriendSProxy.ReqApplyForFriend(_galleryData.AuthorId);
+            if (result)
+            {
+                _ui.m_btnAddFriend.selected = true;
+            }
         }
 
-        private void OnBtnDeleteClick(EventContext context)
+        private async void OnBtnDeleteClick(EventContext context)
         {
-
+            bool result = await PoemGallerySProxy.ReqDeleteMyWorks(_galleryData.WorkId);
+            if (result)
+            {
+                this.Hide();
+            }
         }
     }
 }

+ 116 - 74
GameClient/Assets/Game/HotUpdate/Views/Poem/PoemGalleryView.cs

@@ -6,6 +6,34 @@ using UnityEngine;
 
 namespace GFGGame
 {
+    class RecommendType
+    {
+        /// <summary>
+        /// 推荐
+        /// </summary>
+        public static int RECOMMEND = 0;
+        /// <summary>
+        /// 好友
+        /// </summary>
+        public static int FRIEND = 1;
+        /// <summary>
+        /// 排行榜
+        /// </summary>
+        public static int RANK = 2;
+    }
+    class FavoritesType
+    {
+        /// <summary>
+        /// 我的收藏
+        /// </summary>
+        public static int FAVORITE = 0;
+        /// <summary>
+        /// 我的作品
+        /// </summary>
+        public static int MY_SELF = 1;
+    }
+
+
     public class PoemGalleryView : BaseWindow
     {
         private UI_PoemGalleryUI _ui;
@@ -83,27 +111,44 @@ namespace GFGGame
         {
             base.OnShown();
 
-            _tabIndex = 0;
-            _subtabIndex = 0;
+
             if (this.viewData != null)
             {
                 _tabIndex = (int)(this.viewData as object[])[0];
                 _subtabIndex = (int)(this.viewData as object[])[1];
-            }
-            _ui.m_c1.selectedIndex = _tabIndex;
-
-            if (_tabIndex == 0)
-            {
+                _ui.m_comNormal.m_comBoBox.selectedIndex = (int)(this.viewData as object[])[2];
                 _ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
-                OnNormalTabChange();
+                _ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
+                _list.RefreshVirtualList();
             }
-            else if (_tabIndex == 2)
+            else
             {
+                _tabIndex = 0;
+                _subtabIndex = 0;
+                _ui.m_comNormal.m_comBoBox.selectedIndex = 0;
+                _ui.m_comNormal.m_c1.selectedIndex = _subtabIndex;
                 _ui.m_comFavorites.m_c1.selectedIndex = _subtabIndex;
-                OnFavoritesTabChange();
+                if (_ui.m_comNormal.m_listRecommend.numItems > 0) _ui.m_comNormal.m_listRecommend.ScrollToView(0);
+                if (_ui.m_comNormal.m_listFriend.numItems > 0) _ui.m_comNormal.m_listFriend.ScrollToView(0);
+                if (_ui.m_comNormal.m_listRank.numItems > 0) _ui.m_comNormal.m_listRank.ScrollToView(0);
+                if (_ui.m_comFavorites.m_listFavorite.numItems > 0) _ui.m_comFavorites.m_listFavorite.ScrollToView(0);
+                if (_ui.m_comFavorites.m_listMySelf.numItems > 0) _ui.m_comFavorites.m_listMySelf.ScrollToView(0);
+                OnNormalTabChange();
             }
+
+            _ui.m_c1.selectedIndex = _tabIndex;
+
+            _ui.m_comNormal.m_listRecommend.numItems = 15;
+            _ui.m_comNormal.m_listFriend.numItems = 15;
+            _ui.m_comNormal.m_listRank.numItems = 15;
+            _ui.m_comFavorites.m_listFavorite.numItems = 15;
+            _ui.m_comFavorites.m_listMySelf.numItems = 15;
+
             _list = _ui.m_comNormal.m_listRecommend;
             _list.numItems = 10;
+
+
+            // _list.RefreshVirtualList();
             UpdateView();
         }
 
@@ -133,16 +178,18 @@ namespace GFGGame
         /// </summary>
         private void OnBtnRecoverClick()
         {
-            _tabIndex = _ui.m_c1.selectedIndex;
-            if (_ui.m_comNormal.m_c1.selectedIndex == 0)
+
+            if (_tabIndex == 0 && _ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//当前在推荐页要刷新
             {
+                PullDown();
                 onPullDownRelease();
-                // OnNormalTabChange();//每次点首页都要刷新
             }
-            else
+            else//当前不在推荐页只把页签切回到推荐页,不刷新
             {
-                _ui.m_comNormal.m_c1.selectedIndex = 0;
+                _ui.m_comNormal.m_c1.selectedIndex = RecommendType.RECOMMEND;
             }
+            _tabIndex = _ui.m_c1.selectedIndex;
+
         }
 
         /// <summary>
@@ -152,7 +199,7 @@ namespace GFGGame
         {
             // int tabIndex = _ui.m_c1.selectedIndex;
             // int subType = _ui.m_c1.selectedIndex
-            object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex };
+            object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
             ViewManager.Show<DressUpView>(1, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas }, true);
         }
 
@@ -162,42 +209,13 @@ namespace GFGGame
         private void OnBtnFavoritesClick()
         {
             _tabIndex = _ui.m_c1.selectedIndex;
-            if (_ui.m_comFavorites.m_c1.selectedIndex != 0)
+            if (_ui.m_comFavorites.m_c1.selectedIndex != FavoritesType.FAVORITE)
             {
-                _ui.m_comFavorites.m_c1.selectedIndex = 0;
+                _ui.m_comFavorites.m_c1.selectedIndex = FavoritesType.FAVORITE;
             }
             ResetPullDownRelease();
         }
 
-        // /// <summary>
-        // /// 切换ui页签:首页,投稿,收藏
-        // /// </summary>
-        // private void OnTabChange()
-        // {
-        //     if (_ui.m_c1.selectedIndex == 0)//刷新首页
-        //     {
-        //         if (_ui.m_comNormal.m_c1.selectedIndex == 0)
-        //         {
-        //             OnNormalTabChange();
-        //         }
-        //         else
-        //         {
-        //             _ui.m_comNormal.m_c1.selectedIndex = 0;
-        //         }
-        //     }
-        //     else if (_ui.m_c1.selectedIndex == 2)//刷新收藏页
-        //     {
-        //         if (_ui.m_comFavorites.m_c1.selectedIndex == 0)
-        //         {
-        //             OnFavoritesTabChange();
-        //         }
-        //         else
-        //         {
-        //             _ui.m_comFavorites.m_c1.selectedIndex = 0;
-        //         }
-        //     }
-        // }
-
         /// <summary>
         /// 切换首页页签
         /// </summary>
@@ -206,13 +224,13 @@ namespace GFGGame
             ResetPullDownRelease();
 
             _subtabIndex = _ui.m_comNormal.m_c1.selectedIndex;
-            if (_ui.m_comNormal.m_c1.selectedIndex == 2)//排行榜
+            if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)//排行榜
             {
 
             }
             else
             {
-                if (_ui.m_comNormal.m_c1.selectedIndex == 0)//首页
+                if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RECOMMEND)//首页
                 {
                     // _infoType = GalleryType.Recommend;
                     if (_ui.m_comNormal.m_comBoBox.selectedIndex == 0)//推荐
@@ -227,7 +245,7 @@ namespace GFGGame
                     }
                     _list = _ui.m_comNormal.m_listRecommend;
                 }
-                else if (_ui.m_comNormal.m_c1.selectedIndex == 1)//好友
+                else if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.FRIEND)//好友
                 {
                     _sortType = (int)GallerySortType.Friend;
                     _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
@@ -246,13 +264,13 @@ namespace GFGGame
         private void OnFavoritesTabChange()
         {
             _subtabIndex = _ui.m_comFavorites.m_c1.selectedIndex;
-            if (_ui.m_comFavorites.m_c1.selectedIndex == 0)//我的收藏
+            if (_ui.m_comFavorites.m_c1.selectedIndex == FavoritesType.FAVORITE)//我的收藏
             {
                 _sortType = (int)GallerySortType.MyCollect;
                 _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
                 _list = _ui.m_comFavorites.m_listFavorite;
             }
-            else if (_ui.m_comFavorites.m_c1.selectedIndex == 1)//我的作品
+            else if (_ui.m_comFavorites.m_c1.selectedIndex == FavoritesType.MY_SELF)//我的作品
             {
                 _sortType = (int)GallerySortType.MyWorks;
                 _galleryDatas = PoemGalleryDataManager.Instance.FrinedDatas;
@@ -298,7 +316,7 @@ namespace GFGGame
         /// </summary>
         private void OnBtnShopClick()
         {
-            object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex };
+            object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
             ViewManager.Show<ClothingShopView>(new object[] { ConstStoreId.GALLERY_STORE_ID }, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas }, true);
         }
 
@@ -316,22 +334,6 @@ namespace GFGGame
             _ui.m_comNormal.m_txtTheme.text = string.Format("本期主题:{0}", themeCfg.theme);
             _ui.m_comNormal.m_txtRank.text = string.Format("我的排名:{0}", PoemGalleryDataManager.Instance.MyRank);
             _ui.m_comNormal.m_txtRewardCount.text = string.Format("奖励次数:{0}/{1}", PoemGalleryDataManager.Instance.VoteCount, GalleryRewardCfgArray.Instance.dataArray.Length);
-            // long monday = TimeUtil.GetCurWeekMondayTime(GlobalCfgArray.globalCfg.refreshTime);//本周一5点
-            // long startTime = 0;
-            // long endTime = 0;
-            // if ((TimeInfo.Instance.ServerNow() / 1000) < monday)//本周一5点之前显示上周
-            // {
-            //     startTime = TimeUtil.GetLastWeekMondayTime(GlobalCfgArray.globalCfg.refreshTime);
-            //     endTime = TimeUtil.GetLastWeekSundayTime("23:59:59");
-            // }
-            // else
-            // {
-            //     startTime = monday * 1000;
-            //     endTime = TimeUtil.GetCurWeekSundayTime("23:59:59") * 1000; ;
-            // }
-            // string strStartTime = TimeUtil.FormattingTime3(startTime);
-            // string strEndTime = TimeUtil.FormattingTime3(endTime); ;
-
             _ui.m_comNormal.m_txtTime.text = PoemGalleryDataManager.Instance.GetThemeTime();
         }
         private void RenderListItem(int index, GObject obj)
@@ -381,15 +383,50 @@ namespace GFGGame
         {
             GObject obj = context.data as GObject;
             PoemGalleryData data = obj.data as PoemGalleryData;
-            object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex };
+            object[] gobackParamDatas = new object[] { _tabIndex, _subtabIndex, _ui.m_comNormal.m_comBoBox.selectedIndex };
             ViewManager.Show<PoemGalleryPreviewView>(new object[] { _sortType, data }, new object[] { typeof(PoemGalleryView).FullName, gobackParamDatas });
         }
 
-        private void OnBtnCollectClick(EventContext context)
+        private async void OnBtnCollectClick(EventContext context)
         {
             GObject obj = context.data as GObject;
-            PoemGalleryData data = obj.data as PoemGalleryData;
-
+            PoemGalleryData galleryData = obj.data as PoemGalleryData;
+            if (galleryData.CollectOrNot)
+            {
+                bool result = await PoemGallerySProxy.ReqCancelCollecteGalleryWorks(galleryData.WorkId);
+                if (result)
+                {
+                    galleryData.CollectOrNot = false;
+                    galleryData.CollectCount = galleryData.CollectCount - 1;
+                    UpdateView();
+                    if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)
+                    {
+                        _ui.m_comNormal.m_listRank.RefreshVirtualList();
+                    }
+                    else
+                    {
+                        _list.RefreshVirtualList();
+                    }
+                }
+            }
+            else
+            {
+                bool result = await PoemGallerySProxy.ReqCollecteGalleryWorks(galleryData.WorkId);
+                if (result)
+                {
+                    galleryData.CollectOrNot = true;
+                    galleryData.CollectCount = galleryData.CollectCount + 1;
+                    UpdateView();
+                    if (_ui.m_comNormal.m_c1.selectedIndex == RecommendType.RANK)
+                    {
+                        _ui.m_comNormal.m_listRank.RefreshVirtualList();
+                    }
+                    else
+                    {
+                        _list.RefreshVirtualList();
+                    }
+                }
+            }
         }
 
         private void OnBtnVoteClick(EventContext context)
@@ -399,7 +436,12 @@ namespace GFGGame
 
         }
 
-
+        private void PullDown()
+        {
+            if (_ui.m_comNormal.m_listRecommend.numItems > 0) _ui.m_comNormal.m_listRecommend.ScrollToView(0);
+            GComponent header = _ui.m_comNormal.m_listRecommend.scrollPane.header;
+            header.height = header.sourceHeight;
+        }
 
         //下拉刷新
         private void onPullDownRelease()

二進制
GameClient/Assets/ResIn/UI/Poem/Poem_atlas0.png


二進制
GameClient/Assets/ResIn/UI/Poem/Poem_fui.bytes