From a80e0b5e90f31eb0875abac6a6a3417f5bbb5a35 Mon Sep 17 00:00:00 2001 From: Fang Date: Wed, 26 Jul 2023 15:14:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=BA=A2=E7=82=B9=E3=80=81?= =?UTF-8?q?=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/common/cell/hero_cell.lua | 6 ++++ lua/app/ui/hero/armor_info_comp.lua | 8 ++++- lua/app/ui/hero/hero_detail_ui.lua | 11 +++++++ lua/app/ui/hero/weapon_info_comp.lua | 7 +++- lua/app/userdata/equip/equip_data.lua | 44 +++++++++++++++++++++++++ lua/app/userdata/equip/equip_entity.lua | 3 ++ 6 files changed, 77 insertions(+), 2 deletions(-) diff --git a/lua/app/ui/common/cell/hero_cell.lua b/lua/app/ui/common/cell/hero_cell.lua index dbfe2215..4adc77d3 100644 --- a/lua/app/ui/common/cell/hero_cell.lua +++ b/lua/app/ui/common/cell/hero_cell.lua @@ -38,6 +38,12 @@ function HeroCell:refresh(heroEntity, isGray) local heroInfo = heroEntity:getConfig() self:_refresh(heroInfo, isGray) + if DataManager.EquipData:canUpgradeEquip(self.heroEntity:getCfgId()) then + self.selfNode:addRedPoint(55, -35, 0.64) + else + self.selfNode:removeRedPoint() + end + local canLvUp = heroEntity:canLvUp() self.lvUpArrow:setVisible(canLvUp) if canLvUp then diff --git a/lua/app/ui/hero/armor_info_comp.lua b/lua/app/ui/hero/armor_info_comp.lua index 8dcb4bc1..405f461d 100644 --- a/lua/app/ui/hero/armor_info_comp.lua +++ b/lua/app/ui/hero/armor_info_comp.lua @@ -22,7 +22,7 @@ function ArmorInfoComp:init() self.btnUp = uiMap["armor_info.upgrade.btn_up"] self.txUp = uiMap["armor_info.upgrade.btn_up.tx_desc"] self.txNum = uiMap["armor_info.upgrade.btn_up.tx_num"] - self.btnAttr = uiMap["armor_info.attr.btn_attr"] + self.btnAttr = uiMap["armor_info.attr"] self.imgCurBg = uiMap["armor_info.current.cur_armor.bg"] self.rootCurEffect = uiMap["armor_info.current.cur_armor.root_effect"] self.txCurName = uiMap["armor_info.current.cur_armor.name.tx_name"] @@ -231,6 +231,12 @@ function ArmorInfoComp:refreshPart(index) end) imgType:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, stage <= 1 and "frame_dec_1" or "frame_dec_2") txLevel:setText("+".. armorEntity:getLevel()) + + if armorEntity:canLevelUp() then + armorObj:addRedPoint(50, 50, 0.6) + else + armorObj:removeRedPoint() + end end -- 播放部位升级动效 diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index fef089c1..4805d04a 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -172,6 +172,17 @@ function HeroDetailUI:refreshShow() self.btnLeft:setVisible(self:isExistLeftHero()) self.btnRight:setVisible(self:isExistRightHero()) self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_HERO) + + if DataManager.EquipData:canUpgradeWeapon(self.heroEntity:getCfgId()) then + self.btnWeapon:addRedPoint(-70, 0, 0.6) + else + self.btnWeapon:removeRedPoint() + end + if DataManager.EquipData:canUpgradeArmor(self.heroEntity:getCfgId()) then + self.btnArmor:addRedPoint(-70, 0, 0.6) + else + self.btnArmor:removeRedPoint() + end end end diff --git a/lua/app/ui/hero/weapon_info_comp.lua b/lua/app/ui/hero/weapon_info_comp.lua index ca429034..1a770dc7 100644 --- a/lua/app/ui/hero/weapon_info_comp.lua +++ b/lua/app/ui/hero/weapon_info_comp.lua @@ -30,6 +30,7 @@ function WeaponInfoComp:init() for i = 1, 2 do self.attr[i] = uiMap["weapon_info.attr_" .. i] end + self.canvasWeapon = self.imgWeapon:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS) self.txDesc1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_4)) self.txDesc2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_5)) @@ -191,7 +192,11 @@ function WeaponInfoComp:playEffect(isUpgrade, isUpSection) -- 常驻特效 local effectIdx = math.ceil(self.weaponEntity:getStage() / 2) if EFFECT_FIX[effectIdx] then - EffectManager:loadUIEffectAsync(EFFECT_FIX[effectIdx], self.uiRoot, self.rootEffect, GConst.UI_EFFECT_ORDER.LEVEL5, function(obj) + EffectManager:loadUIEffectAsync(EFFECT_FIX[effectIdx], self.uiRoot, self.rootEffect, GConst.UI_EFFECT_ORDER.LEVEL1, function(obj) + if self.canvasWeapon and self.uiRoot then + self.canvasWeapon.overrideSorting = true + self.canvasWeapon.sortingOrder = self.uiRoot:getUIOrder() + GConst.UI_EFFECT_ORDER.LEVEL1 + end obj:setIsLoop(true) obj:play() end) diff --git a/lua/app/userdata/equip/equip_data.lua b/lua/app/userdata/equip/equip_data.lua index 1c66beee..b1cc2566 100644 --- a/lua/app/userdata/equip/equip_data.lua +++ b/lua/app/userdata/equip/equip_data.lua @@ -72,6 +72,50 @@ function EquipData:getEquip(id, part) return self.equips[id][part] end +-- 是否有装备可升级 +function EquipData:canUpgradeEquip(heroId) + if self:canUpgradeWeapon(heroId) then + return true + end + + if self:canUpgradeArmor(heroId) then + return true + end + + return false +end + +-- 武器是否可升级 +function EquipData:canUpgradeWeapon(heroId) + if not self:isWeaponOpen() then + return false + end + + local entity = self:getEquip(heroId, GConst.EquipConst.PART_TYPE.WEAPON) + if entity:canLevelUp() then + return true + end + return false +end + +-- 防具是否可升级 +function EquipData:canUpgradeArmor(heroId) + if not self:isArmorOpen() then + return false + end + + local entity + for name, part in pairs(GConst.EquipConst.PART_TYPE) do + entity = self:getEquip(heroId, part) + if part ~= GConst.EquipConst.PART_TYPE.WEAPON then + if entity:canLevelUp() then + return true + end + end + end + return false +end + -- 获取防具最小阶段 function EquipData:getMinArmorStage(heroId) local minStage = -1 diff --git a/lua/app/userdata/equip/equip_entity.lua b/lua/app/userdata/equip/equip_entity.lua index a8385068..4078b9b9 100644 --- a/lua/app/userdata/equip/equip_entity.lua +++ b/lua/app/userdata/equip/equip_entity.lua @@ -215,6 +215,9 @@ function EquipEntity:getAttrDesc() local level = self.cfg.features_level[i] local attr = self.cfg.features_attr[i] local str = I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_3) .. level .. ":".. GFunc.getAttrDesc(attr.type, attr.num) + if self:getPart() ~= GConst.EquipConst.PART_TYPE.WEAPON then + str = I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_26, level) .. GFunc.getAttrDesc(attr.type, attr.num) + end if i < stage + 1 then strAttr = "" .. strAttr.. str .. "\n" else