diff --git a/lua/app/module/hero/hero_const.lua b/lua/app/module/hero/hero_const.lua
index 7be19387..ae6ab2b5 100644
--- a/lua/app/module/hero/hero_const.lua
+++ b/lua/app/module/hero/hero_const.lua
@@ -49,23 +49,6 @@ HeroConst.ATTR_SHOW_BASE = {
GConst.MATCH_HP_NAME, -- 生命
GConst.MATCH_ATTACK_NAME, -- 攻击
}
--- 武器
-HeroConst.ATTR_SHOW_WEAPON = {
- GConst.MATCH_HP_NAME, -- 生命
- GConst.MATCH_ATTACK_NAME, -- 攻击
- GConst.MATCH_CRIT_NAME, -- 暴击率百分比
- GConst.MATCH_CRIT_TIME_NAME, -- 暴击伤害百分比
- GConst.MATCH_CURED_NAME, -- 治疗效果提升百分比
-}
--- 防具
-HeroConst.ATTR_SHOW_ARMOR = {
- GConst.MATCH_HP_NAME, -- 生命
- GConst.MATCH_ATTACK_NAME, -- 攻击
- GConst.MATCH_NORMAL_HURT_NAME, -- 普攻增伤
- GConst.MATCH_SKILL_HURT_NAME, -- 技能增伤
- GConst.MATCH_NORMAL_HURTP_NAME, -- 普攻增伤百分比
- GConst.MATCH_SKILL_HURTP_NAME, -- 技能增伤百分比
-}
-- 皮肤
HeroConst.ATTR_SHOW_SKIN = {
GConst.MATCH_HP_FIX_NAME, -- 生命
@@ -78,26 +61,11 @@ HeroConst.ATTR_SHOW_SKIN = {
GConst.MATCH_SKILL_HURTP_NAME, -- 技能增伤百分比
GConst.MATCH_CURED_NAME, -- 治疗效果提升百分比
}
--- 符文
-HeroConst.ATTR_SHOW_RUNES = {
- GConst.MATCH_HP_FIX_NAME, -- 生命
- GConst.MATCH_ATTACK_NAME, -- 攻击
- GConst.MATCH_NORMAL_HURT_NAME, -- 普攻增伤
- GConst.MATCH_SKILL_HURT_NAME, -- 技能增伤
- GConst.MATCH_CRIT_NAME, -- 暴击率百分比
- GConst.MATCH_CRIT_TIME_NAME, -- 暴击伤害百分比
- GConst.MATCH_NORMAL_HURTP_NAME, -- 普攻增伤百分比
- GConst.MATCH_SKILL_HURTP_NAME, -- 技能增伤百分比
- GConst.MATCH_CURED_NAME, -- 治疗效果提升百分比
-}
-- 需要显示属性的模块
HeroConst.SHOW_NODE = {
HeroConst.ATTR_SHOW_TOTAL,
HeroConst.ATTR_SHOW_BASE,
- HeroConst.ATTR_SHOW_WEAPON,
- HeroConst.ATTR_SHOW_ARMOR,
- HeroConst.ATTR_SHOW_RUNES,
HeroConst.ATTR_SHOW_SKIN,
}
diff --git a/lua/app/ui/common/cell/reward_cell.lua b/lua/app/ui/common/cell/reward_cell.lua
index fd0bdd63..78391fec 100644
--- a/lua/app/ui/common/cell/reward_cell.lua
+++ b/lua/app/ui/common/cell/reward_cell.lua
@@ -149,6 +149,10 @@ function RewardCell:_refreshItem(info, count)
self:showLight(false)
end
+function RewardCell:setIconSprite(atlas, res)
+ self.icon:setSprite(atlas, res)
+end
+
function RewardCell:setNumTx(str)
self.numTx:setText(str)
end
diff --git a/lua/app/ui/hero/cell/attr_cell.lua b/lua/app/ui/hero/cell/attr_cell.lua
index dababd7b..a86494d7 100644
--- a/lua/app/ui/hero/cell/attr_cell.lua
+++ b/lua/app/ui/hero/cell/attr_cell.lua
@@ -1,271 +1,203 @@
local AttrCell = class("AttrCell", BaseCell)
function AttrCell:init()
- local uiMap = self:getUIMap()
+ local uiMap = self:getUIMap()
- self.imgIcon = uiMap["attr_cell.img_icon"]
- self.txDesc = uiMap["attr_cell.tx_desc"]
- self.txValue = uiMap["attr_cell.tx_value"]
+ self.imgIcon = uiMap["attr_cell.img_icon"]
+ self.txDesc = uiMap["attr_cell.tx_desc"]
+ self.txValue = uiMap["attr_cell.tx_value"]
end
function AttrCell:refresh(heroEntity, nodeType, attrType)
- self.heroEntity = heroEntity
- self.runesEntity = self.heroEntity:getRunes()
- self.weaponEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.WEAPON)
- self.hatEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HAT)
- self.clothesEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.CLOTHES)
- self.beltEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.BELT)
- self.handguardEntity = self.heroEntity:getEquips(GConst.EquipConst.PART_TYPE.HANDGUARD)
+ self.heroEntity = heroEntity
+ self.nodeType = nodeType
+ self.attrName = attrType[self.heroEntity:getMatchType()]
- self.nodeType = nodeType
- self.attrName = attrType[self.heroEntity:getMatchType()]
-
- if attrType == GConst.MATCH_HP_NAME or attrType == GConst.MATCH_HP_FIX_NAME then
- self:showHp()
- elseif attrType == GConst.MATCH_ATTACK_NAME then
- self:showAtk()
- elseif attrType == GConst.MATCH_NORMAL_HURT_NAME then
- self:showNormalHurt()
- elseif attrType == GConst.MATCH_SKILL_HURT_NAME then
- self:showSkillHurt()
- elseif attrType == GConst.MATCH_CRIT_NAME then
- self:showCrit()
- elseif attrType == GConst.MATCH_CRIT_TIME_NAME then
- self:showCritAtk()
- elseif attrType == GConst.MATCH_NORMAL_HURTP_NAME then
- self:showNormalHurtp()
- elseif attrType == GConst.MATCH_SKILL_HURTP_NAME then
- self:showSkillHurtp()
- elseif attrType == GConst.MATCH_CURED_NAME then
- self:showCured()
- end
+ if attrType == GConst.MATCH_HP_NAME or attrType == GConst.MATCH_HP_FIX_NAME then
+ self:showHp()
+ elseif attrType == GConst.MATCH_ATTACK_NAME then
+ self:showAtk()
+ elseif attrType == GConst.MATCH_NORMAL_HURT_NAME then
+ self:showNormalHurt()
+ elseif attrType == GConst.MATCH_SKILL_HURT_NAME then
+ self:showSkillHurt()
+ elseif attrType == GConst.MATCH_CRIT_NAME then
+ self:showCrit()
+ elseif attrType == GConst.MATCH_CRIT_TIME_NAME then
+ self:showCritAtk()
+ elseif attrType == GConst.MATCH_NORMAL_HURTP_NAME then
+ self:showNormalHurtp()
+ elseif attrType == GConst.MATCH_SKILL_HURTP_NAME then
+ self:showSkillHurtp()
+ elseif attrType == GConst.MATCH_CURED_NAME then
+ self:showCured()
+ end
end
-- 显示生命
function AttrCell:showHp()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_2")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_HP))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_2")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_HP))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- if self.heroEntity:isActived() then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- else
- value = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv())
- end
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- if self.heroEntity:isActived() then
- value = self.heroEntity:getCfgHp(self.heroEntity:getLv())
- else
- value = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv())
- end
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- value = (self.weaponEntity and self.weaponEntity:getHp() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- value = value + (self.hatEntity and self.hatEntity:getHp() or 0)
- value = value + (self.clothesEntity and self.clothesEntity:getHp() or 0)
- value = value + (self.beltEntity and self.beltEntity:getHp() or 0)
- value = value + (self.handguardEntity and self.handguardEntity:getHp() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getHp(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ if self.heroEntity:isActived() then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ else
+ value = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv())
+ end
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ if self.heroEntity:isActived() then
+ value = self.heroEntity:getCfgHp(self.heroEntity:getLv())
+ else
+ value = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv())
+ end
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getHp(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
-- 显示攻击力
function AttrCell:showAtk()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_1")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_ATK))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_1")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_ATK))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- if self.heroEntity:isActived() then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- else
- value = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv())
- end
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- if self.heroEntity:isActived() then
- value = self.heroEntity:getCfgAtk(self.heroEntity:getLv())
- else
- value = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv())
- end
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- value = (self.weaponEntity and self.weaponEntity:getAttack() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- value = value + (self.hatEntity and self.hatEntity:getAttack() or 0)
- value = value + (self.clothesEntity and self.clothesEntity:getAttack() or 0)
- value = value + (self.beltEntity and self.beltEntity:getAttack() or 0)
- value = value + (self.handguardEntity and self.handguardEntity:getAttack() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getAttack(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ if self.heroEntity:isActived() then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ else
+ value = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv())
+ end
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ if self.heroEntity:isActived() then
+ value = self.heroEntity:getCfgAtk(self.heroEntity:getLv())
+ else
+ value = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv())
+ end
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getAttack(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
-- 显示普攻增伤
function AttrCell:showNormalHurt()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_3")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_3")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- value = value + (self.hatEntity and self.hatEntity:getNormalHurt() or 0)
- value = value + (self.clothesEntity and self.clothesEntity:getNormalHurt() or 0)
- value = value + (self.beltEntity and self.beltEntity:getNormalHurt() or 0)
- value = value + (self.handguardEntity and self.handguardEntity:getNormalHurt() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getNormalHurt(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getNormalHurt(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
-- 显示技能增伤
function AttrCell:showSkillHurt()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_4")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_4")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- value = value + (self.hatEntity and self.hatEntity:getSkillHurt() or 0)
- value = value + (self.clothesEntity and self.clothesEntity:getSkillHurt() or 0)
- value = value + (self.beltEntity and self.beltEntity:getSkillHurt() or 0)
- value = value + (self.handguardEntity and self.handguardEntity:getSkillHurt() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getSkillHurt(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getSkillHurt(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
-- 显示暴击率
function AttrCell:showCrit()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_5")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CRIT))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_5")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CRIT))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- value = (self.weaponEntity and self.weaponEntity:getCritPercent() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getCritPercent(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getCritPercent(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
-- 显示暴击伤害百分比
function AttrCell:showCritAtk()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_6")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CRIT_TIME))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_6")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CRIT_TIME))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- value = (self.weaponEntity and self.weaponEntity:getCritHurtPercent() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getCritHurtPercent(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getCritHurtPercent(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
-- 显示普攻增伤百分比
function AttrCell:showNormalHurtp()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_3")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURTP))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_3")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURTP))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- -- 特殊处理:显示总属性时,普攻百分比和技能百分比把所有伤害百分比加上
- value = value + self.heroEntity:getTotalAttrValue(GConst.MATCH_ALL_HURTP_NAME[self.heroEntity:getMatchType()])
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- -- 套装属性,防具只用计算一次
- value = value + (self.hatEntity and self.hatEntity:getNormalHurtPercent() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getNormalHurtPercent(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ -- 特殊处理:显示总属性时,普攻百分比和技能百分比把所有伤害百分比加上
+ value = value + self.heroEntity:getTotalAttrValue(GConst.MATCH_ALL_HURTP_NAME[self.heroEntity:getMatchType()])
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getNormalHurtPercent(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
-- 显示技能增伤百分比
function AttrCell:showSkillHurtp()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_4")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURTP))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_4")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURTP))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- -- 特殊处理:显示总属性时,普攻百分比和技能百分比把所有伤害百分比加上
- value = value + self.heroEntity:getTotalAttrValue(GConst.MATCH_ALL_HURTP_NAME[self.heroEntity:getMatchType()])
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- -- 套装属性,防具只用计算一次
- value = value + (self.hatEntity and self.hatEntity:getSkillHurtPercent() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getSkillHurtPercent(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ -- 特殊处理:显示总属性时,普攻百分比和技能百分比把所有伤害百分比加上
+ value = value + self.heroEntity:getTotalAttrValue(GConst.MATCH_ALL_HURTP_NAME[self.heroEntity:getMatchType()])
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getSkillHurtPercent(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
-- 显示治疗效果提升百分比
function AttrCell:showCured()
- self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_7")
- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CURED))
+ self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_7")
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CURED))
- local value = 0
- if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
- value = self.heroEntity:getTotalAttrValue(self.attrName)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_WEAPON then
- value = (self.weaponEntity and self.weaponEntity:getHealPercent() or 0)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_ARMOR then
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
- value = value + DataManager.SkinData:getHealPercent(self.heroEntity)
- elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_RUNES then
- value = value + (self.runesEntity and self.runesEntity:getAttrValue(self.attrName) or 0)
- end
+ local value = 0
+ if self.nodeType == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ value = self.heroEntity:getTotalAttrValue(self.attrName)
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_BASE then
+ elseif self.nodeType == GConst.HeroConst.ATTR_SHOW_SKIN then
+ value = value + DataManager.SkinData:getHealPercent(self.heroEntity)
+ end
- self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
+ self.txValue:setText(GFunc.getAttrShowValue(self.attrName, value))
end
return AttrCell
\ No newline at end of file
diff --git a/lua/app/ui/hero/cell/attr_node_cell.lua b/lua/app/ui/hero/cell/attr_node_cell.lua
index 23bddfa1..2b7dcfd4 100644
--- a/lua/app/ui/hero/cell/attr_node_cell.lua
+++ b/lua/app/ui/hero/cell/attr_node_cell.lua
@@ -3,54 +3,44 @@ local ATTR_CELL = "app/ui/hero/cell/attr_cell"
local ATTR_CELL_PATH = "assets/prefabs/ui/hero/cell/attr_cell.prefab"
function AttrNodeCell:init()
- local uiMap = self:getUIMap()
+ local uiMap = self:getUIMap()
- self.txTitle = uiMap["total_node.tx_title"]
- self.itemsRoot = uiMap["total_node.items"]
+ self.txTitle = uiMap["total_node.tx_title"]
+ self.itemsRoot = uiMap["total_node.items"]
end
function AttrNodeCell:refresh(heroEntity, node)
- if node == GConst.HeroConst.ATTR_SHOW_TOTAL then
- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_13))
- elseif node == GConst.HeroConst.ATTR_SHOW_BASE then
- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_14))
- elseif node == GConst.HeroConst.ATTR_SHOW_WEAPON then
- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_15))
- elseif node == GConst.HeroConst.ATTR_SHOW_ARMOR then
- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_16))
- elseif node == GConst.HeroConst.ATTR_SHOW_SKIN then
- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_17))
- elseif node == GConst.HeroConst.ATTR_SHOW_RUNES then
- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_22))
- end
+ if node == GConst.HeroConst.ATTR_SHOW_TOTAL then
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_13))
+ elseif node == GConst.HeroConst.ATTR_SHOW_BASE then
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_14))
+ elseif node == GConst.HeroConst.ATTR_SHOW_SKIN then
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_17))
+ end
- self.attrCount = 0
- for index, attr in ipairs(node) do
- if self:isShowAttr(heroEntity, node, attr) then
- self.attrCount = self.attrCount + 1
- CellManager:loadCellAsync(ATTR_CELL_PATH, ATTR_CELL, self.itemsRoot, function(cell)
- cell:refresh(heroEntity, node, attr)
- end)
- end
- end
+ self.attrCount = 0
+ for index, attr in ipairs(node) do
+ if self:isShowAttr(heroEntity, node, attr) then
+ self.attrCount = self.attrCount + 1
+ CellManager:loadCellAsync(ATTR_CELL_PATH, ATTR_CELL, self.itemsRoot, function(cell)
+ cell:refresh(heroEntity, node, attr)
+ end)
+ end
+ end
end
-- 是否显示属性项
function AttrNodeCell:isShowAttr(heroEntity, node, attr)
- if node == GConst.HeroConst.ATTR_SHOW_SKIN then
- return DataManager.SkinData:hasAttr(heroEntity, attr[heroEntity:getMatchType()])
- end
- if node == GConst.HeroConst.ATTR_SHOW_RUNES then
- local runesEntity = heroEntity:getRunes()
- return runesEntity and runesEntity:hasAttr(attr[heroEntity:getMatchType()]) or false
- end
+ if node == GConst.HeroConst.ATTR_SHOW_SKIN then
+ return DataManager.SkinData:hasAttr(heroEntity, attr[heroEntity:getMatchType()])
+ end
- return true
+ return true
end
--获取节点显示属性个数
function AttrNodeCell:getShowAttrCount()
- return self.attrCount
+ return self.attrCount
end
return AttrNodeCell
\ No newline at end of file
diff --git a/lua/app/ui/hero/hero_attr_ui.lua b/lua/app/ui/hero/hero_attr_ui.lua
index 5218a4f0..559dad04 100644
--- a/lua/app/ui/hero/hero_attr_ui.lua
+++ b/lua/app/ui/hero/hero_attr_ui.lua
@@ -7,11 +7,11 @@ local ATTR_CELL_HEIGHT = 80
local ATTR_CELL_SPACING_Y = 8
function HeroAttrUI:isFullScreen()
- return false
+ return false
end
function HeroAttrUI:getPrefabPath()
- return "assets/prefabs/ui/hero/hero_attr_ui.prefab"
+ return "assets/prefabs/ui/hero/hero_attr_ui.prefab"
end
function HeroAttrUI:onPressBackspace()
@@ -19,58 +19,53 @@ function HeroAttrUI:onPressBackspace()
end
function HeroAttrUI:onClose()
- self.rootNodes:removeAllChildren()
+ self.rootNodes:removeAllChildren()
end
function HeroAttrUI:ctor(parmas)
- self.heroEntity = parmas.heroEntity
+ self.heroEntity = parmas.heroEntity
end
function HeroAttrUI:onLoadRootComplete()
- local uiMap = self.root:genAllChildren()
+ local uiMap = self.root:genAllChildren()
- self.txTitle = uiMap["hero_attr_ui.content.tx_title"]
- self.btnClose = uiMap["hero_attr_ui.content.btn_close"]
- self.rootNodes = uiMap["hero_attr_ui.content.ScrollView.Viewport.Content"]
+ self.txTitle = uiMap["hero_attr_ui.content.tx_title"]
+ self.btnClose = uiMap["hero_attr_ui.content.btn_close"]
+ self.rootNodes = uiMap["hero_attr_ui.content.ScrollView.Viewport.Content"]
- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_18))
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_18))
- self.btnClose:addClickListener(function()
- self:closeUI()
- end)
+ self.btnClose:addClickListener(function()
+ self:closeUI()
+ end)
end
function HeroAttrUI:onRefresh()
- local totalHeight = 0
- for index, node in ipairs(GConst.HeroConst.SHOW_NODE) do
- -- 有皮肤属性时才显示皮肤
- if self:isShowAttr(node) then
- CellManager:loadCellAsync(ATTR_NODE_CELL_PATH, ATTR_NODE_CELL, self.rootNodes, function(cell)
- cell:refresh(self.heroEntity, node)
+ local totalHeight = 0
+ for index, node in ipairs(GConst.HeroConst.SHOW_NODE) do
+ -- 有皮肤属性时才显示皮肤
+ if self:isShowAttr(node) then
+ CellManager:loadCellAsync(ATTR_NODE_CELL_PATH, ATTR_NODE_CELL, self.rootNodes, function(cell)
+ cell:refresh(self.heroEntity, node)
- local attrCount = cell:getShowAttrCount()
- local nodeHeight = math.ceil(attrCount / 2) * ATTR_CELL_HEIGHT + (math.ceil(attrCount / 2) - 1) * ATTR_CELL_SPACING_Y + ATTR_CELLS_PADDING
- cell.baseObject:setLocalPositionY(-totalHeight)
- cell.baseObject:setSizeDeltaY(nodeHeight)
- totalHeight = totalHeight + nodeHeight
- self.rootNodes:setSizeDeltaY(totalHeight)
- end)
- end
- end
- self.rootNodes:setAnchoredPositionY(0)
+ local attrCount = cell:getShowAttrCount()
+ local nodeHeight = math.ceil(attrCount / 2) * ATTR_CELL_HEIGHT + (math.ceil(attrCount / 2) - 1) * ATTR_CELL_SPACING_Y + ATTR_CELLS_PADDING
+ cell.baseObject:setLocalPositionY(-totalHeight)
+ cell.baseObject:setSizeDeltaY(nodeHeight)
+ totalHeight = totalHeight + nodeHeight
+ self.rootNodes:setSizeDeltaY(totalHeight)
+ end)
+ end
+ end
+ self.rootNodes:setAnchoredPositionY(0)
end
-- 是否显示属性块
function HeroAttrUI:isShowAttr(node)
- if node == GConst.HeroConst.ATTR_SHOW_SKIN then
- return #DataManager.SkinData:getOwnAllAttr(self.heroEntity) > 0
- end
- if node == GConst.HeroConst.ATTR_SHOW_RUNES then
- local runesEntity = self.heroEntity:getRunes()
- return runesEntity and runesEntity:getAllAttr() and #runesEntity:getAllAttr() > 0 or false
- end
-
- return true
+ if node == GConst.HeroConst.ATTR_SHOW_SKIN then
+ return #DataManager.SkinData:getOwnAllAttr(self.heroEntity) > 0
+ end
+ return true
end
return HeroAttrUI
\ 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 dd9350c5..23c1d6f5 100644
--- a/lua/app/ui/hero/hero_detail_ui.lua
+++ b/lua/app/ui/hero/hero_detail_ui.lua
@@ -58,10 +58,14 @@ function HeroDetailUI:onLoadRootComplete()
self.txHero1:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
self.txHero2:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
- self.txStar1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
- self.txStar2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
- self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
- self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
+ -- self.txStar1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
+ -- self.txStar2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1))
+ -- self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
+ -- self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2))
+ self.txStar1:setText("升星")
+ self.txStar2:setText("升星")
+ self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
+ self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
if not DataManager.HeroData:isStarOpen() then
self.lockStar:setVisible(true)
GFunc.centerImgAndTx(self.lockStar, self.txStar1, 5)
diff --git a/lua/app/ui/hero/hero_info_comp.lua b/lua/app/ui/hero/hero_info_comp.lua
index 166632a2..d154f425 100644
--- a/lua/app/ui/hero/hero_info_comp.lua
+++ b/lua/app/ui/hero/hero_info_comp.lua
@@ -6,227 +6,234 @@ local SIZE_DELTA_Y_HERO = 942
local SIZE_DELTA_Y_LOOK = 802
function HeroInfoComp:init()
- local uiMap = self:getUIMap()
+ local uiMap = self:getUIMap()
- self.slider = uiMap["hero_detail_ui.bg.fragment_bg.slider"]
- self.imgElement = uiMap["hero_detail_ui.bg.hero_element"]
- self.imgSkill = uiMap["hero_detail_ui.bg.skill_node.skill_icon"]
- self.imgFragment = uiMap["hero_detail_ui.bg.fragment_bg.fragment_icon"]
- self.btnUp = uiMap["hero_detail_ui.bg.up_btn"]
- self.imgUpIcon = uiMap["hero_detail_ui.bg.up_btn.icon"]
- self.txUpdesc = uiMap["hero_detail_ui.bg.up_btn.desc"]
- self.txUpNum = uiMap["hero_detail_ui.bg.up_btn.num"]
- self.txLv = uiMap["hero_detail_ui.bg.lv_desc"]
- self.txElement = uiMap["hero_detail_ui.bg.element_desc"]
- self.txSkill = uiMap["hero_detail_ui.bg.skill_desc"]
- self.btnSkillDesc = uiMap["hero_info.skill_desc.btn_skill_desc"]
- self.txFragmentNum = uiMap["hero_detail_ui.bg.fragment_bg.fragment_num"]
- self.txHpName = uiMap["hero_detail_ui.bg.hp_name"]
- self.txAtkName = uiMap["hero_detail_ui.bg.atk_name"]
- self.txHp = uiMap["hero_detail_ui.bg.hp"]
- self.txAtk = uiMap["hero_detail_ui.bg.atk"]
- self.bgFragment = uiMap["hero_detail_ui.bg.fragment_bg"]
- self.spineObjSkill = uiMap["hero_detail_ui.bg.ui_spine_obj_skill"]
- self.spineObjLv = uiMap["hero_detail_ui.bg.ui_spine_obj_lv"]
- self.spineObj = uiMap["hero_detail_ui.bg.ui_spine_obj"]
- self.spineObjAvatar = uiMap["hero_detail_ui.bg.ui_spine_obj_avatar"]
- self.upgrade = uiMap["hero_info.up"]
- self.bgElement = uiMap["hero_detail_ui.bg.element_bg"]
- self.btnAttr = uiMap["hero_info.bg_6.btn_attr"]
- self.fragmentNode = uiMap["hero_detail_ui.bg.fragment_bg"]
- self.btnSkin = uiMap["hero_info.up.btn_skin"]
- self.txSkin = uiMap["hero_info.up.btn_skin.tx_skin"]
+ self.slider = uiMap["hero_info.fragment_bg.slider"]
+ self.imgElement = uiMap["hero_info.hero_element"]
+ self.imgSkill = uiMap["hero_info.skill_node.skill_icon"]
+ self.imgFragment = uiMap["hero_info.fragment_bg.fragment_icon"]
+ self.btnUp = uiMap["hero_info.up.up_btn"]
+ self.txUpdesc = uiMap["hero_info.up.up_btn.text"]
+ self.btnUp5 = uiMap["hero_info.up.up_5_btn"]
+ self.txUpdesc5 = uiMap["hero_info.up.up_5_btn.text"]
+ self.txLv = uiMap["hero_info.lv_desc"]
+ self.txElement = uiMap["hero_info.element_bg.element_desc"]
+ self.txSkill = uiMap["hero_info.skill_desc"]
+ self.btnSkillDesc = uiMap["hero_info.skill_desc.btn_skill_desc"]
+ self.txFragmentNum = uiMap["hero_info.fragment_bg.fragment_num"]
+ self.txHpName = uiMap["hero_info.bg_6.hp_name"]
+ self.txAtkName = uiMap["hero_info.atk_name"]
+ self.txHp = uiMap["hero_info.bg_6.hp"]
+ self.txAtk = uiMap["hero_info.atk"]
+ self.bgFragment = uiMap["hero_info.fragment_bg"]
+ self.spineObjSkill = uiMap["hero_info.ui_spine_obj_skill"]
+ self.spineObjLv = uiMap["hero_info.ui_spine_obj_lv"]
+ self.spineObj = uiMap["hero_info.ui_spine_obj"]
+ self.spineObjAvatar = uiMap["hero_info.ui_spine_obj_avatar"]
+ self.upgrade = uiMap["hero_info.up"]
+ self.bgElement = uiMap["hero_info.element_bg"]
+ self.btnAttr = uiMap["hero_info.bg_6.btn_attr"]
+ self.fragmentNode = uiMap["hero_info.fragment_bg"]
- self.skill = {}
- self.skillIcon = {}
- self.skillDesc = {}
- for i = 1, 4 do
- self.skill[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i]
- self.skillIcon[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".icon"]
- self.skillDesc[i] = uiMap["hero_detail_ui.bg.skill_up_" .. i .. ".desc"]
- end
+ self.skill = {}
+ self.skillIcon = {}
+ self.skillDesc = {}
+ for i = 1, 4 do
+ self.skill[i] = uiMap["hero_info.skill_up_" .. i]
+ self.skillIcon[i] = uiMap["hero_info.skill_up_" .. i .. ".icon"]
+ self.skillDesc[i] = uiMap["hero_info.skill_up_" .. i .. ".desc"]
+ end
- self.spineObjSkill:setVisible(false)
- self.spineObjLv:setVisible(false)
- self.spineObj:setVisible(false)
- self.txSkin:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
- self.btnSkin:setActive(DataManager.SkinData:isOpen())
+ self.costCells = {}
+ for i = 1, 2 do
+ self.costCells[i] = uiMap["hero_info.up.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
+ end
- self.btnSkin:addClickListener(function()
- ModuleManager.HeroManager:showHeroSkinUI(self.heroEntity:getCfgId())
- end)
- self.btnUp:addClickListener(function()
- ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId(), self.heroEntity)
- end)
- self.btnSkillDesc:addClickListener(function()
- local cfg = ConfigManager:getConfig("skill")[self.heroEntity:getBaseSkill()]
- if cfg.buff_id and #cfg.buff_id > 0 then
- ModuleManager.TipsManager:showSkillTips(self.btnSkillDesc, cfg.buff_id)
- end
- end)
- self.btnAttr:addClickListener(function()
- UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
- end)
- self:bind(DataManager.BagData.ItemData, "dirty", function()
- self:refresh()
- end)
+ self.spineObjSkill:setVisible(false)
+ self.spineObjLv:setVisible(false)
+ self.spineObj:setVisible(false)
+ self.txUpdesc:setText("升1级")
+ self.txUpdesc5:setText("升5级")
+
+ self.btnUp:addClickListener(function()
+ ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId(), self.heroEntity)
+ end)
+ self.btnSkillDesc:addClickListener(function()
+ local cfg = ConfigManager:getConfig("skill")[self.heroEntity:getBaseSkill()]
+ if cfg.buff_id and #cfg.buff_id > 0 then
+ ModuleManager.TipsManager:showSkillTips(self.btnSkillDesc, cfg.buff_id)
+ end
+ end)
+ self.btnAttr:addClickListener(function()
+ UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
+ end)
+ self:bind(DataManager.BagData.ItemData, "dirty", function()
+ self:refresh()
+ end)
end
function HeroInfoComp:setHeroData(heroEntity, onlyLook)
- self.curLevel = heroEntity:getLv()
- self.heroEntity = heroEntity
- self.onlyLook = onlyLook
- self:bind(self.heroEntity, "isDirty", function()
- self:refresh(true)
- end)
+ self.curLevel = heroEntity:getLv()
+ self.heroEntity = heroEntity
+ self.onlyLook = onlyLook
+ self:bind(self.heroEntity, "isDirty", function()
+ self:refresh(true)
+ end)
end
function HeroInfoComp:refresh(checkLevel)
- local isLvChange = checkLevel and self.curLevel ~= self.heroEntity:getLv()
+ local isLvChange = checkLevel and self.curLevel ~= self.heroEntity:getLv()
- self.txLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, self.heroEntity:getLv()))
- local lvTxW = self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
- self.txLv:setSizeDeltaX(lvTxW)
+ self.txLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, self.heroEntity:getLv()))
+ local lvTxW = self.txLv:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
+ self.txLv:setSizeDeltaX(lvTxW)
- self.spineObjAvatar:getSkeletonGraphic().enabled = false
- self.spineObjAvatar:loadAssetAsync(self.heroEntity:getModelId(), function()
- self.spineObjAvatar:getSkeletonGraphic().enabled = true
- self.spineObjAvatar:playAnim("idle", true, true, true)
- end, true)
+ self.spineObjAvatar:getSkeletonGraphic().enabled = false
+ self.spineObjAvatar:loadAssetAsync(self.heroEntity:getModelId(), function()
+ self.spineObjAvatar:getSkeletonGraphic().enabled = true
+ self.spineObjAvatar:playAnim("idle", true, true, true)
+ end, true)
- self.txElement:setText(ModuleManager.HeroManager:getMatchTypeName(self.heroEntity:getMatchType()))
- local elementTxRectWidth = self.txElement:getRectWidth()
- local elementTxWidth = self.txElement:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
- if elementTxWidth > elementTxRectWidth then
- self.bgElement:setSizeDeltaX(52 + elementTxWidth)
- else
- self.bgElement:setSizeDeltaX(52 + elementTxRectWidth)
- end
- self.txSkill:setText(ModuleManager.HeroManager:getSkillDesc(self.heroEntity:getBaseSkill()))
- self.txHpName:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
- self.txAtkName:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
- self.imgSkill:setSprite(GConst.ATLAS_PATH.ICON_SKILL_BIG, ModuleManager.HeroManager:getSkillIcon(self.heroEntity:getBaseSkill()))
- self.imgElement:setSprite(GConst.ATLAS_PATH.HERO, ModuleManager.HeroManager:getMatchTypeIcon(self.heroEntity:getMatchType()))
+ self.txElement:setText(ModuleManager.HeroManager:getMatchTypeName(self.heroEntity:getMatchType()))
+ local elementTxRectWidth = self.txElement:getRectWidth()
+ local elementTxWidth = self.txElement:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
+ if elementTxWidth > elementTxRectWidth then
+ self.bgElement:setSizeDeltaX(52 + elementTxWidth)
+ else
+ self.bgElement:setSizeDeltaX(52 + elementTxRectWidth)
+ end
+ self.txSkill:setText(ModuleManager.HeroManager:getSkillDesc(self.heroEntity:getBaseSkill()))
+ self.txHpName:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
+ self.txAtkName:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
+ self.imgSkill:setSprite(GConst.ATLAS_PATH.ICON_SKILL_BIG, ModuleManager.HeroManager:getSkillIcon(self.heroEntity:getBaseSkill()))
+ self.imgElement:setSprite(GConst.ATLAS_PATH.HERO, ModuleManager.HeroManager:getMatchTypeIcon(self.heroEntity:getMatchType()))
- local materials = self.heroEntity:getLvUpMaterials() or {}
- local fragmentCount = DataManager.BagData.ItemData:getItemNumById(self.heroEntity:getFragmentId())
- local needFragmentCount = materials[1] or 1
- self.txFragmentNum:setText(fragmentCount .. "/" .. needFragmentCount)
+ local materials = self.heroEntity:getLvUpMaterials() or {}
+ local fragmentCount = DataManager.BagData.ItemData:getItemNumById(self.heroEntity:getFragmentId())
+ local needFragmentCount = materials[1] or 1
+ self.txFragmentNum:setText(fragmentCount .. "/" .. needFragmentCount)
- if fragmentCount >= needFragmentCount then
+ if fragmentCount >= needFragmentCount then
self.slider:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_1", nil, self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
else
self.slider:setSprite(GConst.ATLAS_PATH.COMMON, "common_progress_2", nil, self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER))
end
- self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
+ self.slider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = fragmentCount / needFragmentCount
- local skillList = self.heroEntity:getRogueSkillList()
- local lv = self.heroEntity:getLv()
- for i = 1, 4 do
- local skillInfo = skillList[i]
- if skillInfo then
- local skillUnlcokLv = skillInfo[1]
- local skillId = skillInfo[2]
- local skillBg = self.skill[i]
- local skillIcon = self.skillIcon[i]
- local skillLv = self.skillDesc[i]
- local nextLvUp = self.heroEntity:getNextRougeLvUp(i)
- skillBg:addClickListener(function()
- local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
- ModuleManager.TipsManager:showSkillTips(skillIcon, cfg.buff_id, skillId)
- end)
- skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
- skillBg:setTouchEnable(true)
- if skillUnlcokLv > lv then
- -- skillLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, skillLvs[i] or 0))
- skillLv:setText(skillUnlcokLv .. "级解锁")
- skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, "frame_0")
- else
- if nextLvUp then
- skillLv:setText(nextLvUp .. "提升")
- else
- skillLv:setText(GConst.EMPTY_STRING)
- end
- skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueBg(skillId, true))
+ local skillList = self.heroEntity:getRogueSkillList()
+ local lv = self.heroEntity:getLv()
+ for i = 1, 4 do
+ local skillInfo = skillList[i]
+ if skillInfo then
+ local skillUnlcokLv = skillInfo[1]
+ local skillId = skillInfo[2]
+ local skillBg = self.skill[i]
+ local skillIcon = self.skillIcon[i]
+ local skillLv = self.skillDesc[i]
+ local nextLvUp = self.heroEntity:getNextRougeLvUp(i)
+ skillBg:addClickListener(function()
+ local cfg = ConfigManager:getConfig("skill_rogue")[skillId]
+ ModuleManager.TipsManager:showSkillTips(skillIcon, cfg.buff_id, skillId)
+ end)
+ skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueIcon(skillId))
+ skillBg:setTouchEnable(true)
+ if skillUnlcokLv > lv then
+ -- skillLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, skillLvs[i] or 0))
+ skillLv:setText(skillUnlcokLv .. "级解锁")
+ skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, "frame_0")
+ else
+ if nextLvUp then
+ skillLv:setText(nextLvUp .. "提升")
+ else
+ skillLv:setText(GConst.EMPTY_STRING)
+ end
+ skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueBg(skillId, true))
-- if i == activeCount and isLvChange and self.heroEntity:getLv() == skillLvs[i] then
-- local x, y = skillBg:fastGetAnchoredPosition()
-- self.spineObjSkill:setAnchoredPosition(x, y)
-- self.spineObjSkill:setVisible(true)
-- self.spineObjSkill:playAnim("idle", false, true)
-- end
- end
- end
- end
+ end
+ end
+ end
- self.bgFragment:setVisible(not self.heroEntity:isMaxLv())
+ self.bgFragment:setVisible(not self.heroEntity:isMaxLv())
- local canLvUp = self.heroEntity:canLvUp()
+ local canLvUp = self.heroEntity:canLvUp()
self.imgFragment:setVisible(not canLvUp)
- local lv = self.heroEntity:getLv()
- local str
- local hpStr
- local atkStr
- if self.heroEntity:isActived() then
- str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4)
- local curHp = self.heroEntity:getHp() // DEFAULT_FACTOR
- local curAtk = self.heroEntity:getAtk() // DEFAULT_FACTOR
- local addHp = (self.heroEntity:getCfgHp(lv + 1) - self.heroEntity:getCfgHp()) // DEFAULT_FACTOR
- local addAtk = (self.heroEntity:getCfgAtk(lv + 1) - self.heroEntity:getCfgAtk()) // DEFAULT_FACTOR
- if addHp <= 0 then
- hpStr = curHp
- else
- hpStr = curHp .. "+" .. addHp .. ""
- end
- if addAtk <= 0 then
- atkStr = curAtk
- else
- atkStr = curAtk .. "+" .. addAtk .. ""
- end
- else
- str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_5)
- hpStr = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
- atkStr = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
- end
- local costId = self.heroEntity:getLvUpCostId()
- self.imgUpIcon:setSprite(GFunc.getIconRes(costId))
- self.txUpdesc:setText(str)
- self.txUpNum:setText(materials[2])
- self.txHp:setText(hpStr)
- self.txAtk:setText(atkStr)
- if canLvUp then
- self.btnUp:addRedPoint(120, 50, 0.6)
- else
- self.btnUp:removeRedPoint()
- end
+ local lv = self.heroEntity:getLv()
+ local str
+ local hpStr
+ local atkStr
+ if self.heroEntity:isActived() then
+ str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4)
+ local curHp = self.heroEntity:getHp() // DEFAULT_FACTOR
+ local curAtk = self.heroEntity:getAtk() // DEFAULT_FACTOR
+ local addHp = (self.heroEntity:getCfgHp(lv + 1) - self.heroEntity:getCfgHp()) // DEFAULT_FACTOR
+ local addAtk = (self.heroEntity:getCfgAtk(lv + 1) - self.heroEntity:getCfgAtk()) // DEFAULT_FACTOR
+ if addHp <= 0 then
+ hpStr = curHp
+ else
+ hpStr = curHp .. "+" .. addHp .. ""
+ end
+ if addAtk <= 0 then
+ atkStr = curAtk
+ else
+ atkStr = curAtk .. "+" .. addAtk .. ""
+ end
+ else
+ str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_5)
+ hpStr = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
+ atkStr = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
+ end
+ local costs = {}
+ costs[1] = {id = 1, num = materials[1], type = 1}
+ costs[2] = {id = self.heroEntity:getLvUpCostId(), num = materials[2], type = 1}
+ for i,v in ipairs(self.costCells) do
+ v:refreshByConfig(costs[i])
+ end
+ self.costCells[1]:setIconSprite(GConst.ATLAS_PATH.HERO, self.heroEntity:getIcon())
+ -- local costId = self.heroEntity:getLvUpCostId()
+ -- self.imgUpIcon:setSprite(GFunc.getIconRes(costId))
+ -- self.txUpdesc:setText(str)
+ -- self.txUpNum:setText(materials[2])
+ self.txHp:setText(hpStr)
+ self.txAtk:setText(atkStr)
+ if canLvUp then
+ self.btnUp:addRedPoint(70, 40, 0.6)
+ else
+ self.btnUp:removeRedPoint()
+ end
- self.spineObjLv:setVisible(canLvUp)
- if canLvUp then
- self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[1])
- self.spineObjLv:playAnim("animation", true, false)
- else
- self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[2])
- end
- self.btnUp:setTouchEnable(true)
- self.btnUp:setActive(not self.heroEntity:isMaxLv())
+ self.spineObjLv:setVisible(canLvUp)
+ if canLvUp then
+ self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[1])
+ self.spineObjLv:playAnim("animation", true, false)
+ else
+ self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[2])
+ end
+ self.btnUp:setTouchEnable(true)
+ self.btnUp:setActive(not self.heroEntity:isMaxLv())
- if isLvChange then
- self.spineObj:setVisible(true)
- self.spineObj:playAnim("idle", false, true)
- end
+ if isLvChange then
+ self.spineObj:setVisible(true)
+ self.spineObj:playAnim("idle", false, true)
+ end
- if self.onlyLook then -- 仅查看的不显示升级和激活按钮
- self.upgrade:setVisible(false)
- self.baseObject:setSizeDeltaY(SIZE_DELTA_Y_LOOK)
- self.fragmentNode:setVisible(false)
- self.spineObjLv:setVisible(false)
- self.txLv:setAnchoredPositionX(lvTxW / 2)
- else
- self.upgrade:setVisible(true)
- self.baseObject:setSizeDeltaY(SIZE_DELTA_Y_HERO)
- self.txLv:setAnchoredPositionX(-44)
- self.fragmentNode:setVisible(true)
- end
+ if self.onlyLook then -- 仅查看的不显示升级和激活按钮
+ self.upgrade:setVisible(false)
+ self.baseObject:setSizeDeltaY(SIZE_DELTA_Y_LOOK)
+ self.fragmentNode:setVisible(false)
+ self.spineObjLv:setVisible(false)
+ self.txLv:setAnchoredPositionX(lvTxW / 2)
+ else
+ self.upgrade:setVisible(true)
+ self.baseObject:setSizeDeltaY(SIZE_DELTA_Y_HERO)
+ self.txLv:setAnchoredPositionX(-44)
+ self.fragmentNode:setVisible(true)
+ end
end
return HeroInfoComp
\ No newline at end of file