local UISuperGoldLotteryProbability = UIViewClass() function UISuperGoldLotteryProbability:OnOpened(context) self.activityId = context.activityId self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) self:InitData(context) end function UISuperGoldLotteryProbability:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UISuperGoldLotteryProbability:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() end end function UISuperGoldLotteryProbability:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:CloseView() end end end function UISuperGoldLotteryProbability:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.grid_Probability then for i = 1,#cellTable.group_Items do UIUtils.SetActive(cellTable.group_Items[i].gameObject.transform.parent.gameObject,false) end --概率设定 local probabilityStr = string.format("%.2f", data.Probability * 100) .."%" UIUtils.SetLabel(cellTable.txt_Probability,probabilityStr) --奖励显示 if #cellTable.group_Items >= 1 then UIUtils.SetActive(cellTable.group_Items[1].gameObject.transform.parent.gameObject,true) UTL.Item.SetItemCell(cellTable.group_Items[1], data.Item, data.Num) end end end --奖励点击 function UISuperGoldLotteryProbability:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.grid_Probability then if #cellTable.group_Items >= 1 and target == cellTable.group_Items[1].event_Click then UTL.ItemTips.ShowCommonTipsById(data.Item) end end end function UISuperGoldLotteryProbability:InitData(context) --常规UI显示 local allData = MDL.SuperGoldLottery.GetTurnTableInfo(self.activityId) local data = allData[context.index] local storeName = UIUtils.GetLocalizedTxt(Const_IDS[data.StoreName]) UIUtils.SetLabel(self.lab_Title,string.FormatByIdsId(Const_IDS.IDS_SuperGoldHeroActivity_Turntable_PreviewHint_1,storeName)) --概率显示 local rewardList = CTL.SuperGoldLottery.GetProbabilityData(data.TurnTableID) self.grid_Probability:ReloadAll(rewardList) end return UISuperGoldLotteryProbability