This commit is contained in:
puxuan 2025-08-27 16:09:18 +08:00
parent 7f822a3025
commit 46f972483a
6 changed files with 90 additions and 83 deletions

View File

@ -677,6 +677,7 @@ local LocalizationGlobalConst =
SUMMON_DESC_5 = "SUMMON_DESC_5",
SUMMON_DESC_6 = "SUMMON_DESC_6",
SUMMON_DESC_7 = "SUMMON_DESC_7",
HERO_DESC_21 = "HERO_DESC_21",
}
return LocalizationGlobalConst

View File

@ -677,6 +677,7 @@ local localization_global =
["SUMMON_DESC_5"] = "[普通召唤]没有保底次数",
["SUMMON_DESC_6"] = "普通召唤",
["SUMMON_DESC_7"] = "高级召唤",
["HERO_DESC_21"] = "等级达到{0}可升星",
}
return localization_global

View File

@ -162,11 +162,21 @@ function HeroInfoComp:refresh(checkLevel)
-- 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)
if not self.heroEntity:isActived() then
hpStr = self.heroEntity:getCfgHp(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
atkStr = self.heroEntity:getCfgAtk(self.heroEntity:getBeginLv()) // DEFAULT_FACTOR
self.btnUp:setActive(false)
self.btnUp5:setActive(false)
self.gotoBtn:setActive(false)
self.needStarNode:setActive(false)
for i,v in ipairs(self.costCells) do
v:setActive(false)
end
self.upgrade:setVisible(false)
else
self.upgrade:setVisible(not self.onlyLook)
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
@ -181,76 +191,71 @@ function HeroInfoComp:refresh(checkLevel)
else
atkStr = curAtk .. "<color=#A2FF29>+" .. addAtk .. "</color>"
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 self.heroEntity:isMaxLv() then
self.btnUp:setActive(false)
self.btnUp5:setActive(false)
self.gotoBtn:setActive(false)
self.needStarNode:setActive(false)
elseif lv >= nextLv then
self.btnUp:setActive(false)
self.btnUp5:setActive(false)
self.gotoBtn:setActive(true)
self.needStarNode:setActive(true)
local star = self.heroEntity:getStar()
local currStar = star%5 + 1
self.needStarNodeDescTx1:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_19, currStar))
local meshProComp = self.needStarNodeDescTx1:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
local contentWidth = meshProComp.preferredWidth
self.needStarNodeDescTx1:setSizeDeltaX(contentWidth)
self.needStarNode:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
local starType = math.ceil(currStar / 5)
self.needStarNodeStarImg:setSprite(GFunc.getStarImg(starType))
if self.heroEntity:isMaxLv() then
self.btnUp:setActive(false)
self.btnUp5:setActive(false)
self.gotoBtn:setActive(false)
self.needStarNode:setActive(false)
for i,v in ipairs(self.costCells) do
v:setActive(false)
end
elseif lv >= nextLv then
self.btnUp:setActive(false)
self.btnUp5:setActive(false)
self.gotoBtn:setActive(true)
self.needStarNode:setActive(true)
local star = self.heroEntity:getStar()
local currStar = star%5 + 1
self.needStarNodeDescTx1:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_19, currStar))
local meshProComp = self.needStarNodeDescTx1:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
local contentWidth = meshProComp.preferredWidth
self.needStarNodeDescTx1:setSizeDeltaX(contentWidth)
self.needStarNode:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
local starType = math.ceil(currStar / 5)
self.needStarNodeStarImg:setSprite(GFunc.getStarImg(starType))
for i,v in ipairs(self.costCells) do
v:setActive(false)
end
else
self.btnUp:setActive(true)
self.btnUp5:setActive(true)
self.gotoBtn:setActive(false)
self.needStarNode:setActive(false)
for i,v in ipairs(self.costCells) do
v:setActive(false)
end
else
self.btnUp:setActive(true)
self.btnUp5:setActive(true)
self.gotoBtn:setActive(false)
self.needStarNode:setActive(false)
local costs = {}
costs[1] = {id = self.heroEntity:getFragmentId(), num = materials[1], type = 1}
costs[2] = {id = self.heroEntity:getLvUpCostId(), num = materials[2], type = 1}
local hadNums = {DataManager.BagData.ItemData:getItemNumById(costs[1].id), DataManager.BagData.ItemData:getItemNumById(costs[2].id)}
for i,v in ipairs(self.costCells) do
v:setActive(true)
v:refreshByConfig(costs[i])
if hadNums[i] >= costs[i].num then
v:setNumTx(hadNums[i] .. "/" .. costs[i].num)
local costs = {}
costs[1] = {id = self.heroEntity:getFragmentId(), num = materials[1], type = 1}
costs[2] = {id = self.heroEntity:getLvUpCostId(), num = materials[2], type = 1}
local hadNums = {DataManager.BagData.ItemData:getItemNumById(costs[1].id), DataManager.BagData.ItemData:getItemNumById(costs[2].id)}
for i,v in ipairs(self.costCells) do
v:setActive(true)
v:refreshByConfig(costs[i])
if hadNums[i] >= costs[i].num then
v:setNumTx(hadNums[i] .. "/" .. costs[i].num)
else
v:setNumTx("<color=#D82F2D>" .. hadNums[i] .. "</color>" .. "/" .. costs[i].num)
end
end
if canLvUp then
self.btnUp:setTouchEnable(true)
self.btnUp5:setTouchEnable(true)
self.btnUp:addRedPoint(70, 30, 1)
self.btnUp5:addRedPoint(70, 30, 1)
self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[1])
self.btnUp5:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[2])
else
v:setNumTx("<color=#D82F2D>" .. hadNums[i] .. "</color>" .. "/" .. costs[i].num)
self.btnUp:setTouchEnable(false)
self.btnUp5:setTouchEnable(false)
self.btnUp:removeRedPoint()
self.btnUp5:removeRedPoint()
self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[3])
self.btnUp5:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[3])
end
end
if canLvUp then
self.btnUp:setTouchEnable(true)
self.btnUp5:setTouchEnable(true)
self.btnUp:addRedPoint(70, 30, 1)
self.btnUp5:addRedPoint(70, 30, 1)
self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[1])
self.btnUp5:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[2])
else
self.btnUp:setTouchEnable(false)
self.btnUp5:setTouchEnable(false)
self.btnUp:removeRedPoint()
self.btnUp5:removeRedPoint()
self.btnUp:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[3])
self.btnUp5:setSprite(GConst.ATLAS_PATH.COMMON, BTN_ICON[3])
end
end
self.txHp:setText(hpStr)
self.txAtk:setText(atkStr)
-- self.needStarNode = uiMap["hero_info.up.need_star_node"]
-- self.needStarNodeDescTx1 = uiMap["hero_info.up.need_star_node.desc_tx_1"]
-- self.needStarNodeStarImg = uiMap["hero_info.up.need_star_node.star_img"]
@ -261,8 +266,6 @@ function HeroInfoComp:refresh(checkLevel)
self.spineObj:playAnim("idle", false, true)
end
self.upgrade:setVisible(not self.onlyLook)
local needPop, isUnlock, skillIdx = self.heroEntity:checkSkillUnlock()
if needPop then
local skillInfo = skillList[skillIdx]

View File

@ -10,6 +10,8 @@ function StarInfoComp:init()
self.lvBtn = uiMap["star_info.upgrade.lv_btn"]
self.lvBtnTx = uiMap["star_info.upgrade.lv_btn.text"]
self.descTx = uiMap["star_info.upgrade.desc_tx"]
self.upgrade = uiMap["star_info.upgrade"]
self.bg = uiMap["star_info.bg"]
self.costCells = {}
for i = 1, 2 do
self.costCells[i] = uiMap["star_info.upgrade.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
@ -31,6 +33,7 @@ function StarInfoComp:init()
self.parentUI:changePage(GConst.HeroConst.PANEL_TYPE.HERO)
end)
self.scrollrect = uiMap["star_info.scrollrect"]
self.scrollRectComp = uiMap["star_info.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRectComp:addInitCallback(function()
return STAR_CELL
@ -89,13 +92,11 @@ end
function StarInfoComp:refreshStarBtn()
if not self.heroEntity:isActived() or self.heroEntity:getIsStarMax() then
self.upBtn:setActive(false)
self.lvBtn:setActive(false)
self.descTx:setActive(false)
for i,v in ipairs(self.costCells) do
v:setActive(false)
end
self.upgrade:setActive(false)
self.scrollrect:setSizeDeltaY(378)
self.bg:setSizeDeltaY(378)
elseif not self.heroEntity:getIsCurLvMax() then
self.upgrade:setActive(true)
self.upBtn:setActive(false)
self.lvBtn:setActive(true)
self.descTx:setActive(true)
@ -103,8 +104,11 @@ function StarInfoComp:refreshStarBtn()
v:setActive(false)
end
local nextLv = self.heroEntity:getNextLv()
self.descTx:setText("等级达到" .. nextLv .. "可升星")
self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_21, nextLv))
self.scrollrect:setSizeDeltaY(268)
self.bg:setSizeDeltaY(268)
else
self.upgrade:setActive(true)
self.upBtn:setActive(true)
self.lvBtn:setActive(false)
self.descTx:setActive(false)
@ -116,6 +120,8 @@ function StarInfoComp:refreshStarBtn()
v:setActive(true)
v:refreshByConfig(costs[i])
end
self.scrollrect:setSizeDeltaY(268)
self.bg:setSizeDeltaY(268)
end
end

View File

@ -45,11 +45,11 @@ end
function ItemEntity:checkForceLockAndAddNum()
local type = self:getItemType()
if type == GConst.ItemConst.ITEM_TYPE.HERO_FRAGMENT then
local isOwn = DataManager.HeroData:getHeroIsUnlock(self:getId())
local heroEntity = DataManager.HeroData:getHeroById(self:getId())
-- local qlt = DataManager.HeroData:getHeroQlt(self:getId())
-- local fragmentId = DataManager.ForceData:getForceItemIdByQlt(self:getId())
if not isOwn then
DataManager.HeroData:onHeroUnlock(self:getId())
if heroEntity:getLv() <= 0 then
heroEntity:setLv(1 ,true)
-- BIReport:postForceUnlock(self:getId())
end
-- 不转换万能碎片

View File

@ -74,10 +74,6 @@ function HeroData:getHeroById(id)
return self.heroes[id]
end
function HeroData:onHeroUnlock(id)
self:addHero({id = id, level = 1, skin = 0, star = 0})
end
function HeroData:getAllHeroes()
return self.heroes
end