This commit is contained in:
puxuan 2025-10-09 19:56:15 +08:00
parent 4886eb5bef
commit ab6cea4c86
8 changed files with 98 additions and 83 deletions

View File

@ -147,6 +147,10 @@ function HeroManager:getSkillDesc(skillId)
return cfg and cfg.desc return cfg and cfg.desc
end end
function HeroManager:getHeroSkillDesc(heroId, lv)
return I18N:getText("hero", heroId, "skill_" .. lv)
end
function HeroManager:getSkillIcon(skillId) function HeroManager:getSkillIcon(skillId)
local cfg = ConfigManager:getConfig("skill")[skillId] local cfg = ConfigManager:getConfig("skill")[skillId]
return cfg and tostring(cfg.battle_icon) return cfg and tostring(cfg.battle_icon)

View File

@ -36,7 +36,7 @@ end
-- 显示生命 -- 显示生命
function AttrCell:showHp() function AttrCell:showHp()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_2") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_1")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_HP)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_HP))
local value = 0 local value = 0
@ -61,7 +61,7 @@ end
-- 显示攻击力 -- 显示攻击力
function AttrCell:showAtk() function AttrCell:showAtk()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_1") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_2")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_ATK)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_ATK))
local value = 0 local value = 0
@ -86,7 +86,7 @@ end
-- 显示普攻增伤 -- 显示普攻增伤
function AttrCell:showNormalHurt() function AttrCell:showNormalHurt()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_3") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_3")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT))
local value = 0 local value = 0
@ -102,7 +102,7 @@ end
-- 显示技能增伤 -- 显示技能增伤
function AttrCell:showSkillHurt() function AttrCell:showSkillHurt()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_4") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_4")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT))
local value = 0 local value = 0
@ -118,7 +118,7 @@ end
-- 显示暴击率 -- 显示暴击率
function AttrCell:showCrit() function AttrCell:showCrit()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_5") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_5")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CRIT)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CRIT))
local value = 0 local value = 0
@ -134,7 +134,7 @@ end
-- 显示暴击伤害百分比 -- 显示暴击伤害百分比
function AttrCell:showCritAtk() function AttrCell:showCritAtk()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_6") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_6")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CRIT_TIME)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CRIT_TIME))
local value = 0 local value = 0
@ -150,7 +150,7 @@ end
-- 显示普攻增伤百分比 -- 显示普攻增伤百分比
function AttrCell:showNormalHurtp() function AttrCell:showNormalHurtp()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_3") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_7")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURTP)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURTP))
local value = 0 local value = 0
@ -168,7 +168,7 @@ end
-- 显示技能增伤百分比 -- 显示技能增伤百分比
function AttrCell:showSkillHurtp() function AttrCell:showSkillHurtp()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_4") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_8")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURTP)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURTP))
local value = 0 local value = 0
@ -186,7 +186,7 @@ end
-- 显示治疗效果提升百分比 -- 显示治疗效果提升百分比
function AttrCell:showCured() function AttrCell:showCured()
self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_attribute_7") self.imgIcon:setSprite(GConst.ATLAS_PATH.HERO, "hero_property_9")
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CURED)) self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ATTR_CURED))
local value = 0 local value = 0

View File

@ -4,6 +4,7 @@ function StarCell:init()
local uiMap = self:getUIMap() local uiMap = self:getUIMap()
self.starBg = uiMap["cell.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL) self.starBg = uiMap["cell.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
self.descTx = uiMap["cell.desc_tx"] self.descTx = uiMap["cell.desc_tx"]
self.lockImg = uiMap["cell.lock_img"]
-- self:addClickListener(function() -- self:addClickListener(function()
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKIN_SELECT, self.skinId) -- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKIN_SELECT, self.skinId)
@ -23,13 +24,16 @@ function StarCell:refresh(heroEntity, idx)
else else
self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_8") self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_8")
end end
self.lockImg:setActive(idx > star)
local attr = heroEntity:getStarAttrCfg(idx) local skillStr = ModuleManager.HeroManager:getHeroSkillDesc(self.heroEntity:getCfgId(), idx)
local descTx = GFunc.getAttrDesc(attr.type, attr.num) self.descTx:setText(skillStr)
if not table.containValue(GConst.MATCH_ALL_ATKP_NAME, attr.type) then -- local attr = heroEntity:getStarAttrCfg(idx)
descTx = heroEntity:getName() .. descTx -- local descTx = GFunc.getAttrDesc(attr.type, attr.num)
end -- if not table.containValue(GConst.MATCH_ALL_ATKP_NAME, attr.type) then
self.descTx:setText(descTx) -- descTx = heroEntity:getName() .. descTx
-- end
-- self.descTx:setText(descTx)
end end
return StarCell return StarCell

View File

@ -29,15 +29,16 @@ end
function HeroAttrUI:onLoadRootComplete() function HeroAttrUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren() local uiMap = self.root:genAllChildren()
self.txTitle = uiMap["hero_attr_ui.content.tx_title"] self.root:addClickListener(function()
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.btnClose:addClickListener(function()
self:closeUI() self:closeUI()
end) end)
uiMap["hero_attr_ui.content.btn_close"]:addClickListener(function()
self:closeUI()
end)
self.txTitle = uiMap["hero_attr_ui.content.tx_title"]
self.rootNodes = uiMap["hero_attr_ui.content.ScrollView.Viewport.Content"]
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_18))
end end
function HeroAttrUI:onRefresh() function HeroAttrUI:onRefresh()

View File

@ -55,7 +55,7 @@ function HeroInfoComp:init()
local bg7 = uiMap["hero_info.bg_7"] local bg7 = uiMap["hero_info.bg_7"]
local rect = self.baseObject:getRectSize() local rect = self.baseObject:getRectSize()
bg7:setSizeDeltaY(rect.height - 766 - 286 + 432) bg7:setSizeDeltaY(rect.height - 620)
end end
function HeroInfoComp:setParentUI(parentUI) function HeroInfoComp:setParentUI(parentUI)

View File

@ -12,17 +12,19 @@ function StarInfoComp:init()
self.descTx = uiMap["star_info.upgrade.desc_tx"] self.descTx = uiMap["star_info.upgrade.desc_tx"]
self.upgrade = uiMap["star_info.upgrade"] self.upgrade = uiMap["star_info.upgrade"]
self.bg = uiMap["star_info.bg"] self.bg = uiMap["star_info.bg"]
self.vfx04 = uiMap["star_info.scrollrect.viewport.content.vfx_c1_ui_up_b04"] self.vfx04 = uiMap["star_info.bg.scrollrect.viewport.content.vfx_c1_ui_up_b04"]
self.vfx04:setActive(false) self.vfx04:setActive(false)
self.costCells = {}
for i = 1, 2 do
self.costCells[i] = uiMap["star_info.upgrade.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
end
self.currStarBg = uiMap["star_info.info_node.curr_star_bg"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL) self.costCell = uiMap["star_info.upgrade.reward_cell_1"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
self.nextStarBg = uiMap["star_info.info_node.next_star_bg"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL) -- self.costCells = {}
self.currLvTx = uiMap["star_info.info_node.curr_lv_tx"] -- for i = 1, 2 do
self.nextLvTx = uiMap["star_info.info_node.next_lv_tx"] -- self.costCells[i] = uiMap["star_info.upgrade.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
-- end
-- self.currStarBg = uiMap["star_info.info_node.curr_star_bg"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
-- self.nextStarBg = uiMap["star_info.info_node.next_star_bg"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
-- self.currLvTx = uiMap["star_info.info_node.curr_lv_tx"]
-- self.nextLvTx = uiMap["star_info.info_node.next_lv_tx"]
self.upBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16)) self.upBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16))
self.lvBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_18)) self.lvBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_18))
@ -34,8 +36,8 @@ function StarInfoComp:init()
self.parentUI:changePage(GConst.HeroConst.PANEL_TYPE.HERO) self.parentUI:changePage(GConst.HeroConst.PANEL_TYPE.HERO)
end) end)
self.scrollrect = uiMap["star_info.scrollrect"] self.scrollrect = uiMap["star_info.bg.scrollrect"]
self.scrollRectComp = uiMap["star_info.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) self.scrollRectComp = uiMap["star_info.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRectComp:addInitCallback(function() self.scrollRectComp:addInitCallback(function()
return STAR_CELL return STAR_CELL
end) end)
@ -43,6 +45,9 @@ function StarInfoComp:init()
cell:refresh(self.heroEntity, index, self.starUp) cell:refresh(self.heroEntity, index, self.starUp)
end) end)
self.scrollRectComp:clearCells() self.scrollRectComp:clearCells()
local rect = self.baseObject:getRectSize()
self.bg:setSizeDeltaY(rect.height - 620)
end end
function StarInfoComp:setParentUI(parentUI) function StarInfoComp:setParentUI(parentUI)
@ -59,44 +64,15 @@ end
function StarInfoComp:refresh(starUp) function StarInfoComp:refresh(starUp)
self.starUp = starUp self.starUp = starUp
self:refreshInfo()
self:refreshStarBtn() self:refreshStarBtn()
self:refreshStarInfo() self:refreshStarInfo()
end end
function StarInfoComp:refreshInfo()
if self.heroEntity:getIsStarMax() then
self.currStarBg:setActive(true)
self.nextStarBg:setActive(false)
self.currLvTx:setActive(true)
self.nextLvTx:setActive(false)
local currStar = self.heroEntity:getStar()
self.currStarBg:refresh(currStar)
local lv = self.heroEntity:getMaxLv()
self.currLvTx:setText(lv .. "/" .. lv)
else
self.currStarBg:setActive(true)
self.nextStarBg:setActive(true)
self.currLvTx:setActive(true)
self.nextLvTx:setActive(true)
local currStar = self.heroEntity:getStar()
local nextStar = currStar + 1
self.currStarBg:refresh(currStar, true)
self.nextStarBg:refresh(nextStar)
local lv = self.heroEntity:getLv()
-- local maxLv = self.heroEntity:getCurrMaxLv()
-- local nextMaxLv = self.heroEntity:getNextMaxLv()
-- local lvStr = I18N:getGlobalText(I18N.GlobalConst.ACT_DESC_12)
-- self.currLvTx:setText(lvStr .. "<color=#D82F2D>" .. lv .. "</color>" .. "/" .. maxLv)
-- self.nextLvTx:setText(lvStr .. lv .. "/" .. "<color=#54E845>" .. nextMaxLv .. "</color>")
end
end
function StarInfoComp:refreshStarBtn() function StarInfoComp:refreshStarBtn()
if not self.heroEntity:isActived() or self.heroEntity:getIsStarMax() then if not self.heroEntity:isActived() or self.heroEntity:getIsStarMax() then
self.upgrade:setActive(false) self.upgrade:setActive(false)
self.scrollrect:setSizeDeltaY(378) -- self.scrollrect:setSizeDeltaY(378)
self.bg:setSizeDeltaY(378) -- self.bg:setSizeDeltaY(378)
-- elseif not self.heroEntity:getIsCurLvMax() then -- elseif not self.heroEntity:getIsCurLvMax() then
-- self.upgrade:setActive(true) -- self.upgrade:setActive(true)
-- self.upBtn:setActive(false) -- self.upBtn:setActive(false)
@ -114,16 +90,25 @@ function StarInfoComp:refreshStarBtn()
self.upBtn:setActive(true) self.upBtn:setActive(true)
self.lvBtn:setActive(false) self.lvBtn:setActive(false)
self.descTx:setActive(false) self.descTx:setActive(false)
local materials = self.heroEntity:getStarUpMaterials() -- local materials = self.heroEntity:getStarUpMaterialNum()
local costs = {} -- local costs = {}
costs[1] = {id = self.heroEntity:getFragmentId(), num = materials[1], type = 1} -- costs[1] = {id = self.heroEntity:getFragmentId(), num = materials[1], type = 1}
costs[2] = {id = self.heroEntity:getStarUpCostId(), num = materials[2], type = 1} -- costs[2] = {id = self.heroEntity:getStarUpCostId(), num = materials[2], type = 1}
for i,v in ipairs(self.costCells) do -- for i,v in ipairs(self.costCells) do
v:setActive(true) -- v:setActive(true)
v:refreshByConfig(costs[i]) -- v:refreshByConfig(costs[i])
-- end
-- self.scrollrect:setSizeDeltaY(268)
-- self.bg:setSizeDeltaY(268)
local cost = {id = self.heroEntity:getStarUpCostId(), num = self.heroEntity:getStarUpMaterialNum() or 0, type = 1}
local hadNum = DataManager.BagData.ItemData:getItemNumById(cost.id)
self.costCell:setActive(true)
self.costCell:refreshByConfig(cost)
if hadNum >= cost.num then
self.costCell:setNumTx(hadNum .. "/" .. cost.num)
else
self.costCell:setNumTx("<color=#D82F2D>" .. hadNum .. "</color>" .. "/" .. cost.num)
end end
self.scrollrect:setSizeDeltaY(268)
self.bg:setSizeDeltaY(268)
end end
end end

View File

@ -689,7 +689,7 @@ function HeroEntity:getIsStarMax()
return false return false
end end
function HeroEntity:getStarUpMaterials() function HeroEntity:getStarUpMaterialNum()
local nextLvInfo = ConfigManager:getConfig("hero_star")[self.data.star + 1] local nextLvInfo = ConfigManager:getConfig("hero_star")[self.data.star + 1]
if not nextLvInfo then if not nextLvInfo then
return return
@ -707,12 +707,12 @@ function HeroEntity:canStarUp(showToast)
-- return false, GConst.HeroConst.CHECK_LV_UP_STATE.NEED_LV -- return false, GConst.HeroConst.CHECK_LV_UP_STATE.NEED_LV
-- end -- end
local fragmentCost = self:getStarUpMaterials() local costNum = self:getStarUpMaterialNum()
if not fragmentCost then if not costNum then
return false, GConst.HeroConst.CHECK_LV_UP_STATE.NO_COST return false, GConst.HeroConst.CHECK_LV_UP_STATE.NO_COST
end end
if not GFunc.checkCost(self:getFragmentId(), fragmentCost, showToast) then if not GFunc.checkCost(self:getStarUpCostId(), costNum, showToast) then
return false, GConst.HeroConst.CHECK_LV_UP_STATE.FRAGMENT_NOT_ENOUGH return false, GConst.HeroConst.CHECK_LV_UP_STATE.FRAGMENT_NOT_ENOUGH
end end
-- local itemCost = cost[2] or 0 -- local itemCost = cost[2] or 0
@ -731,7 +731,28 @@ function HeroEntity:onHeroStarUp()
end end
function HeroEntity:getMaxStar() function HeroEntity:getMaxStar()
return #self:getStarAttrCfg() return #self:getStarCfg()
end
function HeroEntity:getStarCfg()
return ConfigManager:getConfig("hero_star")
end
function HeroEntity:getStarUnlockSkillId(star)
local count = 1
while true do
local ids = self.config["rouge_skill_" .. count]
if ids then
for i = #ids, 1, -1 do
if star == ids[i][1] then
return ids[i][2]
end
end
else
break
end
count = count + 1
end
end end
-- endregion -- endregion

View File

@ -665,7 +665,7 @@ function HeroEntity:getIsStarMax()
return false return false
end end
function HeroEntity:getStarUpMaterials() function HeroEntity:getStarUpMaterialNum()
local nextLvInfo = ConfigManager:getConfig("hero_star")[self.data.star + 1] local nextLvInfo = ConfigManager:getConfig("hero_star")[self.data.star + 1]
if not nextLvInfo then if not nextLvInfo then
return return
@ -683,12 +683,12 @@ function HeroEntity:canStarUp(showToast)
-- return false, GConst.HeroConst.CHECK_LV_UP_STATE.NEED_LV -- return false, GConst.HeroConst.CHECK_LV_UP_STATE.NEED_LV
-- end -- end
local fragmentCost = self:getStarUpMaterials() local costNum = self:getStarUpMaterialNum()
if not fragmentCost then if not costNum then
return false, GConst.HeroConst.CHECK_LV_UP_STATE.NO_COST return false, GConst.HeroConst.CHECK_LV_UP_STATE.NO_COST
end end
if not GFunc.checkCost(self:getFragmentId(), fragmentCost, showToast) then if not GFunc.checkCost(self:getStarUpCostId(), costNum, showToast) then
return false, GConst.HeroConst.CHECK_LV_UP_STATE.FRAGMENT_NOT_ENOUGH return false, GConst.HeroConst.CHECK_LV_UP_STATE.FRAGMENT_NOT_ENOUGH
end end
-- local itemCost = cost[2] or 0 -- local itemCost = cost[2] or 0