local EquipInfoComp = class("EquipInfoComp", LuaComponent) function EquipInfoComp:init() local uiMap = self:getUIMap() self.descTx = uiMap["equip_info.equip_node.up.desc_tx"] self.descTx1 = uiMap["equip_info.equip_node.up.desc_tx_1"] self.infoBtn = uiMap["equip_info.equip_node.up.info_btn"] self.autoWearBtn = uiMap["equip_info.equip_node.auto_wear_btn"] self.autoWearBtnTx = uiMap["equip_info.equip_node.auto_wear_btn.text"] self.upBtn = uiMap["equip_info.equip_node.up_btn"] self.upBtnTx = uiMap["equip_info.equip_node.up_btn.text"] self.equipNode = uiMap["equip_info.equip_node"] self.emptyTx = uiMap["equip_info.empty_tx"] self.emptyTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_7)) self.upBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_3)) self.autoWearBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_2)) self.currEquipEids = {} self.equipCells = {} self.suitTxs = {} self.equipVfxs = {} for i = 1, 6 do self.suitTxs[i] = uiMap["equip_info.equip_node.up.suit_tx_" .. i] self.equipVfxs[i] = uiMap["equip_info.equip_node.equip_cell_" .. i .. ".vfx_c1_ui_up_b06"] self.equipCells[i] = uiMap["equip_info.equip_node.equip_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL) self.equipCells[i]:addClickListener(function() local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), i) if eid and eid > 0 then local equipEntity = DataManager.EquipData:getEquipByUid(eid) local parmas = {} parmas.heroEntity = self.heroEntity parmas.slotId = self.heroEntity:getMatchType() parmas.part = i parmas.uid = eid parmas.id = equipEntity:getId() parmas.showType = GConst.EquipConst.INFO_SHOW_TYPE.ALL_ATTR ModuleManager.EquipManager:showEquipInfoUI(parmas) else ModuleManager.EquipManager:showEquipListUI(self.heroEntity, i) end end) end for i = 1, 3 do local descTx = uiMap["equip_info.equip_node.up.suit_desc_tx_" .. i] descTx:setText(I18N:getGlobalText(I18N.GlobalConst["EQUIP_HERO_LV_" .. i])) end self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_4)) self.descTx1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_5)) self.autoWearBtn:addClickListener(function() local slotId = self.heroEntity:getMatchType() local listUids = {} for i = 1, 6 do local equip = DataManager.EquipData:getEquipMaxScore(slotId, i) if equip ~= nil then table.insert(listUids, equip:getUid()) end end ModuleManager.EquipManager:onEquipWearReq(slotId, listUids) end) self.upBtn:addClickListener(function() local slotId = self.heroEntity:getMatchType() local part for i = 1, 6 do local eid = DataManager.EquipData:getPartEquipUid(slotId, i) if eid and eid > 0 then part = part or i if DataManager.EquipData:hasEquipGrowthRedPointBySlotIdAndPartId(slotId, part) then ModuleManager.EquipManager:showEquipGrowthUI(slotId, i) return end end end if part then ModuleManager.EquipManager:showEquipGrowthUI(slotId, part) end end) self.infoBtn:addClickListener(function() ModuleManager.EquipManager:showEquipResonateUI(self.heroEntity:getMatchType(), 1) end) end function EquipInfoComp:setParentUI(ui) self.uiRoot = ui end function EquipInfoComp:setHeroData(heroEntity, onlyLook, formationType) self.onlyLook = onlyLook self.formationType = formationType if not self.heroEntity or self.heroEntity ~= heroEntity then for part = 1, 6 do local eid = DataManager.EquipData:getPartEquipUid(heroEntity:getMatchType(), part) self.currEquipEids[part] = eid end end self.heroEntity = heroEntity end function EquipInfoComp:refresh() self:refreshEquip() self:refreshEquipSuit() self:refreshRedPoint() end function EquipInfoComp:refreshEquip() local slotId = self.heroEntity:getMatchType() self.curFormation = DataManager.FormationData:getFormation(self.formationType) if self.curFormation[slotId] ~= self.heroEntity:getCfgId() then self.emptyTx:setActive(true) self.equipNode:setActive(false) return end self.emptyTx:setActive(false) self.equipNode:setActive(true) for part = 1, 6 do local eid = DataManager.EquipData:getPartEquipUid(slotId, part) self.equipVfxs[part]:setActive(false) if eid and eid > 0 then local equipEntity = DataManager.EquipData:getEquipByUid(eid) self.equipCells[part]:refresh(equipEntity, slotId) if not self.currEquipEids[part] or self.currEquipEids[part] ~= eid then self.equipVfxs[part]:setActive(true) end self.currEquipEids[part] = eid else self.equipCells[part]:refreshEmpty(part) end if DataManager.EquipData:hasEquipWearRedPointByPart(slotId, part) then self.equipCells[part]:addRedPoint(60, 60, 1) else self.equipCells[part]:removeRedPoint() end end end function EquipInfoComp:refreshEquipSuit() local slotId = self.heroEntity:getMatchType() for i = 1, 3 do local lv = DataManager.EquipData:getResonateLevel(i, slotId) self.suitTxs[i]:setText(lv) end end function EquipInfoComp:refreshRedPoint() local slotId = self.heroEntity:getMatchType() if DataManager.EquipData:hasEquipWearRedPointById(slotId) then self.autoWearBtn:addRedPoint(70, 30, 1) else self.autoWearBtn:removeRedPoint() end if DataManager.EquipData:hasOneEquipWear(slotId) and DataManager.EquipData:hasEquipGrowthRedPoint(slotId) then self.upBtn:addRedPoint(70, 30, 1) else self.upBtn:removeRedPoint() end end return EquipInfoComp