local UIHorseSoulGachaRule = UIViewClass() local EternalTabs = { [1] = "IDS_HorseSoul_DrawRuleHint2", [2] = "IDS_HorseSoul_DrawRuleHint3", } function UIHorseSoulGachaRule:OnOpened(context) UIUtils.SetLabelText(self.UICommonPopUpTab.txt_Title, Const_IDS.IDS_HorseSoul_DrawRuleHint1) for _, v in ipairs(EternalTabs) do self.UICommonPopUpTab.loop_Tab:AddData(v, 0) end self.UICommonPopUpTab.loop_Tab:SelectIndex(0) for k,v in DataSheetManager.HorseSoulDrawData:GetEnumerator() do self.group_Probability:AddData(v, 0) end local data = DataSheetManager.GuidanceNotes:GetDataByID(LuaConst.NoteID.HorseSoulGacha) if data then UIUtils.SetLabelText(self.txt_Rule, Const_IDS[data.GuideNotesContent]) end end function UIHorseSoulGachaRule:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUpTab.btn_Close) end function UIHorseSoulGachaRule:OnButtonClicked(comp) if comp == self.UICommonPopUpTab.btn_Close then self:CloseView() end end function UIHorseSoulGachaRule:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then UIUtils.SetActive(cellTable.img_RedDot, false) UIUtils.SetActive(cellTable.img_Arrow, false) UIUtils.SetActive(cellTable.img_ArrowS, false) UIUtils.SetLabelText(cellTable.txt_Name_Nomal, Const_IDS[data]) UIUtils.SetLabelText(cellTable.txt_Name_Selected, Const_IDS[data]) elseif scrollRect == self.group_Probability then UIUtils.SetImageByAssetBundle(cellTable.img_bg, data.DrawChanceTitlePic) UIUtils.SetLabelText(cellTable.txt_Title, Const_IDS[data.DrawChanceTitle]) UIUtils.SetLabelText(cellTable.txt_Detail, Const_IDS[data.DrawChanceDes]) end end function UIHorseSoulGachaRule:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.UICommonPopUpTab.loop_Tab then if self.subViewIndex == index then return end self.subViewIndex = index if index == 0 then UIUtils.SetActive(self.group_Rule, true) UIUtils.SetActive(self.group_Probability, false) elseif index == 1 then UIUtils.SetActive(self.group_Rule, false) UIUtils.SetActive(self.group_Probability, true) end end end return UIHorseSoulGachaRule