local UIEquipmentDetail = UIViewClass() local EventSystem = require('Event/EventSystem') local MAX_EQUIP_NUM = 4 --最多装备数量 local MAX_GEM_NUM = 4 local DetailSubPanel = { [MDL.Equipment.DetailType.Base] = Const_UI_Lua.UIEnum.UIEquipmentBase, [MDL.Equipment.DetailType.Info] = Const_UI_Lua.UIEnum.UIEquipmentInfo, [MDL.Equipment.DetailType.Strengthen] = Const_UI_Lua.UIEnum.UIEquipmentStrengthen, [MDL.Equipment.DetailType.Compose] = Const_UI_Lua.UIEnum.UIEquipmentGemInfo, [MDL.Equipment.DetailType.Star] = Const_UI_Lua.UIEnum.UIEquipStarMain, } local DetailTabName = { [MDL.Equipment.DetailType.Base] = Const_IDS.IDS_Equip_Equip, [MDL.Equipment.DetailType.Info] = Const_IDS.IDS_Equip_Info_Sheet, [MDL.Equipment.DetailType.Strengthen] = Const_IDS.IDS_Equip_Enchance_Sheet, [MDL.Equipment.DetailType.Compose] = Const_IDS.IDS_Jade_Title_1, [MDL.Equipment.DetailType.Star] = Const_IDS.IDS_EquipStar_Tab, } function UIEquipmentDetail:OnCreated() self.equipItemList = { [1] = {comp = self.group_EquipItem1,type = 1}, [2] = {comp = self.group_EquipItem2,type = 2}, [3] = {comp = self.group_EquipItem3,type = 3}, [4] = {comp = self.group_EquipItem4,type = 4}, } self.selectEquipItem = nil self:InitGemInfo() end function UIEquipmentDetail:OnOpened(context) if context.isPushOpen then UIManager.ActiveUIModle(false, "UIEquipmentDetail") end self.InstantedGemIcon = {} self:RegistSystemEvent(EventID.UI_UpdateEquipmentInfo, self.RefreshEquipItems) self:RegistSystemEvent(EventID.UI_EquipEnhance_Success, self.RefreshEquipItems) self:RegistSystemEvent(EventID.UI_EquipWear_Success, self.RefreshEquipItems) self:RegistSystemEvent(EventID.UI_GemInlayOrRemoveSuccess, self.RefreshEquipItems) self:RegistSystemEvent(EventID.UI_EquipStarLevelUpSuccess, self.RefreshEquipItems) self:RegistSystemEvent(EventID.UI_Gem_Refresh_Bag, self.RefreshEquipItems) UIUtils.SetLabelText(self.UITemplateTitlePanel.lab_Title, Const_IDS.IDS_Equip_Equip) self.curEquipInfo = context.equipInfo local heroId if self.curEquipInfo then self.curEquipType = context.equipInfo.EquipData.EquipType heroId = MDL.Equipment.GetEquipHeroId(self.curEquipInfo.ID) else heroId = context.heroId self.curEquipType = context.equipType end self.curHeroId = heroId self:InitToggle(heroId) self:RefreshToggleRed() if context.index == nil then if heroId == nil then self:SelectToggle(MDL.Equipment.DetailType.Info) else --默认选中优先可养成的页签 local index = CTL.Equipment.GetFirstRedDetailType(self.curEquipInfo, heroId) self:SelectToggle(index) end else self:SelectToggle(context.index) end self:DisplayGemInfo() end function UIEquipmentDetail:SelectToggle(type) if self.toggleArray then local toggleIndex = 0 for i = 1, #self.toggleArray do if self.toggleArray[i] == type then toggleIndex = i break end end self.group_Toggles:SelectIndex(toggleIndex - 1) end end --toggleArray和group_ToggleComs索引值一致 function UIEquipmentDetail:GetTypeToggle(type) if self.toggleArray then local toggleIndex = 0 for i = 1, #self.toggleArray do if self.toggleArray[i] == type then toggleIndex = i break end end if toggleIndex == 0 then return nil end return self.group_Toggles:GetToggle(toggleIndex - 1) end return nil end function UIEquipmentDetail:InitToggle(heroId) if heroId then self.toggleArray = { [1] = MDL.Equipment.DetailType.Base, [2] = MDL.Equipment.DetailType.Strengthen, [3] = MDL.Equipment.DetailType.Info, } else self.toggleArray = { MDL.Equipment.DetailType.Info, } end local infoIndex = #self.toggleArray if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.Gem) and heroId then table.insert(self.toggleArray, infoIndex, MDL.Equipment.DetailType.Compose) end --print(MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.EquipStar) if MDL.Unlock.IsUnlock(MDL.Unlock.FunctionType.EquipStar) and heroId then table.insert(self.toggleArray, 4, MDL.Equipment.DetailType.Star) end local idsList = {} for i,v in ipairs(self.toggleArray) do table.insert(idsList, DetailTabName[v]) end UTL.Toggle.InitToggleGroupByIDS(self.group_Toggles, "text_toggle", idsList) -- 这是Toggle for i, v in ipairs(self.toggleArray) do local toggleType = UTL.Toggle.ToggleType.Equipment if v == MDL.Equipment.DetailType.Info then toggleType = UTL.Toggle.ToggleType.Information elseif v == MDL.Equipment.DetailType.Strengthen then toggleType = UTL.Toggle.ToggleType.Upgrade elseif v == MDL.Equipment.DetailType.Compose then toggleType = UTL.Toggle.ToggleType.EquipInset elseif v == MDL.Equipment.DetailType.Star then toggleType = UTL.Toggle.ToggleType.EquipStar end self.group_Toggles:SetToggleCompImage(i, "img_Icon", UTL.Toggle.GetToggleNormalIcon(toggleType)) self.group_Toggles:SetToggleCompImage(i, "img_Icon2", UTL.Toggle.GetToggleSelectedIcon(toggleType)) end end function UIEquipmentDetail:OnValueChanged(comp, index) if comp == self.group_Toggles then local toggleIndex = index + 1 local type = self.toggleArray[toggleIndex] self:OnSwitchDetailType(type) end end function UIEquipmentDetail:OnSwitchDetailType(detailType) if self.detailType == detailType then return end --空栏位从装备页签切到其他页签 if self.curEquipInfo == nil and detailType ~= MDL.Equipment.DetailType.Base then --如果有可选中的装备,选中排序最靠前的装备 local firstEquipItem = self:GetFirstEquipItem() if firstEquipItem then self:OnSelectEquipItem(firstEquipItem, false) else CTL.Tips.AddTipsMsg(Const_IDS["IDS_EquipRefine_PositionNoneEquip"]) --toggle的切换加个延迟,不然显示状态不对 self:StartRepeatFunc(self.DelaySelectToggle, 0, 1) --Interval设置为0表示直接在下一帧执行 return end end self.detailType = detailType if self.equipSubView then self.subView:CloseAll() end self.equipSubView = self.subView:OpenView(GetViewClass(DetailSubPanel[detailType])) UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info.gameObject, self.detailType == MDL.Equipment.DetailType.Strengthen or self.detailType == MDL.Equipment.DetailType.Base or self.detailType == MDL.Equipment.DetailType.Star) if self.curHeroId then local equipInfos = MDL.Equipment.GetEquipmentsByHeroId(self.curHeroId) self:OnSwitchEquipInfos(equipInfos) else if self.detailType == MDL.Equipment.DetailType.Info then EventSystem.Dispatch(EventID.UI_SelectDetailEquip, self.curEquipInfo, nil, self.curEquipType) EventSystem.Dispatch(EventID.UI_UpdateEquipmentHeroId, nil) self:SetMiddleUI() else local equipInfos local lineUpIds = MDL.Formation.GetSlotHeroIds() for i = 1, #lineUpIds do equipInfos = MDL.Equipment.GetEquipmentsByHeroId(lineUpIds[i]) if equipInfos == nil then break end end self:OnSwitchEquipInfos(equipInfos) end end end function UIEquipmentDetail:DelaySelectToggle() self:SelectToggle(MDL.Equipment.DetailType.Base) end function UIEquipmentDetail:OnSwitchEquipInfos(equipInfos) local heroID = self.curHeroId if heroID == nil then return end local heroInfo = MDL.HeroSelect.GetHeroInfo(heroID) local gemRedPoint local quickCompose --只在相应页签下算对应功能的红点 if self.detailType == MDL.Equipment.DetailType.Compose then gemRedPoint = MDL.GemCompose.RedpointEquipGemInfoInFunction(heroID) quickCompose = MDL.GemCompose.QuickEquipGemInfoInFunction(heroID) end local selectItem for i = 1, MAX_EQUIP_NUM do local equipInfo if equipInfos then for j = 1, #equipInfos do if equipInfos[j].EquipData.EquipType == i then equipInfo = equipInfos[j] break end end end local isArrow = false local isRed = false if self.detailType == MDL.Equipment.DetailType.Compose then isArrow = gemRedPoint[i] or quickCompose[i] elseif self.detailType == MDL.Equipment.DetailType.Strengthen then if equipInfo then isArrow = CTL.Equipment.CheckEquipIfStrength(equipInfo) end elseif self.detailType == MDL.Equipment.DetailType.Base then if equipInfo then isArrow = CTL.Equipment.CheckIfRefine(equipInfo) isRed = CTL.Equipment.CheckHasBetterBetterEquip(heroInfo.equipInfos[i], i) end elseif self.detailType == MDL.Equipment.DetailType.Star then if equipInfo then isArrow = CTL.Equipment.CheckEquipIfLevelUp(equipInfo) or false end end self:InitEquipItem(self.equipItemList[i], equipInfo, isArrow, isRed) --选中上一个位置的装备 if selectItem == nil and equipInfo then selectItem = self.equipItemList[i] end if self.equipItemList[i].type == self.curEquipType then selectItem = self.equipItemList[i] end end --选中第一个有装备的位置 if selectItem then self:OnSelectEquipItem(selectItem, false) end local heroData = DataSheetManager.HeroNum:GetDataByID(heroID) UIUtils.SetLabelText(self.txt_HeroName, Const_IDS[heroData.NameIDS]) UTL.Color.SetQualityImageByType(self.bg_HeroHead, CTL.HeroAwaken.GetHeroQuality(heroID, MDL.HeroAwaken.GetIsHeroAwaken(heroID)), UTL.Color.QualityType.Square) UTL.Item.SetHeroIconByHeroId(self.img_HeroHead, heroID, MDL.HeroAwaken.GetIsHeroAwaken(heroID)) --没有可切换的武将时隐藏箭头 local heroNum = #MDL.HeroSelect.GetHasHeroList() if heroNum <= 1 then UIUtils.SetActive(self.btn_Before, false) UIUtils.SetActive(self.btn_Next, false) else --非base页签,判断如果存在装备,则显示该箭头 if self.detailType == MDL.Equipment.DetailType.Base then UIUtils.SetActive(self.btn_Before, true) UIUtils.SetActive(self.btn_Next, true) else local nextEquipInfos, nextHeroId = self:GetNextHeroSelectEquip(false,1) if nextEquipInfos then UIUtils.SetActive(self.btn_Before, true) UIUtils.SetActive(self.btn_Next, true) else UIUtils.SetActive(self.btn_Before, false) UIUtils.SetActive(self.btn_Next, false) end end end EventSystem.Dispatch(EventID.UI_UpdateEquipmentHeroId, heroID) end function UIEquipmentDetail:GetCurHeroIndex() if self.curHeroId then local lineUpIds = MDL.Formation.GetSlotHeroIds() for i = 1, #lineUpIds do if lineUpIds[i] == self.curHeroId then return i end end end return 0 end --isBase:true[返回下一个武将的数据] false[返回下一个有装备的武将的数据] function UIEquipmentDetail:GetNextHeroSelectEquip(isBase, offset) local equipInfos = nil local nextHeroId = nil local index = self:GetCurHeroIndex() local lineUpIds = MDL.Formation.GetSlotHeroIds() local length = #lineUpIds if isBase then while (nextHeroId == nil or nextHeroId == 0) do index = index + offset if index > length then index = 1 elseif index < 1 then index = length end nextHeroId = lineUpIds[index] end equipInfos = MDL.Equipment.GetEquipmentsByHeroId(nextHeroId) else while (equipInfos == nil) do index = index + offset if index > length then index = 1 elseif index < 1 then index = length end local heroId = lineUpIds[index] equipInfos = MDL.Equipment.GetEquipmentsByHeroId(heroId) nextHeroId = heroId end if nextHeroId == self.curHeroId then equipInfos = nil nextHeroId = nil end end return equipInfos, nextHeroId end function UIEquipmentDetail:OnBackButtonPressed() self:OnButtonClicked(self.UITemplateTitlePanel.btn_close) end function UIEquipmentDetail:OnButtonClicked(comp) if comp == self.UITemplateTitlePanel.btn_close then if self.context.isPushOpen then MDL.HeroSelect.curSelectHeroID = self.curHeroId self:CloseView(true) else self:CloseView() end elseif comp == self.UITemplateTitlePanel.btn_Home then CTL.HomeMain.CloseViewBackHomeMain() elseif comp == self.UITemplateTitlePanel.btn_Info then if self.detailType == MDL.Equipment.DetailType.Strengthen then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.EquipEnchance }) elseif self.detailType == MDL.Equipment.DetailType.Base then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.EquipRefine }) elseif self.detailType == MDL.Equipment.DetailType.Star then UIManager.OpenView(Const_UI_Lua.UIEnum.UICommonNoteView, {id = LuaConst.NoteID.EquipStar }) end elseif comp == self.btn_Before then self:OnSwitchEquipSlot(-1) elseif comp == self.btn_Next then self:OnSwitchEquipSlot(1) else for i = 1, #self.equipItemList do if (self.equipItemList[i].comp.btn_Click == comp) then self:OnSelectEquipItem(self.equipItemList[i], true) break end end end end function UIEquipmentDetail:OnClosed() UIUtils.SetActive(self.UITemplateTitlePanel.btn_Info, true) self.context.equipInfo = self.curEquipInfo self.context.index = self.detailType self.context.equipType = self.curEquipType if self.curHeroId == nil then self.context.heroId = nil else self.context.heroId = self.curHeroId end CTL.FormationResonance.RecoveryResonanceFunctionPanel() if self.context.isPushOpen then UIManager.ActiveUIModle(true, "UIEquipmentDetail") end end function UIEquipmentDetail:OnSwitchEquipSlot(offset) local nextEquipInfo, nextHeroId = self:GetNextHeroSelectEquip(self.detailType == MDL.Equipment.DetailType.Base, offset) if nextHeroId then self.curHeroId = nextHeroId self:OnSwitchEquipInfos(nextEquipInfo) self:RefreshToggleRed() EventSystem.Dispatch(EventID.UI_UpdateEquipmentHeroId, self.curHeroId) end end function UIEquipmentDetail:RefreshToggleRed() if self.curHeroId == nil then return end local heroId = self.curHeroId --洗炼/穿戴红点 local baseRed = CTL.Equipment.CheckEquipIfWear(heroId) or CTL.Equipment.CheckEquipIfRefineByHeroID(heroId) local baseToggle = self:GetTypeToggle(MDL.Equipment.DetailType.Base) if baseToggle then baseToggle:SetRedPoint(baseRed) end --强化页签红点 local strengthenRed = CTL.Equipment.CheckEquipIfStrengthByHeroID(heroId) local strengthenToggle = self:GetTypeToggle(MDL.Equipment.DetailType.Strengthen) if strengthenToggle then strengthenToggle:SetRedPoint(strengthenRed) end --宝石页签红点 local gemRed = MDL.GemCompose.QuickEquipGemInfoByHero(heroId) if gemRed == false then gemRed = MDL.GemCompose.RedpointEquipGemInfoByHero(heroId) end local gemToggle = self:GetTypeToggle(MDL.Equipment.DetailType.Compose) if gemToggle then gemToggle:SetRedPoint(gemRed) end local starRed = CTL.Equipment.EquipStarHasRed(heroId) local starToggle = self:GetTypeToggle(MDL.Equipment.DetailType.Star) if starToggle then starToggle:SetRedPoint(starRed) end --刷新按钮红点 self:RefreshSwitchBtnRed() end --刷新左右切换按钮红点 function UIEquipmentDetail:RefreshSwitchBtnRed() if self.detailType == MDL.Equipment.DetailType.Info or self.curHeroId == nil then self.btn_Before:SetRedPoint(false) self.btn_Next:SetRedPoint(false) return end local isLeftRed = false local isRightRed = false local lineUpIds = MDL.Formation.GetSlotHeroIds() local curHeroIndex = self:GetCurHeroIndex() for i, heroId in ipairs(lineUpIds) do if isLeftRed == false and curHeroIndex > i then isLeftRed = CTL.Equipment.CheckTypeRedByHeroID(self.detailType, heroId) end if isRightRed == false and curHeroIndex < i then isRightRed = CTL.Equipment.CheckTypeRedByHeroID(self.detailType, heroId) end end self.btn_Before:SetRedPoint(isLeftRed) self.btn_Next:SetRedPoint(isRightRed) end --region EquipItem function UIEquipmentDetail:RefreshEquipItems() if UIManager.IsFocus(Const_UI_Lua.UIEnum.UIEquipmentDetail) == false then return end if self.curHeroId then local equipInfos = MDL.Equipment.GetEquipmentsByHeroId(self.curHeroId) self:OnSwitchEquipInfos(equipInfos) end self:RefreshToggleRed() end function UIEquipmentDetail:InitEquipItem(equipItem, info, isArrow, isRed) equipItem.equipInfo = info local comp = equipItem.comp UIUtils.SetActive(comp.img_Upgrade,false)--为保证箭头的动画一致 if info then comp.obj_state:SetState(0) UIUtils.SetActive(comp.btn_Locked,false) CTL.Equipment.SetEquipShow(comp.img_Equip,comp.img_quality,info.ItemData) if self.detailType == MDL.Equipment.DetailType.Strengthen then local heroInfo, enhanceLevel = MDL.Equipment.GetEquipHeroInfo(info.ID) if heroInfo ~= nil then UIUtils.SetActive(comp.EquipLv,true) comp.txt_Lv.text = UTL.Item.GetNobilityByTeamLevel(enhanceLevel) -- 爵位转换 else UIUtils.SetActive(comp.EquipLv,false) end else UIUtils.SetActive(comp.EquipLv,false) end UIUtils.SetActive(comp.img_StarBg, false) if self.detailType == MDL.Equipment.DetailType.Star then local starStage, starNum = MDL.Equipment.GetEquipStarInfo(info.ID) if starStage > 0 then UIUtils.SetActive(comp.img_StarBg, true) comp.txt_Num.text = starNum local stageData = DataSheetManager.EquipStarStage:GetDataByStarStage(starStage) UIUtils.SetImageByAssetBundle(comp.img_Star, stageData.Icon) end end else UTL.Item.SetAtlasSprite(comp.img_quality, "UI_Common", "zr_kuang_touxiang") comp.obj_state:SetState(1) local unlock,content = CTL.Equipment.CheckIfEquipTypeUnlock(equipItem.type) if unlock then UIUtils.SetActive(comp.btn_Locked,false) else UIUtils.SetActive(comp.btn_Locked,true) comp.txt_Locked.text = content end end --箭头红点 comp.btn_Click:SetRedPoint(isRed) if info and (self.detailType == MDL.Equipment.DetailType.Base or self.detailType == MDL.Equipment.DetailType.Info) then CTL.Equipment.SetEquipmentStage(comp.txt_EquipStageNum, info.ItemData.ID, false) UIUtils.SetActive(comp.txt_EquipStageNum, true) UIUtils.SetActive(comp.img_Upgrade01, isArrow) UIUtils.SetActive(comp.img_Upgrade, false) else UIUtils.SetActive(comp.img_Upgrade, isArrow) UIUtils.SetActive(comp.img_Upgrade01, false) UIUtils.SetActive(comp.txt_EquipStageNum, false) end end function UIEquipmentDetail:GetFirstEquipItem() for i, equipItem in ipairs(self.equipItemList) do local equipInfo = equipItem.equipInfo if equipInfo then return equipItem end end return nil end function UIEquipmentDetail:OnSelectEquipItem(equipItem, isClick) if self.selectEquipItem ~= nil then --相同item点击弹出tips if self.selectEquipItem == equipItem then if isClick and equipItem.equipInfo then UTL.ItemTips.ShowCommonTipsById(equipItem.equipInfo.ItemData.ID,nil,nil,equipItem.equipInfo.ID) end else UIUtils.SetActive(self.selectEquipItem.comp.sprite_Select,false) end end UIUtils.SetActive(equipItem.comp.sprite_Select,true) self.selectEquipItem = equipItem self.curEquipType = equipItem.type local heroId = self.curHeroId if equipItem.equipInfo == nil then --主动在非base页签下点击了空装备,需要跳转到base页签 if isClick and self.detailType ~= MDL.Equipment.DetailType.Base then self.curEquipInfo = nil self:SelectToggle(MDL.Equipment.DetailType.Base) return else --从base的空装备跳转到其他页签,优先选中第一个非空的装备 local firstEquipItem = self:GetFirstEquipItem() if self.detailType ~= MDL.Equipment.DetailType.Base and firstEquipItem then self:OnSelectEquipItem(firstEquipItem, false) else --一个装备都没有,切到base页签 self.curEquipInfo = nil self:SelectToggle(MDL.Equipment.DetailType.Base) end end else self.curEquipInfo = equipItem.equipInfo self.empty_state:SetState(1) self:DisplayGemInfo(heroId) end self:SetMiddleUI() EventSystem.Dispatch(EventID.UI_SelectDetailEquip, self.curEquipInfo, heroId, self.curEquipType) end function UIEquipmentDetail:SetMiddleUI() if self.detailType == MDL.Equipment.DetailType.Info then if self.curHeroId == nil then self.group_Bottom:SetState(1) else self.group_Bottom:SetState(0) end else self.group_Bottom:SetState(0) end if self.curEquipInfo then self.empty_state:SetState(1) self.txt_EquipName.text = UTL.Color.FormatQualityText(UIUtils.GetLocalizedTxt(Const_IDS[self.curEquipInfo.ItemData.Name]), self.curEquipInfo.ItemData.Color) self.txt_EquipQua.text = self.curEquipInfo.EquipData.Talent local level = CTL.Equipment.GetEquipLevel(self.curEquipInfo.EquipData) self.txt_WearNum.text = UIUtils.GetLocalizedTxt(Const_IDS.IDS_EquipRefine_EquipLevel) .. level CTL.Equipment.SetEquipShow(self.img_Equip,nil,self.curEquipInfo.ItemData) else self.empty_state:SetState(0) end self:RefreshSwitchBtnRed() end --endregion --装备Icon下面宝石信息 function UIEquipmentDetail:InitGemInfo() self.GemInconRoots = {} table.insert(self.GemInconRoots, self.group_EquipItem1.group_Gem) table.insert(self.GemInconRoots, self.group_EquipItem2.group_Gem) table.insert(self.GemInconRoots, self.group_EquipItem3.group_Gem) table.insert(self.GemInconRoots, self.group_EquipItem4.group_Gem) self.GemIconBg = {} table.insert(self.GemIconBg, self.group_EquipItem1.bg_Gem) table.insert(self.GemIconBg, self.group_EquipItem2.bg_Gem) table.insert(self.GemIconBg, self.group_EquipItem3.bg_Gem) table.insert(self.GemIconBg, self.group_EquipItem4.bg_Gem) self.GemIcons = {} table.insert(self.GemIcons, self.group_EquipItem1.cell_Gem) table.insert(self.GemIcons, self.group_EquipItem2.cell_Gem) table.insert(self.GemIcons, self.group_EquipItem3.cell_Gem) table.insert(self.GemIcons, self.group_EquipItem4.cell_Gem) end function UIEquipmentDetail:DisplayGemInfo(curHeroId) if self.detailType ~= MDL.Equipment.DetailType.Compose then for equipIndex = 1, MAX_EQUIP_NUM do UIUtils.SetActive(self.GemInconRoots[equipIndex].gameObject, false) UIUtils.SetActive(self.GemIconBg[equipIndex], false) end return end if curHeroId == nil then curHeroId = self.curHeroId end for equipIndex = 1, MAX_EQUIP_NUM do for i=MAX_GEM_NUM,1,-1 do if self.GemInconRoots[equipIndex][i] ~= nil then self:DestroyCollection(self.GemInconRoots[equipIndex], i) end end end local itemIndex = 0 if curHeroId ~= nil then for equipIndex = 1, MAX_EQUIP_NUM do local inlayGemInfos = MDL.GemCompose.GetHeroInlayGemInfo(curHeroId, equipIndex) local isGemUnlock = false for i = 1, MAX_GEM_NUM do local GemTypeCfgData = DataSheetManager.JadeType:GetDataByID_ChildID(equipIndex, 1) local isUnlock = MDL.Unlock.IsComplete(GemTypeCfgData.UnlockCondition, GemTypeCfgData.UnlockConditionParam) isGemUnlock = isUnlock end UIUtils.SetActive(self.GemInconRoots[equipIndex].gameObject, isGemUnlock) UIUtils.SetActive(self.GemIconBg[equipIndex], isGemUnlock) if isGemUnlock then if inlayGemInfos ~= nil and #inlayGemInfos > 0 then for i = 1, #inlayGemInfos do if inlayGemInfos[i] ~= nil then local GemTypeCfgData = DataSheetManager.JadeType:GetDataByID_ChildID(equipIndex, i) local isUnlock = MDL.Unlock.IsComplete(GemTypeCfgData.UnlockCondition, GemTypeCfgData.UnlockConditionParam) if isUnlock then self:InstantiateCollection(self.GemInconRoots[equipIndex], self.GemIcons[equipIndex].gameObject) UIUtils.SetActive(self.GemInconRoots[equipIndex][i].gameObject, true) local icon = self.GemInconRoots[equipIndex][i].icon_Gem --TODO 根据品质设置宝石颜色 if inlayGemInfos[i] > 0 then local itemData = DataSheetManager.ItemData:GetDataByID(inlayGemInfos[i]) local jadeIcon = DataSheetManager.JadeLittleIcon:GetDataByLevel(itemData.ThirdType) UTL.Item.ItemIconByName(icon, jadeIcon.JadeIcon) UIUtils.SetActive(icon, true) else UIUtils.SetActive(icon, false) end end end end else if MDL.GemCompose.HasEquipByHeroId(curHeroId, equipIndex) then for i = 1, MAX_GEM_NUM do local GemTypeCfgData = DataSheetManager.JadeType:GetDataByID_ChildID(equipIndex, i) local isUnlock = MDL.Unlock.IsComplete(GemTypeCfgData.UnlockCondition, GemTypeCfgData.UnlockConditionParam) if isUnlock then self:InstantiateCollection(self.GemInconRoots[equipIndex], self.GemIcons[equipIndex].gameObject) UIUtils.SetActive(self.GemInconRoots[equipIndex][i].gameObject, true) local icon = self.GemInconRoots[equipIndex][i].icon_Gem UIUtils.SetActive(icon, false) end end end end end end end end return UIEquipmentDetail