装备红点、文案

This commit is contained in:
Fang 2023-07-26 15:14:44 +08:00
parent 52bc10db15
commit a80e0b5e90
6 changed files with 77 additions and 2 deletions

View File

@ -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

View File

@ -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
-- 播放部位升级动效

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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 = "<color=#EEDFFF>" .. strAttr.. str .. "\n</color>"
else