Browse Source

章节列表点击区域监听

zhaoyang 3 years ago
parent
commit
3d0abdc1d4

+ 1 - 1
FGUIProject/assets/Main/StoryChapterListUI.xml

@@ -5,7 +5,7 @@
       <relation target="" sidePair="center-center,middle-middle"/>
     </image>
     <list id="n11_slb4" name="listChapter" xy="55,-102" size="1025,1693" layout="row" overflow="scroll" scroll="horizontal" lineGap="80" colGap="38" defaultItem="ui://mfvz4q8kslb41r" autoClearItems="true">
-      <relation target="" sidePair="bottomext-bottom"/>
+      <relation target="" sidePair="top-top"/>
       <item/>
       <item/>
       <item/>

+ 1 - 1
FGUIProject/assets/Main/components/ComponentChapterPic.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="290,1591">
+<component size="290,1591" opaque="false">
   <displayList>
     <loader id="n0_slb4" name="pic" xy="0,586" size="290,1006" url="ui://mfvz4q8kjvi38d" autoSize="true"/>
     <image id="n3_s17n" name="n3" src="tu967b" fileName="imagesStory/zhuxian_diban_1.png" xy="0,0"/>

+ 1 - 1
FGUIProject/assets/Main/components/ComponentListChapterItem.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="290,1591">
+<component size="290,1591" opaque="false">
   <displayList>
     <component id="n0_slb4" name="compPic" src="tu966u" fileName="components/ComponentChapterPic.xml" xy="0,0"/>
     <image id="n7_tu96" name="n7" src="tu967c" fileName="imagesStory/zhuxian_diban_2.png" xy="0,805"/>

+ 1 - 1
FGUIProject/assets/Main/components/ListChapterItem.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<component size="290,1693">
+<component size="290,1693" opaque="false">
   <displayList>
     <component id="n0_slb4" name="content" src="slb41t" fileName="components/ComponentListChapterItem.xml" xy="0,102"/>
   </displayList>

+ 7 - 2
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryChapterListView.cs

@@ -32,7 +32,7 @@ namespace GFGGame
 
             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
             _ui.m_btnHome.onClick.Add(OnClickBtnHome);
-            _ui.m_listChapter.onClickItem.Add(OnClickListChapterItem);
+            // _ui.m_listChapter.onClickItem.Add(OnClickListChapterItem);
             _ui.m_listTab.onClickItem.Add(OnClickListTabItem);
             _ui.m_listType.onClickItem.Add(OnClickListTypeItem);
 
@@ -77,7 +77,7 @@ namespace GFGGame
         private void OnClickListChapterItem(EventContext context)
         {
             // GuideController.TryCompleteGuide(ConstGuideId.MAIN_UI_BTN_STORY);
-            GObject chapterItem = context.data as GObject;
+            GObject chapterItem = context.sender as GObject;
             int chapterID = (int)chapterItem.data;
             StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterID);
             if (MainStoryDataManager.CheckChapterUnlock(chapterID))
@@ -106,7 +106,12 @@ namespace GFGGame
             listItem.m_content.m_txtLv.text = StoryUtil.GetChapterOrder(chapterCfg.id).ToString();
             listItem.m_content.m_txtTitle.text = chapterCfg.name;
             listItem.m_content.m_compPic.m_pic.url = "ui://Main/" + chapterCfg.res;
+            if (listItem.m_content.target.data == null)
+            {
+                listItem.m_content.target.onClick.Add(OnClickListChapterItem);
+            }
             listItem.target.data = chapterCfg.id;
+            listItem.m_content.target.data = chapterCfg.id;
         }
 
         private void UpdateList()

BIN
GameClient/Assets/ResIn/UI/Main/Main_fui.bytes