--3V3每日首胜 local UISyncTeamPVPDailyReward = UIViewClass() function UISyncTeamPVPDailyReward:OnOpened(context) self:RegistSystemEvent(EventID.UI_SyncTeamPVP_RefreshDailyRewardUI,self.ShowGetRewardInfo) UIUtils.SetLabelText(self.UICommonPopUp.txt_Title,Const_IDS.IDS_1v1RewardPlus_DailyWin) self:InitData() end function UISyncTeamPVPDailyReward:OnButtonClicked(comp) if comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif comp == self.btn_Get then --领取奖励 self:OnClickGetReward() else for i, v in ipairs(self.group_Item) do if comp == v.event_Click then UTL.ItemTips.ShowCommonTipsById(self.FixedReward[i].ItemID) end end end end function UISyncTeamPVPDailyReward:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UISyncTeamPVPDailyReward:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.loop_Item then --随机奖励 UTL.Item.SetItemCell(cellTable.item, data.ItemID, data.ItemNum) end end function UISyncTeamPVPDailyReward:OnCellClicked(scrollRect, index, cellTable, target, data) if scrollRect == self.loop_Item then --随机奖励道具点击 if target == cellTable.item.event_Click then UTL.ItemTips.ShowCommonTipsById(data.ItemID) end end end function UISyncTeamPVPDailyReward:InitData() local rewardResult = CTL.SyncTeamPVP.GetRewardOfEveryDay() if rewardResult then self.FixedReward = rewardResult.FixedReward self:ShowFixedReward(rewardResult.FixedReward) self:ShowRandomReward(rewardResult.RandomNum,rewardResult.RandomReward) self:ShowGetRewardInfo() else logging.error(LTAG.ERROR,"CTL.SyncSolo.GetRewardOfEveryDay 没拿到奖励数据") end end --显示固定奖励 function UISyncTeamPVPDailyReward:ShowFixedReward(reward) for i,v in ipairs(self.group_Item) do local itemGo = self.group_Item[i].gameObject.transform.parent.gameObject if reward[i] then UIUtils.SetActive(itemGo,true) UTL.Item.SetItemCell(self.group_Item[i], reward[i].ItemID, reward[i].ItemNum) else UIUtils.SetActive(itemGo,false) end end end --显示随机奖励 rewardNum 奖励种类 function UISyncTeamPVPDailyReward:ShowRandomReward(rewardNum,reward) --奖励种类提示 UIUtils.SetLabel(self.txt_Tip2,string.FormatByIdsId(Const_IDS.IDS_1v1RewardPlus_RandomReward_Tips,tostring(rewardNum))) --随机奖励 self.loop_Item:ReloadAll(reward) end --显示领取UI的信息 function UISyncTeamPVPDailyReward:ShowGetRewardInfo() local state = MDL.SyncTeamPVP.GetFirstWinOfEveryDayState() if state == MDL.SyncSolo.RewardState.NotReach then --未完成,领取状态复用1v1的 UIUtils.SetActive(self.btn_Get,false) UIUtils.SetActive(self.txt_Tip,true) UIUtils.SetLabelText(self.txt_Tip,Const_IDS.IDS_1v1RewardPlus_NotWin) elseif state == MDL.SyncSolo.RewardState.NotGet then --未领取 UIUtils.SetActive(self.txt_Tip,false) UIUtils.SetActive(self.btn_Get,true) self.btn_Get:SetRedPoint(true) elseif state == MDL.SyncSolo.RewardState.Get then --已领取 UIUtils.SetActive(self.btn_Get,false) UIUtils.SetActive(self.txt_Tip,true) UIUtils.SetLabelText(self.txt_Tip,Const_IDS.IDS_1v1RewardPlus_TodayAlreadyGet) end end --领取奖励 function UISyncTeamPVPDailyReward:OnClickGetReward() MDL.SyncTeamPVP.SyncTeamPVPGetDailyRewardReq() end return UISyncTeamPVPDailyReward