From 182a6136635a3e872e9f50e26b094427d462a51b Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Mon, 13 Oct 2025 12:01:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=BA=A2=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/equip/equip_manager.lua | 3 + lua/app/ui/common/cell/equip_cell.lua | 7 + lua/app/ui/equip/equip_get_resonate_ui.lua | 2 +- lua/app/ui/equip/equip_growth_ui.lua | 2 +- lua/app/ui/equip/equip_info_ui.lua | 2 +- lua/app/ui/hero/equip_info_comp.lua | 44 ++++- lua/app/ui/hero/hero_detail_ui.lua | 14 +- lua/app/userdata/equip/equip_data.lua | 206 ++++++++++++++++++++- lua/app/userdata/hero/hero_entity.lua | 2 + 9 files changed, 266 insertions(+), 16 deletions(-) diff --git a/lua/app/module/equip/equip_manager.lua b/lua/app/module/equip/equip_manager.lua index 6020d4c5..63172888 100644 --- a/lua/app/module/equip/equip_manager.lua +++ b/lua/app/module/equip/equip_manager.lua @@ -42,6 +42,9 @@ end --@region 协议 -- 装备穿戴 function EquipManager:onEquipWearReq(slotId, ids) + if table.nums(ids) <= 0 then + return + end local params = {} params.slot = slotId params.ids = ids diff --git a/lua/app/ui/common/cell/equip_cell.lua b/lua/app/ui/common/cell/equip_cell.lua index cf00accb..b9409ed3 100644 --- a/lua/app/ui/common/cell/equip_cell.lua +++ b/lua/app/ui/common/cell/equip_cell.lua @@ -155,6 +155,13 @@ function EquipCell:setActive(active) self:getBaseObject():setActive(active) end +function EquipCell:addRedPoint(offsetX, offsetY, scale) + self:getBaseObject():addRedPoint(offsetX, offsetY, scale) +end + +function EquipCell:removeRedPoint() + self:getBaseObject():removeRedPoint() +end -- function EquipCell:showEffectUp() -- if self.effectUp == nil and self.parentUI then -- EffectManager:loadUIEffectAsync("assets/prefabs/effects/ui/vfx_ui_b9_yjqh_b01.prefab", self.parentUI, self.baseObject, GConst.UI_EFFECT_ORDER.LEVEL5, function(obj) diff --git a/lua/app/ui/equip/equip_get_resonate_ui.lua b/lua/app/ui/equip/equip_get_resonate_ui.lua index a0b3e615..05866712 100755 --- a/lua/app/ui/equip/equip_get_resonate_ui.lua +++ b/lua/app/ui/equip/equip_get_resonate_ui.lua @@ -22,7 +22,7 @@ function EquipGetEesonateUI:onLoadRootComplete() self:closeUI() end) - self.layout = uiMap["equip_get_resonate_ui.bg.b'gattr_bg.layout"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) + self.layout = uiMap["equip_get_resonate_ui.bg.attr_bg.layout"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT) self.attrNextValueTx = uiMap["equip_get_resonate_ui.bg.attr_bg.layout.attr_next_value_tx"] -- self.effect = uiMap["equip_get_resonate_ui.bg.vfx_b13_ui_equip_gongmin_b01"] uiMap["equip_get_resonate_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_33)) diff --git a/lua/app/ui/equip/equip_growth_ui.lua b/lua/app/ui/equip/equip_growth_ui.lua index 79cf97f7..71189a57 100644 --- a/lua/app/ui/equip/equip_growth_ui.lua +++ b/lua/app/ui/equip/equip_growth_ui.lua @@ -120,7 +120,7 @@ function EquipGrowthUI:onLoadRootComplete() end) end - self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16)} + self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_19), I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_20)} self.pageInfos = {} self.pageBtns = {} self.pageBtnTxs = {} diff --git a/lua/app/ui/equip/equip_info_ui.lua b/lua/app/ui/equip/equip_info_ui.lua index 0cf2c19a..e6537711 100644 --- a/lua/app/ui/equip/equip_info_ui.lua +++ b/lua/app/ui/equip/equip_info_ui.lua @@ -163,7 +163,7 @@ function EquipInfoUI:refreshAllAttr() if baseValueAdd <= 0 then self.attrValueAddTx:setText(GConst.EMPTY_STRING) else - self.attrValueAddTx:setText("(+".. math.floor(baseValueAdd) ..")") + self.attrValueAddTx:setText("(+".. math.floor(baseValueAdd) ..")") end local attrs = self.entity:getExtraList() diff --git a/lua/app/ui/hero/equip_info_comp.lua b/lua/app/ui/hero/equip_info_comp.lua index b949e280..ad5d90d8 100644 --- a/lua/app/ui/hero/equip_info_comp.lua +++ b/lua/app/ui/hero/equip_info_comp.lua @@ -6,8 +6,8 @@ function EquipInfoComp:init() 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.autoWaerBtn = uiMap["equip_info.equip_node.auto_waer_btn"] - self.autoWaerBtnTx = uiMap["equip_info.equip_node.auto_waer_btn.text"] + 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"] @@ -15,7 +15,7 @@ function EquipInfoComp:init() self.emptyTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_7)) self.upBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_3)) - self.autoWaerBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_2)) + self.autoWearBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_2)) self.equipCells = {} self.suitTxs = {} @@ -46,7 +46,7 @@ function EquipInfoComp:init() self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_4)) self.descTx1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_5)) - self.autoWaerBtn:addClickListener(function() + self.autoWearBtn:addClickListener(function() local soltId = self.heroEntity:getMatchType() local listUids = {} for i = 1, 6 do @@ -58,7 +58,21 @@ function EquipInfoComp:init() ModuleManager.EquipManager:onEquipWearReq(soltId, listUids) end) self.upBtn:addClickListener(function() - ModuleManager.EquipManager:showEquipGrowthUI(self.heroEntity:getMatchType(), 1) + local soltId = self.heroEntity:getMatchType() + local part + for i = 1, 6 do + local eid = DataManager.EquipData:getPartEquipUid(soltId, i) + if eid and eid > 0 then + part = part or i + if DataManager.EquipData:hasEquipGrowthRedPointBySlotIdAndPartId(soltId, part) then + ModuleManager.EquipManager:showEquipGrowthUI(soltId, i) + return + end + end + end + if part then + ModuleManager.EquipManager:showEquipGrowthUI(soltId, part) + end end) self.infoBtn:addClickListener(function() ModuleManager.EquipManager:showEquipResonateUI(self.heroEntity:getMatchType(), 1) @@ -76,6 +90,7 @@ end function EquipInfoComp:refresh() self:refreshEquip() self:refreshEquipSuit() + self:refreshRedPoint() end function EquipInfoComp:refreshEquip() @@ -96,6 +111,11 @@ function EquipInfoComp:refreshEquip() 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 @@ -107,4 +127,18 @@ function EquipInfoComp:refreshEquipSuit() 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:hasEquipGrowthRedPoint(slotId) then + self.upBtn:addRedPoint(70, 30, 1) + else + self.upBtn:removeRedPoint() + end +end + return EquipInfoComp \ No newline at end of file diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index 583c9ff7..31e9923b 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -442,19 +442,19 @@ function HeroDetailUI:checkLvUp(checkLevel) end local isLvChange = checkLevel and self.curLevel ~= self.heroEntity:getLv() + for i = 1, 5 do + self.lvUpVfxs[i]:setActive(false) + end + self.bg4Vfx01:setActive(false) + self.bg5Vfx01:setActive(false) + self.bg6Vfx01:setActive(false) + if isLvChange then local match = self.heroEntity:getMatchType() self.lvUpVfxs[match]:setActive(true) self.bg4Vfx01:setActive(true) self.bg5Vfx01:setActive(true) self.bg6Vfx01:setActive(true) - else - for i = 1, 5 do - self.lvUpVfxs[i]:setActive(false) - end - self.bg4Vfx01:setActive(false) - self.bg5Vfx01:setActive(false) - self.bg6Vfx01:setActive(false) end end diff --git a/lua/app/userdata/equip/equip_data.lua b/lua/app/userdata/equip/equip_data.lua index fbffcd6b..69ceae19 100644 --- a/lua/app/userdata/equip/equip_data.lua +++ b/lua/app/userdata/equip/equip_data.lua @@ -29,6 +29,7 @@ function EquipData:ctor() end function EquipData:clear() + self.allEquipsCount = 0 end function EquipData:init(data) @@ -41,7 +42,9 @@ function EquipData:init(data) return end + self.soltIdRedPoint = {} self.allEquips = {} + self.allEquipsCount = 0 if data.equips then for i, equip in pairs(data.equips) do self:addEquip(equip) @@ -166,6 +169,9 @@ function EquipData:addEquip(equip, itemGetType) if equip == nil then return end + if self.allEquips[equip.uid] == nil then + self.allEquipsCount = self.allEquipsCount + 1 + end self.allEquips[equip.uid] = self:createEquipEntity(equip) if itemGetType then BIReport:postEquipGet(equip.uid, equip.cfg_id, itemGetType) @@ -675,7 +681,7 @@ function EquipData:onResolveSuccess(uids) for i, uid in ipairs(uids) do if self.allEquips[uid] then self.allEquips[uid] = nil - -- self.allEquipsCount = self.allEquipsCount - 1 + self.allEquipsCount = self.allEquipsCount - 1 end end self:setDirtyResolve() @@ -744,4 +750,202 @@ function EquipData:getLowestFiveGradeEquips() end --@endregion +--region 红点 +--装备可穿戴红点 +function EquipData:hasEquipRedPoint(slotId) + if not self:isOpen() then + return false + end + return self:hasEquipRedPointBySlotId(slotId) +end + +function EquipData:hasEquipRedPointBySlotId(slotId) + if slotId == nil then + return false + end + local redPoint = self.soltIdRedPoint[slotId] + if redPoint ~= nil then + return redPoint + end + if self:hasEquipWearRedPoint(slotId) then + redPoint = true + elseif self:hasEquipGrowthRedPointBySlotId(slotId) then + redPoint = true + else + redPoint = false + end + self.soltIdRedPoint[slotId] = redPoint + self.soltIdRedPointDirty = true + return redPoint +end + +function EquipData:isOpen(showToast) + if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.HERO_EQUIP, not showToast) then + return false + end + return true +end + +function EquipData:hasEquipWearRedPointById(slotId) + if not self:isOpen() then + return false + end + return self:hasEquipWearRedPoint(slotId) +end + +function EquipData:hasEquipWearRedPointByPart(slotId, part) + if not self:isOpen() then + return false + end + if self.allEquipsCount <= 0 then + return false + end + if self:getEquipMaxScore(slotId, part) then + return true + elseif self:hasEquipEnhanceRedPoint(slotId, part) then + return true + elseif self:hasEquipRefineRedPoint(slotId, part) then + return true + end + return false +end + +function EquipData:hasEquipWearRedPoint(slotId) + if self.allEquipsCount <= 0 then + return false + end + if slotId then + for i = 1, 6 do + if self:getEquipMaxScore(slotId, i) then + return true + end + end + end + return false +end + +--装备养成红点 +function EquipData:hasEquipGrowthRedPoint(slotId) + if self.allEquipsCount <= 0 then + return false + end + return self:hasEquipGrowthRedPointBySlotId(slotId) +end + +function EquipData:hasEquipGrowthRedPointBySlotId(soltId) + if soltId == nil then + return false + end + for part = 1, 6 do + if self:hasEquipEnhanceRedPoint(soltId, part) then + return true + elseif self:hasEquipRefineRedPoint(soltId, part) then + return true + end + end + return false +end + +function EquipData:hasEquipGrowthRedPointBySlotIdAndPartId(soltId, part) + if soltId == nil then + return false + end + if self:hasEquipEnhanceRedPoint(soltId, part) then + return true + elseif self:hasEquipRefineRedPoint(soltId, part) then + return true + end + return false +end + +-- --强化红点 +-- function EquipData:hasEquipGrowthEnhanceRedPoint(heroId) +-- local heroEntity = DataManager.HeroData:getHeroById(heroId) +-- local soltId = heroEntity:getMatchType() +-- if soltId then +-- for part = 1, 6 do +-- if self:hasEquipEnhanceRedPoint(soltId, part) then +-- return true +-- end +-- end +-- end +-- return false +-- end + +-- --精炼红点 +-- function EquipData:hasEquipGrowthRefineRedPoint(heroId) +-- local heroEntity = DataManager.HeroData:getHeroById(heroId) +-- local soltId = heroEntity:getMatchType() +-- if soltId then +-- for part = 1, 6 do +-- if self:hasEquipRefineRedPoint(soltId, part) then +-- return true +-- end +-- end +-- end +-- return false +-- end + +--装备升级红点 +function EquipData:hasEquipEnhanceRedPoint(soltId, part) + if self.allEquipsCount <= 0 then + return false + end + local level = self:getPartLv(soltId, part) + local itemCost = self:getLevelCost(level + 1) + if itemCost ~= nil then + local costId = GFunc.getRewardId(itemCost) + local costNum = GFunc.getRewardNum(itemCost) + local count = DataManager.BagData.ItemData:getItemNumById(costId) + if costNum <= count then + return true + end + end + return false +end + +function EquipData:hasEquipRefineRedPoint(soltId, part) + if self.allEquipsCount <= 0 then + return false + end + local refine = self:getPartRefine(soltId, part) + local needLevel = self:getRefineNeedLevel(refine + 1) + if needLevel == nil or needLevel > self:getPartLevel(soltId, part) then + return false + end + local itemCost = self:getRefineCost(refine + 1) + if itemCost ~= nil then + local costId = GFunc.getRewardId(itemCost) + local costNum = GFunc.getRewardNum(itemCost) + local count = DataManager.BagData.ItemData:getItemNumById(costId) + if costNum <= count then + return true + end + end + return false +end + +-- --未穿戴装备有五十件以上的红点 +-- function EquipData:hasEquipUnWearRedPoint() +-- local wearList = {} +-- for soltId = 1, 6 do +-- for part = 1, 6 do +-- local uid = self:getPartEquipUid(soltId, part) +-- if uid ~= 0 then +-- wearList[uid] = true +-- end +-- end +-- end +-- local count = 0 +-- for _, equip in pairs(self.allEquips) do +-- if wearList[equip:getUid()] == nil then +-- count = count + 1 +-- if count >= 50 then +-- return true +-- end +-- end +-- end +-- return false +-- end +--endregion return EquipData \ No newline at end of file diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua index eb430ae1..7d657e24 100644 --- a/lua/app/userdata/hero/hero_entity.lua +++ b/lua/app/userdata/hero/hero_entity.lua @@ -831,6 +831,8 @@ function HeroEntity:showRedPoint(page) return self:canLvUp() elseif page == GConst.HeroConst.PANEL_TYPE.STAR then return self:canStarUp() + elseif page == GConst.HeroConst.PANEL_TYPE.EQUIP then + return DataManager.EquipData:hasEquipRedPoint(self:getMatchType()) end end --@endregion