From ab6cea4c861e02fa8de52895cc5c417649df6d29 Mon Sep 17 00:00:00 2001
From: puxuan <413323644@qq.com>
Date: Thu, 9 Oct 2025 19:56:15 +0800
Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E6=98=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lua/app/module/hero/hero_manager.lua | 4 +
lua/app/ui/hero/cell/attr_cell.lua | 18 ++---
lua/app/ui/hero/cell/star_info_cell.lua | 16 ++--
lua/app/ui/hero/hero_attr_ui.lua | 15 ++--
lua/app/ui/hero/hero_info_comp.lua | 2 +-
lua/app/ui/hero/star_info_comp.lua | 87 +++++++++------------
lua/app/userdata/hero/hero_entity.lua | 31 ++++++--
lua/app/userdata/hero/hero_entity_other.lua | 8 +-
8 files changed, 98 insertions(+), 83 deletions(-)
diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua
index 8c06102e..b19f56fa 100644
--- a/lua/app/module/hero/hero_manager.lua
+++ b/lua/app/module/hero/hero_manager.lua
@@ -147,6 +147,10 @@ function HeroManager:getSkillDesc(skillId)
return cfg and cfg.desc
end
+function HeroManager:getHeroSkillDesc(heroId, lv)
+ return I18N:getText("hero", heroId, "skill_" .. lv)
+end
+
function HeroManager:getSkillIcon(skillId)
local cfg = ConfigManager:getConfig("skill")[skillId]
return cfg and tostring(cfg.battle_icon)
diff --git a/lua/app/ui/hero/cell/attr_cell.lua b/lua/app/ui/hero/cell/attr_cell.lua
index a86494d7..8cb1664d 100644
--- a/lua/app/ui/hero/cell/attr_cell.lua
+++ b/lua/app/ui/hero/cell/attr_cell.lua
@@ -36,7 +36,7 @@ end
-- 显示生命
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))
local value = 0
@@ -61,7 +61,7 @@ end
-- 显示攻击力
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))
local value = 0
@@ -86,7 +86,7 @@ end
-- 显示普攻增伤
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))
local value = 0
@@ -102,7 +102,7 @@ end
-- 显示技能增伤
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))
local value = 0
@@ -118,7 +118,7 @@ end
-- 显示暴击率
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))
local value = 0
@@ -134,7 +134,7 @@ end
-- 显示暴击伤害百分比
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))
local value = 0
@@ -150,7 +150,7 @@ end
-- 显示普攻增伤百分比
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))
local value = 0
@@ -168,7 +168,7 @@ end
-- 显示技能增伤百分比
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))
local value = 0
@@ -186,7 +186,7 @@ end
-- 显示治疗效果提升百分比
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))
local value = 0
diff --git a/lua/app/ui/hero/cell/star_info_cell.lua b/lua/app/ui/hero/cell/star_info_cell.lua
index 97ce979d..44d8efc7 100644
--- a/lua/app/ui/hero/cell/star_info_cell.lua
+++ b/lua/app/ui/hero/cell/star_info_cell.lua
@@ -4,6 +4,7 @@ function StarCell:init()
local uiMap = self:getUIMap()
self.starBg = uiMap["cell.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
self.descTx = uiMap["cell.desc_tx"]
+ self.lockImg = uiMap["cell.lock_img"]
-- self:addClickListener(function()
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKIN_SELECT, self.skinId)
@@ -23,13 +24,16 @@ function StarCell:refresh(heroEntity, idx)
else
self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_8")
end
+ self.lockImg:setActive(idx > star)
- local attr = heroEntity:getStarAttrCfg(idx)
- local descTx = GFunc.getAttrDesc(attr.type, attr.num)
- if not table.containValue(GConst.MATCH_ALL_ATKP_NAME, attr.type) then
- descTx = heroEntity:getName() .. descTx
- end
- self.descTx:setText(descTx)
+ local skillStr = ModuleManager.HeroManager:getHeroSkillDesc(self.heroEntity:getCfgId(), idx)
+ self.descTx:setText(skillStr)
+ -- local attr = heroEntity:getStarAttrCfg(idx)
+ -- local descTx = GFunc.getAttrDesc(attr.type, attr.num)
+ -- if not table.containValue(GConst.MATCH_ALL_ATKP_NAME, attr.type) then
+ -- descTx = heroEntity:getName() .. descTx
+ -- end
+ -- self.descTx:setText(descTx)
end
return StarCell
\ 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 89da6136..8306c149 100644
--- a/lua/app/ui/hero/hero_attr_ui.lua
+++ b/lua/app/ui/hero/hero_attr_ui.lua
@@ -29,15 +29,16 @@ end
function HeroAttrUI:onLoadRootComplete()
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:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_18))
-
- self.btnClose:addClickListener(function()
+ self.root:addClickListener(function()
self:closeUI()
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
function HeroAttrUI:onRefresh()
diff --git a/lua/app/ui/hero/hero_info_comp.lua b/lua/app/ui/hero/hero_info_comp.lua
index d9c5b174..c77b48aa 100644
--- a/lua/app/ui/hero/hero_info_comp.lua
+++ b/lua/app/ui/hero/hero_info_comp.lua
@@ -55,7 +55,7 @@ function HeroInfoComp:init()
local bg7 = uiMap["hero_info.bg_7"]
local rect = self.baseObject:getRectSize()
- bg7:setSizeDeltaY(rect.height - 766 - 286 + 432)
+ bg7:setSizeDeltaY(rect.height - 620)
end
function HeroInfoComp:setParentUI(parentUI)
diff --git a/lua/app/ui/hero/star_info_comp.lua b/lua/app/ui/hero/star_info_comp.lua
index ceb214e6..91d02a32 100644
--- a/lua/app/ui/hero/star_info_comp.lua
+++ b/lua/app/ui/hero/star_info_comp.lua
@@ -12,17 +12,19 @@ function StarInfoComp:init()
self.descTx = uiMap["star_info.upgrade.desc_tx"]
self.upgrade = uiMap["star_info.upgrade"]
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.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.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.costCell = uiMap["star_info.upgrade.reward_cell_1"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
+ -- 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.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.lvBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_18))
@@ -34,8 +36,8 @@ 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.scrollrect = uiMap["star_info.bg.scrollrect"]
+ self.scrollRectComp = uiMap["star_info.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRectComp:addInitCallback(function()
return STAR_CELL
end)
@@ -43,6 +45,9 @@ function StarInfoComp:init()
cell:refresh(self.heroEntity, index, self.starUp)
end)
self.scrollRectComp:clearCells()
+
+ local rect = self.baseObject:getRectSize()
+ self.bg:setSizeDeltaY(rect.height - 620)
end
function StarInfoComp:setParentUI(parentUI)
@@ -59,44 +64,15 @@ end
function StarInfoComp:refresh(starUp)
self.starUp = starUp
- self:refreshInfo()
self:refreshStarBtn()
self:refreshStarInfo()
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 .. "" .. lv .. "" .. "/" .. maxLv)
- -- self.nextLvTx:setText(lvStr .. lv .. "/" .. "" .. nextMaxLv .. "")
- end
-end
-
function StarInfoComp:refreshStarBtn()
if not self.heroEntity:isActived() or self.heroEntity:getIsStarMax() then
self.upgrade:setActive(false)
- self.scrollrect:setSizeDeltaY(378)
- self.bg:setSizeDeltaY(378)
+ -- self.scrollrect:setSizeDeltaY(378)
+ -- self.bg:setSizeDeltaY(378)
-- elseif not self.heroEntity:getIsCurLvMax() then
-- self.upgrade:setActive(true)
-- self.upBtn:setActive(false)
@@ -114,16 +90,25 @@ function StarInfoComp:refreshStarBtn()
self.upBtn:setActive(true)
self.lvBtn:setActive(false)
self.descTx:setActive(false)
- local materials = self.heroEntity:getStarUpMaterials()
- local costs = {}
- costs[1] = {id = self.heroEntity:getFragmentId(), num = materials[1], type = 1}
- costs[2] = {id = self.heroEntity:getStarUpCostId(), num = materials[2], type = 1}
- for i,v in ipairs(self.costCells) do
- v:setActive(true)
- v:refreshByConfig(costs[i])
+ -- local materials = self.heroEntity:getStarUpMaterialNum()
+ -- local costs = {}
+ -- costs[1] = {id = self.heroEntity:getFragmentId(), num = materials[1], type = 1}
+ -- costs[2] = {id = self.heroEntity:getStarUpCostId(), num = materials[2], type = 1}
+ -- for i,v in ipairs(self.costCells) do
+ -- v:setActive(true)
+ -- 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("" .. hadNum .. "" .. "/" .. cost.num)
end
- self.scrollrect:setSizeDeltaY(268)
- self.bg:setSizeDeltaY(268)
end
end
diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua
index 10cfdc2b..6e33dcbe 100644
--- a/lua/app/userdata/hero/hero_entity.lua
+++ b/lua/app/userdata/hero/hero_entity.lua
@@ -689,7 +689,7 @@ function HeroEntity:getIsStarMax()
return false
end
-function HeroEntity:getStarUpMaterials()
+function HeroEntity:getStarUpMaterialNum()
local nextLvInfo = ConfigManager:getConfig("hero_star")[self.data.star + 1]
if not nextLvInfo then
return
@@ -707,12 +707,12 @@ function HeroEntity:canStarUp(showToast)
-- return false, GConst.HeroConst.CHECK_LV_UP_STATE.NEED_LV
-- end
- local fragmentCost = self:getStarUpMaterials()
- if not fragmentCost then
+ local costNum = self:getStarUpMaterialNum()
+ if not costNum then
return false, GConst.HeroConst.CHECK_LV_UP_STATE.NO_COST
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
end
-- local itemCost = cost[2] or 0
@@ -731,7 +731,28 @@ function HeroEntity:onHeroStarUp()
end
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
-- endregion
diff --git a/lua/app/userdata/hero/hero_entity_other.lua b/lua/app/userdata/hero/hero_entity_other.lua
index 3cdc0af5..22eb0ef3 100644
--- a/lua/app/userdata/hero/hero_entity_other.lua
+++ b/lua/app/userdata/hero/hero_entity_other.lua
@@ -665,7 +665,7 @@ function HeroEntity:getIsStarMax()
return false
end
-function HeroEntity:getStarUpMaterials()
+function HeroEntity:getStarUpMaterialNum()
local nextLvInfo = ConfigManager:getConfig("hero_star")[self.data.star + 1]
if not nextLvInfo then
return
@@ -683,12 +683,12 @@ function HeroEntity:canStarUp(showToast)
-- return false, GConst.HeroConst.CHECK_LV_UP_STATE.NEED_LV
-- end
- local fragmentCost = self:getStarUpMaterials()
- if not fragmentCost then
+ local costNum = self:getStarUpMaterialNum()
+ if not costNum then
return false, GConst.HeroConst.CHECK_LV_UP_STATE.NO_COST
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
end
-- local itemCost = cost[2] or 0