local UIAnniversaryLuckyDrawJackpotListPanel = UIViewClass() local ItemIconPath = ConstAssetPathConfig.ItemIconPath function UIAnniversaryLuckyDrawJackpotListPanel:OnOpened(context) local flag = context.openType == CTL.AnniversaryLuckyDraw.LuckyFishUIOpenType.Default UIUtils.SetActive(self.group_tabs, flag) UIUtils.SetActive(self.ani_Before, flag) UIUtils.SetActive(self.ani_Next, flag) if context.openType == CTL.AnniversaryLuckyDraw.LuckyFishUIOpenType.Default then self.allLuckyFishLuckyPlayersInfo = MDL.AnniversaryLuckyDraw.GetAllLuckyFishLuckyPlayersInfo() self.isNoLuckyFishPlayer = #self.allLuckyFishLuckyPlayersInfo == 0 self.toggles:SelectIndex(0) elseif context.openType == CTL.AnniversaryLuckyDraw.LuckyFishUIOpenType.Draw then self:RefreshMyLuckyFishReward(context.data) elseif context.openType == CTL.AnniversaryLuckyDraw.LuckyFishUIOpenType.NotDraw then self:RefreshAllLuckyFishReward(context.data) end end function UIAnniversaryLuckyDrawJackpotListPanel:OnValueChanged(comp, value) if comp == self.toggles then if value == 0 then self.curShowIndex = 1 self:RefreshLuckyFishReward() else UIUtils.SetActive(self.ani_Before, false) UIUtils.SetActive(self.ani_Next, false) self:RefreshMyLuckyFishReward() end end end function UIAnniversaryLuckyDrawJackpotListPanel:RefreshLuckyFishReward() self.state_Draw:SetState(0) self:RefreshArrow() if self.isNoLuckyFishPlayer then self:RefreshNoLuckyFishReward() else self:RefreshAllLuckyFishReward() end end function UIAnniversaryLuckyDrawJackpotListPanel:RefreshArrow() if self.isNoLuckyFishPlayer or #self.allLuckyFishLuckyPlayersInfo <= 1 then UIUtils.SetActive(self.ani_Before, false) UIUtils.SetActive(self.ani_Next, false) elseif self.curShowIndex == #self.allLuckyFishLuckyPlayersInfo then UIUtils.SetActive(self.ani_Before, false) UIUtils.SetActive(self.ani_Next, true) elseif self.curShowIndex == 1 then UIUtils.SetActive(self.ani_Before, true) UIUtils.SetActive(self.ani_Next, false) else UIUtils.SetActive(self.ani_Before, true) UIUtils.SetActive(self.ani_Next, true) end end function UIAnniversaryLuckyDrawJackpotListPanel:OnBackButtonPressed() self:OnButtonClicked(self.btn_Close) end function UIAnniversaryLuckyDrawJackpotListPanel:OnButtonClicked(comp) if comp == self.btn_Close then self:CloseView() elseif comp == self.img_Copy then UIUtils.GetSystemCopyText(self.txt_code1.text) CTL.Tips.AddTipsMsg(Const_IDS.IDS_VIPInvitation_CopyHint) elseif comp == self.btn_Before then self.curShowIndex = self.curShowIndex + 1 self:RefreshAllLuckyFishReward() self:RefreshArrow() elseif comp == self.btn_Next then self.curShowIndex = self.curShowIndex -1 self:RefreshAllLuckyFishReward() self:RefreshArrow() elseif comp == self.luckyFishIcon_click then local luckyDrawData = DataSheetManager.LuckyDraw:GetDataByModeTypeID(1) UTL.ItemTips.ShowCommonTipsById(luckyDrawData.LuckyReward) end end function UIAnniversaryLuckyDrawJackpotListPanel:RefreshNoLuckyFishReward() self.state_Draw:SetState(2) UIUtils.SetLabelText(self.txt_Empty, Const_IDS.IDS_AnniversaryLuckyDraw_Hint_20) end function UIAnniversaryLuckyDrawJackpotListPanel:RefreshAllLuckyFishReward(data) self.state_Draw:SetState(0) local data = data or self.allLuckyFishLuckyPlayersInfo[self.curShowIndex] UIUtils.SetLabel(self.txt_PlayerName1, data.name) UIUtils.SetLabel(self.txt_Sever1, " "..data.serverName) local month, day if data.drawTime then month, day = UTL.Time.FormatTimeSimple(data.drawTime) else month, day = UTL.Time.FormatTimeSimple(UTL.Time.GetServerTimestamp()) end UIUtils.SetLabel(self.txt_Time1, string.FormatByIdsKey("IDS_Time_MonthDay", month, day)) UIUtils.SetActive(self.txt_PlayerTitle, true) end function UIAnniversaryLuckyDrawJackpotListPanel:RefreshMyLuckyFishReward(data) local data = data or MDL.AnniversaryLuckyDraw.GetMyLuckyFishRewardInfo() if data then local luckyDrawData = DataSheetManager.LuckyDraw:GetDataByModeTypeID(1) local itemData = DataSheetManager.ItemData:GetDataByID(luckyDrawData.LuckyReward) local itemIcon = string.format(ItemIconPath, itemData.Icon) if luckyDrawData.LuckyRewardNum > 1 then UIUtils.SetLabel(self.luckyFishNum, luckyDrawData.LuckyRewardNum) else UIUtils.SetLabel(self.luckyFishNum, "") end UIUtils.SetImageByAssetBundle(self.luckyFishIcon, itemIcon) UIUtils.SetLabelText(self.txt_JackpotName1, Const_IDS[itemData.Name]) UIUtils.SetLabelText(self.txt_Title2, Const_IDS.IDS_AnniversaryLuckyDraw_Hint_14) self.state_Draw:SetState(1) if string.isNilOrEmpty(data.code) then UIUtils.SetActive(self.group_NumCopy, false) else UIUtils.SetActive(self.group_NumCopy, true) UIUtils.SetLabelText(self.lab_DiscussionGroup, Const_IDS.IDS_AnniversaryLuckyDraw_Hint_11) UIUtils.SetLabel(self.txt_code1, data.code) end else self.state_Draw:SetState(2) UIUtils.SetLabelText(self.txt_Empty, Const_IDS.IDS_AnniversaryLuckyDraw_Hint_16) end end return UIAnniversaryLuckyDrawJackpotListPanel