local UIEquipStarQuickStrengthen = UIViewClass() function UIEquipStarQuickStrengthen:OnOpened(context) self:UpdateInfo(context.equipInfos) local hint self.hintToggle, hint = MDL.Equipment.GetSkipStarToggle() self.toggle_NoPrompt.isOn = hint == 0 and true or self.hintToggle --如果是0,说明没有值,默认为勾选true,小于0为主动取消了勾选false end function UIEquipStarQuickStrengthen:UpdateInfo(equipInfos) self.heroId = MDL.Equipment.GetEquipHeroId(equipInfos[1].Id) local needCostTable = nil local index = 0 for i, v in ipairs(equipInfos) do local itemData = DataSheetManager.ItemData:GetDataByID(v.CfgId) local times = v.times if times then index = index + 1 UIUtils.SetActive(self.group_Equip[index].img_Num1, true) UIUtils.SetActive(self.group_Equip[index].gameObject, true) UIUtils.SetLabel(self.group_Equip[index].txt_EquipName, UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[itemData.Name]), itemData.Color)) CTL.Equipment.SetEquipShow(self.group_Equip[index].img_Equip, self.group_Equip[index].img_equipQuality, itemData) self:SetStar(self.group_Equip[index].img_Star1, self.group_Equip[index].txt_Num1, v.starStage, v.starNum) self:SetStar(self.group_Equip[index].img_Star2, self.group_Equip[index].txt_Num2, v.willStarStage, v.willStarNum) UIUtils.SetActive(self.group_Equip[index].img_UP, true) end end for i = index + 1, #self.group_Equip do UIUtils.SetActive(self.group_Equip[i].gameObject, false) end UIUtils.SetLabelText(self.UICommonPopUp.txt_Title, Const_IDS.IDS_EquipStar_Tittle14) local costItemList = self:GetCost() self:SetCostItem(costItemList) end --还没有用到,要先改进计算总量的方法返回的数据,再用该数据进行显示 function UIEquipStarQuickStrengthen:SetCostItem(itemTable) local index = 1 for itemId, itemNum in pairs(itemTable) do local comp = self.group_Cost[index] index = index + 1 UIUtils.SetActive(comp.gameObject, true) if MDL.Currency.IsMoneyTypeByItemID(itemId) then local count = MDL.Currency.GetMoneyCount(itemId) count = count >= itemNum and itemNum or UTL.Color.FormatRedColor(itemNum) UTL.Item.MoneyIcon(comp.icon_Cost, itemId) comp.txt_Cost.text = count else local count = MDL.Bag.GetItemCount(itemId) or 0 if count >= itemNum then count = count .. "/" .. itemNum else count = UTL.Color.FormatRedColor(count) .. "/" .. itemNum end UTL.Item.ItemIconWithoutBg(comp.icon_Cost, itemId) end end end function UIEquipStarQuickStrengthen:OnBackButtonPressed() self:OnButtonClicked(self.UICommonPopUp.btn_Close) end function UIEquipStarQuickStrengthen:OnButtonClicked(comp) if comp == self.btn_2 or comp == self.UICommonPopUp.btn_Close then self:CloseView() elseif (comp == self.btn_1) then MDL.Equipment.OneKeyEquipStarLevelUpReq(self.heroId, self.context.equipInfos) MDL.Equipment.SetSkipStarToggle(self.hintToggle) self:CloseView() end end function UIEquipStarQuickStrengthen:OnValueChanged(comp, state) if comp == self.toggle_NoPrompt then self.hintToggle = comp.isOn end end function UIEquipStarQuickStrengthen:SetStar(img_Stage, lab_Star, stage, star) lab_Star.text = star if stage == 0 then stage, star = 1, 1 end local stageData = DataSheetManager.EquipStar:GetDataByStarStage_StarLevel(stage, star) if stageData then local stageData = DataSheetManager.EquipStarStage:GetDataByStarStage(stage) UIUtils.SetImageByAssetBundle(img_Stage, stageData.Icon) end end function UIEquipStarQuickStrengthen:GetCost() local costItemList = {} for _, v in ipairs(self.context.equipInfos) do for i = 1, v.times do logging.log(LTAG.LOG,"VVVV",v.times) local starStage, starLevel = v.starStage, v.starNum if starLevel + i > 10 then starStage = starStage + 1 starLevel = i + starLevel - 10 else starLevel = starLevel + i end if starStage == 0 then starStage, starLevel = 1, i end local data = DataSheetManager.EquipStar:GetDataByStarStage_StarLevel(starStage, starLevel) for i, cost in ipairs(data.item_Table) do costItemList[cost.ItemID] = costItemList[cost.ItemID] or 0 costItemList[cost.ItemID] = costItemList[cost.ItemID] + cost.ItemNum end end end return costItemList end return UIEquipStarQuickStrengthen