local UIHorseRearGetReward = require("View/HorseRear/UIHorseRearGetReward") local UIGodBeastActivityGetReward = UIViewClass(UIHorseRearGetReward) function UIGodBeastActivityGetReward:OnOpened(context) self:RegistSystemEvent(EventID.UI_OperationActivity_CloseView, self.OnCloseActivitySelf) local msg = context.rearEventData self.closeViewCB = context.closeViewCB self.activityId = msg.activityId CTL.Sound.PlayGameSound("UI_congratulation") end function UIGodBeastActivityGetReward:OnCellInit(scrollRect, index, cellTable, data) if scrollRect == self.group_Ten.loop_RandomReward or scrollRect == self.group_More.loop_RandomRewardMore then UTL.Item.SetItemCell(cellTable.item, data.ItemId, data.ItemCount) local eventData = MDL.OperationActivity.GodBeastEvent:GetDataByActivityID_EventID(self.activityId, data.AtyEventId) UIUtils.SetImageByAssetBundle(cellTable.img_Icon, eventData.EventIcon) end end --处理带事件图标的事件汇总 function UIGodBeastActivityGetReward:SetEventIcon(temp) if GameAppInfo.IsJapanesePackage() then for i, v in ipairs(self.group_EventJP) do local eventInfo = temp[i] if eventInfo then UIUtils.SetActive(v.gameObject, true) local eventData = MDL.OperationActivity.GodBeastEvent:GetDataByActivityID_EventID(self.activityId, eventInfo.eventId) v.txt_Event.text = UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[eventData.EventName]), eventData.EventColor) UIUtils.SetImageByAssetBundle(v.img_Icon, eventData.EventIcon) local eventName = string.FormatByIdsKey("IDS_HorseActivity_RewardHint_7", eventInfo.times) if temp[i + 1] then v.txt_Time.text = eventName .. "、" else v.txt_Time.text = eventName end else UIUtils.SetActive(v.gameObject, false) end end else for i, v in ipairs(self.group_Event) do local eventInfo = temp[i] if eventInfo then UIUtils.SetActive(v.gameObject, true) v.txt_Time.text = string.FormatByIdsKey("IDS_HorseActivity_RewardHint_7", eventInfo.times) local eventData = MDL.OperationActivity.GodBeastEvent:GetDataByActivityID_EventID(self.activityId, eventInfo.eventId) local eventName = UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[eventData.EventName]), eventData.EventColor) if temp[i + 1] then v.txt_Event.text = eventName .. "," else v.txt_Event.text = eventName end UIUtils.SetImageByAssetBundle(v.img_Icon, eventData.EventIcon) else UIUtils.SetActive(v.gameObject, false) end end end end function UIGodBeastActivityGetReward:SetEventStr(temp) --事件汇总字符串 local eventStr for i, v in ipairs(temp) do local eventData = MDL.OperationActivity.GodBeastEvent:GetDataByActivityID_EventID(self.activityId, v.eventId) if string.isNilOrEmpty(eventStr) then eventStr = string.FormatByIdsKey("IDS_HorseActivity_RewardHint_4", v.times, UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[eventData.EventName]), eventData.EventColor)) else eventStr = eventStr .. ", " .. string.FormatByIdsKey("IDS_HorseActivity_RewardHint_4", v.times, UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[eventData.EventName]), eventData.EventColor)) end end self.txt_LocInfo.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_GodBeastActivity_RewardHint_3) .. eventStr end function UIGodBeastActivityGetReward:RandomReward(isTenTimes, isMultiTimes, msg, temp) --随机奖励 if isTenTimes or isMultiTimes then temp = {} for i, v in ipairs(msg.randomItems) do table.insert(temp, {ItemId = v.ItemId, ItemCount = v.ItemCount, AtyEventId = v.AtyEventId}) end table.sort(temp, self.SortRandomItems) for i, v in ipairs(temp) do if isTenTimes then self.group_Ten.loop_RandomReward:AddData(v, 0) else self.group_More.loop_RandomRewardMore:AddData(v, 0) end end else local itemData = msg.randomItems[1] self.randomItemId = itemData.ItemId UTL.Item.SetItemCell(self.group_One.item_Random, itemData.ItemId, itemData.ItemCount) local eventData = MDL.OperationActivity.GodBeastEvent:GetDataByActivityID_EventID(self.activityId, itemData.AtyEventId) UIUtils.SetImageByAssetBundle(self.group_One.img_Icon, eventData.EventIcon) end end function UIGodBeastActivityGetReward:OnCloseActivitySelf(viewClassPath, activityId) if viewClassPath == self.__viewClassPath then if self.activityId and activityId == self.activityId then self:Finish() end end end return UIGodBeastActivityGetReward