diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua index c9e849f7..ab431a54 100644 --- a/lua/app/ui/main_city/component/main_comp.lua +++ b/lua/app/ui/main_city/component/main_comp.lua @@ -95,16 +95,18 @@ function MainComp:init() self.chapterMaxTx = uiMap["main_comp.middle_bg.max_tx"] self.chapterInfoBtn = uiMap["main_comp.middle_bg.info_btn"] self.chapterBoxBtn = uiMap["main_comp.middle_bg.box_btn"] - self.chapterSelectImg = uiMap["main_comp.middle_bg.select_img"] + self.chapterPageNode = uiMap["main_comp.middle_bg.page_node"] self.chapterPageBtns = {} self.chapterPageBtnCheckImgs = {} self.chapterPageBtnDescTxs = {} self.chapterPageBtnMaskImgs = {} + self.chapterPageBtnSelectImgs = {} for i = 1, CHAPTER_PAGE do - self.chapterPageBtns[i] = uiMap["main_comp.middle_bg.page_btn_" .. i] - self.chapterPageBtnCheckImgs[i] = uiMap["main_comp.middle_bg.page_btn_" .. i .. ".check_img"] - self.chapterPageBtnDescTxs[i] = uiMap["main_comp.middle_bg.page_btn_" .. i .. ".desc_tx"] - self.chapterPageBtnMaskImgs[i] = uiMap["main_comp.middle_bg.page_btn_" .. i .. ".mask_img"] + self.chapterPageBtns[i] = uiMap["main_comp.middle_bg.page_node.page_btn_" .. i] + self.chapterPageBtnCheckImgs[i] = uiMap["main_comp.middle_bg.page_node.page_btn_" .. i .. ".check_img"] + self.chapterPageBtnDescTxs[i] = uiMap["main_comp.middle_bg.page_node.page_btn_" .. i .. ".desc_tx"] + self.chapterPageBtnMaskImgs[i] = uiMap["main_comp.middle_bg.page_node.page_btn_" .. i .. ".mask_img"] + self.chapterPageBtnSelectImgs[i] = uiMap["main_comp.middle_bg.page_node.page_btn_" .. i .. ".select_img"] self.chapterPageBtns[i]:addClickListener(function() self.chapterStage = i local chapterId = DataManager.ChapterData:getChapterCfgByPageAndStage(self.chapterPage, self.chapterStage) @@ -251,9 +253,7 @@ function MainComp:refreshChapterInfo() for i = 1, CHAPTER_PAGE do if i <= #self.chapterList then self.chapterPageBtns[i]:setActive(true) - if self.chapterStage == i then - self.chapterSelectImg:setAnchoredPositionX((i - 3) * 98) - end + self.chapterPageBtnSelectImgs[i]:setActive(i == self.chapterStage) self.chapterPageBtnDescTxs[i]:setText(i) local selChapterId = DataManager.ChapterData:getChapterCfgByPageAndStage(self.chapterPage, i) self.chapterPageBtnCheckImgs[i]:setActive(selChapterId <= chapterMaxId) @@ -262,6 +262,7 @@ function MainComp:refreshChapterInfo() self.chapterPageBtns[i]:setActive(false) end end + self.chapterPageNode:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout() self.fightBtn:setActive(chapterId <= chapterMaxId + 1)