From 22ba335f3611c3dde897ce301aab4b84ac5007a4 Mon Sep 17 00:00:00 2001
From: puxuan <413323644@qq.com>
Date: Thu, 26 Jun 2025 21:33:39 +0800
Subject: [PATCH] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lua/app/global/global_const.lua | 1 +
lua/app/global/global_func.lua | 9 +
lua/app/ui/hero/cell/star_cell.lua | 38 +--
lua/app/ui/hero/cell/star_info_cell.lua | 35 +++
lua/app/ui/hero/cell/star_info_cell.lua.meta | 10 +
lua/app/ui/hero/hero_detail_ui.lua | 253 ++++++++++---------
lua/app/ui/hero/hero_info_comp.lua | 5 +-
lua/app/ui/hero/star_info_comp.lua | 48 +---
lua/app/userdata/hero/hero_entity.lua | 2 +-
9 files changed, 216 insertions(+), 185 deletions(-)
create mode 100644 lua/app/ui/hero/cell/star_info_cell.lua
create mode 100644 lua/app/ui/hero/cell/star_info_cell.lua.meta
diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua
index fb6122d8..f8e3b0d7 100644
--- a/lua/app/global/global_const.lua
+++ b/lua/app/global/global_const.lua
@@ -174,6 +174,7 @@ GConst.TYPEOF_LUA_CLASS = {
SCROLL_RECT_CENTER = "app/ui/common/scrollrect/scrollrect_center",
SCROLL_RECT_OLD = "app/ui/common/scrollrect/scrollrect_old",
BASE_CELL = "app/ui/common/cell/base_cell",
+ STAR_CELL = "app/ui/hero/cell/star_cell",
-- 引导
TUTORIAL_UI = "app/ui/tutorial/tutorial_ui",
diff --git a/lua/app/global/global_func.lua b/lua/app/global/global_func.lua
index 81584e7a..66ae2a2c 100644
--- a/lua/app/global/global_func.lua
+++ b/lua/app/global/global_func.lua
@@ -1954,6 +1954,15 @@ function GFunc.getStarImg(starType)
end
end
+function GFunc.getHeroQltImg(qlt)
+ return GConst.ATLAS_PATH.HERO, "hero_quality_" .. qlt
+end
+
+
+function GFunc.getHeroQltStr(qlt)
+ return I18N:getGlobalText("QLT_DESC_" .. qlt)
+end
+
-- 获取计算了加成的最终属性值(全部属性,固定属性id,加成属性id)
function GFunc.getFinalAttrValue(allAttrs, fixedId, factorId)
local fixedValue = allAttrs[fixedId] or 0
diff --git a/lua/app/ui/hero/cell/star_cell.lua b/lua/app/ui/hero/cell/star_cell.lua
index 5ba0ee52..c387d843 100644
--- a/lua/app/ui/hero/cell/star_cell.lua
+++ b/lua/app/ui/hero/cell/star_cell.lua
@@ -2,48 +2,28 @@ local StarCell = class("StarCell", BaseCell)
function StarCell:init()
local uiMap = self:getUIMap()
- self.starBg = uiMap["cell.star_bg"]
- self.descTx = uiMap["cell.desc_tx"]
self.starImgs = {}
for i = 1, 5 do
- self.starImgs[i] = uiMap["cell.star_bg.star_img_" .. i]
+ self.starImgs[i] = uiMap["star_cell.star_img_" .. i]
end
-
- -- self:addClickListener(function()
- -- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKIN_SELECT, self.skinId)
- -- end)
end
-function StarCell:refresh(heroEntity, idx)
- self.heroEntity = heroEntity
- if not self.heroEntity then
- return
- end
-
- local star = self.heroEntity:getStar()
- local starType = math.ceil(idx / 5)
+function StarCell:refresh(currStar)
+ local starType = math.ceil(currStar / 5)
for i, v in ipairs(self.starImgs) do
- local star = (idx - 1)%5 + 1
- if i <= star then
+ local star = (currStar - 1)%5 + 1
+ if currStar > 0 and i <= star then
v:setActive(true)
v:setSprite(GFunc.getStarImg(starType))
else
v:setActive(false)
end
end
- if idx <= star then
- self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_board_quality_3")
- else
- self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_board_quality_2")
- end
- self.starBg:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
+ self.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
+end
- 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)
+function StarCell:setActive(active)
+ self.baseObject:setActive(active)
end
return StarCell
\ No newline at end of file
diff --git a/lua/app/ui/hero/cell/star_info_cell.lua b/lua/app/ui/hero/cell/star_info_cell.lua
new file mode 100644
index 00000000..97ce979d
--- /dev/null
+++ b/lua/app/ui/hero/cell/star_info_cell.lua
@@ -0,0 +1,35 @@
+local StarCell = class("StarCell", BaseCell)
+
+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:addClickListener(function()
+ -- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKIN_SELECT, self.skinId)
+ -- end)
+end
+
+function StarCell:refresh(heroEntity, idx)
+ self.heroEntity = heroEntity
+ if not self.heroEntity then
+ return
+ end
+
+ local star = self.heroEntity:getStar()
+ self.starBg:refresh(idx)
+ if idx <= star then
+ self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_7")
+ else
+ self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_8")
+ end
+
+ 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/cell/star_info_cell.lua.meta b/lua/app/ui/hero/cell/star_info_cell.lua.meta
new file mode 100644
index 00000000..a769c6d7
--- /dev/null
+++ b/lua/app/ui/hero/cell/star_info_cell.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 3a141fca655a34a979f4697d7ee4b52a
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua
index ef642968..e921a827 100644
--- a/lua/app/ui/hero/hero_detail_ui.lua
+++ b/lua/app/ui/hero/hero_detail_ui.lua
@@ -18,7 +18,7 @@ function HeroDetailUI:onPressBackspace()
end
function HeroDetailUI:ctor(parmas)
- self.panelType = parmas.panelType or GConst.HeroConst.PANEL_TYPE.HERO
+ self.page = parmas.panelType or GConst.HeroConst.PANEL_TYPE.HERO
self.formationType = parmas.formationType
self.onlyLook = parmas.onlyLook
if parmas.heroEntity then
@@ -27,34 +27,38 @@ function HeroDetailUI:ctor(parmas)
local heroId = parmas.heroId
self.heroEntity = DataManager.HeroData:getHeroById(heroId)
end
+ self:initList()
end
function HeroDetailUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
+ uiMap["hero_detail_ui.common.close_btn"]:addClickListener(function()
+ self:closeUI()
+ end)
+
-- self.commonInfo = uiMap["hero_detail_ui.common"]
self.heroInfo = uiMap["hero_detail_ui.hero_info"]
self.starInfo = uiMap["hero_detail_ui.star_info"]
self.skinInfo = uiMap["hero_detail_ui.skin_info"]
self.titleTx = uiMap["hero_detail_ui.common.name_tx"]
- self.closeBtn = uiMap["hero_detail_ui.common.close_btn"]
self.bg = uiMap["hero_detail_ui.common.bg"]
- self.btnHero = uiMap["hero_detail_ui.common.btns.btn_hero"]
- self.txHero1 = uiMap["hero_detail_ui.common.btns.btn_hero.tx_btn"]
- self.selectHero = uiMap["hero_detail_ui.common.btns.btn_hero.select"]
- self.txHero2 = uiMap["hero_detail_ui.common.btns.btn_hero.select.tx_select"]
- self.btnStar = uiMap["hero_detail_ui.common.btns.btn_star"]
- self.lockStar = uiMap["hero_detail_ui.common.btns.btn_star.content.img_lock"]
- self.txStar1 = uiMap["hero_detail_ui.common.btns.btn_star.content.tx_btn"]
- self.selectStar = uiMap["hero_detail_ui.common.btns.btn_star.select"]
- self.txStar2 = uiMap["hero_detail_ui.common.btns.btn_star.select.tx_select"]
- self.btnSkin = uiMap["hero_detail_ui.common.btns.btn_skin"]
- self.lockSkin = uiMap["hero_detail_ui.common.btns.btn_skin.content.img_lock"]
- self.txSkin1 = uiMap["hero_detail_ui.common.btns.btn_skin.content.tx_btn"]
- self.selectSkin = uiMap["hero_detail_ui.common.btns.btn_skin.select"]
- self.txSkin2 = uiMap["hero_detail_ui.common.btns.btn_skin.select.tx_select"]
- self.btnLeft = uiMap["hero_detail_ui.common.btn_left"]
- self.btnRight = uiMap["hero_detail_ui.common.btn_right"]
+ -- self.btnHero = uiMap["hero_detail_ui.common.btns.btn_hero"]
+ -- self.txHero1 = uiMap["hero_detail_ui.common.btns.btn_hero.tx_btn"]
+ -- self.selectHero = uiMap["hero_detail_ui.common.btns.btn_hero.select"]
+ -- self.txHero2 = uiMap["hero_detail_ui.common.btns.btn_hero.select.tx_select"]
+ -- self.btnStar = uiMap["hero_detail_ui.common.btns.btn_star"]
+ -- self.lockStar = uiMap["hero_detail_ui.common.btns.btn_star.content.img_lock"]
+ -- self.txStar1 = uiMap["hero_detail_ui.common.btns.btn_star.content.tx_btn"]
+ -- self.selectStar = uiMap["hero_detail_ui.common.btns.btn_star.select"]
+ -- self.txStar2 = uiMap["hero_detail_ui.common.btns.btn_star.select.tx_select"]
+ -- self.btnSkin = uiMap["hero_detail_ui.common.btns.btn_skin"]
+ -- self.lockSkin = uiMap["hero_detail_ui.common.btns.btn_skin.content.img_lock"]
+ -- self.txSkin1 = uiMap["hero_detail_ui.common.btns.btn_skin.content.tx_btn"]
+ -- self.selectSkin = uiMap["hero_detail_ui.common.btns.btn_skin.select"]
+ -- self.txSkin2 = uiMap["hero_detail_ui.common.btns.btn_skin.select.tx_select"]
+ self.leftBtn = uiMap["hero_detail_ui.common.left_btn"]
+ self.rightBtn = uiMap["hero_detail_ui.common.right_btn"]
self.heroNode = uiMap["hero_detail_ui.hero_node"]
self.elementBg = uiMap["hero_detail_ui.common.hero_node.element_bg"]
@@ -62,67 +66,66 @@ function HeroDetailUI:onLoadRootComplete()
self.heroElement = uiMap["hero_detail_ui.common.hero_node.hero_element"]
self.spineObjAvatar = uiMap["hero_detail_ui.common.hero_node.ui_spine_obj_avatar"]
self.powerTx = uiMap["hero_detail_ui.common.power_img.power_tx"]
+ self.qltBg = uiMap["hero_detail_ui.common.qlt_bg"]
+ self.qltBgTx = uiMap["hero_detail_ui.common.qlt_bg.qlt_tx"]
+ self.starComp = uiMap["hero_detail_ui.common.hero_node.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
- self.txHero1:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
- self.txHero2:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4))
+ self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), "升星"}
+ self.pageBtns = {}
+ self.pageBtnTxs = {}
+ self.pageBtnLocks = {}
+ for i = 1, 2 do
+ self.pageBtns[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i]
+ self.pageBtnTxs[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i .. ".text"]
+ self.pageBtnLocks[i] = uiMap["hero_detail_ui.common.btns.page_btn_" .. i .. ".lock_img"]
+ if self.pageBtnLocks[i] then
+ self.pageBtnLocks[i]:setActive(not self:getIsOpen(i))
+ end
+ self.pageBtns[i] :addClickListener(function()
+ if not self:getIsOpen(i) or self.page == i then
+ return
+ end
+ self.page = i
+ self:onRefresh()
+ end)
+ end
+
+ -- 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("升星")
- self.txStar2:setText("升星")
- self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
- self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
+ -- self.txStar1:setText("升星")
+ -- self.txStar2:setText("升星")
+ -- self.txSkin1:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
+ -- self.txSkin2:setText(I18N:getGlobalText(I18N.GlobalConst.SKIN))
self.powerTx:setText(1313213)
- if not DataManager.HeroData:isStarOpen() then
- self.lockStar:setVisible(true)
- GFunc.centerImgAndTx(self.lockStar, self.txStar1, 5)
- else
- self.lockStar:setVisible(false)
- end
- if not DataManager.HeroData:isSkinOpen() then
- self.lockSkin:setVisible(true)
- GFunc.centerImgAndTx(self.lockSkin, self.txSkin1, 5)
- else
- self.lockSkin:setVisible(false)
- end
-
- self.btnHero:addClickListener(function()
- self.panelType = GConst.HeroConst.PANEL_TYPE.HERO
- self:refreshShow()
- end)
- self.btnStar:addClickListener(function()
- if not DataManager.HeroData:isStarOpen(true) then
- return
- end
- self.panelType = GConst.HeroConst.PANEL_TYPE.STAR
- self:refreshShow()
- end)
- self.btnSkin:addClickListener(function()
- if not DataManager.HeroData:isSkinOpen(true) then
- return
- end
- self.panelType = GConst.HeroConst.PANEL_TYPE.SKIN
- self:refreshShow()
- end)
- self.closeBtn:addClickListener(function()
- self:closeUI()
- end)
- self.btnLeft:addClickListener(function()
+ -- if not DataManager.HeroData:isStarOpen() then
+ -- self.lockStar:setVisible(true)
+ -- GFunc.centerImgAndTx(self.lockStar, self.txStar1, 5)
+ -- else
+ -- self.lockStar:setVisible(false)
+ -- end
+ -- if not DataManager.HeroData:isSkinOpen() then
+ -- self.lockSkin:setVisible(true)
+ -- GFunc.centerImgAndTx(self.lockSkin, self.txSkin1, 5)
+ -- else
+ -- self.lockSkin:setVisible(false)
+ -- end
+ self.leftBtn:addClickListener(function()
if not self:isShowLeftArrow() then
return
end
self.heroEntity = DataManager.HeroData:getHeroById(self.heroList[self.idxLast].cfgId)
- self:updateSide()
- self:refreshShow()
+ self:onRefresh()
end)
- self.btnRight:addClickListener(function()
+ self.rightBtn:addClickListener(function()
if not self:isShowRightArrow() then
return
end
self.heroEntity = DataManager.HeroData:getHeroById(self.heroList[self.idxNext].cfgId)
- self:updateSide()
- self:refreshShow()
+ self:onRefresh()
end)
self:bind(DataManager.BagData.ItemData, "dirty", function()
self:refreshRedPoint()
@@ -153,11 +156,37 @@ function HeroDetailUI:onLoadRootComplete()
end)
end
-function HeroDetailUI:onRefresh()
+function HeroDetailUI:initList()
self.heroList = DataManager.HeroData:getAllHeroesSort(self.formationType)
- self:updateSide()
- self:refreshShow()
+end
+
+function HeroDetailUI:getIsOpen(page)
+ if page == GConst.HeroConst.PANEL_TYPE.HERO then
+ return true
+ elseif page == GConst.HeroConst.PANEL_TYPE.STAR then
+ return DataManager.HeroData:isStarOpen()
+ end
+ return false
+end
+
+function HeroDetailUI:onRefresh()
self:updateHero()
+ self:updateSide()
+ self:refreshPageInfo()
+end
+
+function HeroDetailUI:changePage(page)
+ self.page = page
+ self:onRefresh()
+end
+
+function HeroDetailUI:updateSide()
+ for index, data in ipairs(self.heroList) do
+ if data.cfgId == self.heroEntity:getCfgId() then
+ self.idxLast = index - 1
+ self.idxNext = index + 1
+ end
+ end
end
function HeroDetailUI:updateHero()
@@ -176,58 +205,52 @@ function HeroDetailUI:updateHero()
self.spineObjAvatar:getSkeletonGraphic().enabled = true
self.spineObjAvatar:playAnim("idle", true, true, true)
end, true)
+
+ local qlt = self.heroEntity:getQlt()
+ self.starComp:refresh(self.heroEntity:getStar())
+ self.qltBg:setSprite(GFunc.getHeroQltImg(qlt))
+ self.qltBgTx:setText(GFunc.getHeroQltStr(qlt))
end
-function HeroDetailUI:updateSide()
- for index, data in ipairs(self.heroList) do
- if data.cfgId == self.heroEntity:getCfgId() then
- self.idxLast = index - 1
- self.idxNext = index + 1
- end
- end
-end
-
-function HeroDetailUI:changePage(panelType)
- self.panelType = panelType
- self:refreshShow()
-end
-
-function HeroDetailUI:refreshShow()
+function HeroDetailUI:refreshPageInfo()
self.titleTx:setText(self.heroEntity:getName())
- if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then
+ if self.page == GConst.HeroConst.PANEL_TYPE.HERO then
self:showHeroInfo()
- elseif self.panelType == GConst.HeroConst.PANEL_TYPE.STAR then
+ elseif self.page == GConst.HeroConst.PANEL_TYPE.STAR then
self:showStarInfo()
- elseif self.panelType == GConst.HeroConst.PANEL_TYPE.SKIN then
+ elseif self.page == GConst.HeroConst.PANEL_TYPE.SKIN then
self:showskinInfo()
end
if self.onlyLook then -- 仅查看的不显示升级和激活按钮
- self.btnHero:setActive(false)
- self.btnStar:setActive(false)
- self.btnSkin:setActive(false)
- self.btnLeft:setActive(false)
- self.btnRight:setActive(false)
- -- if self.panelType == GConst.HeroConst.PANEL_TYPE.HERO then
- -- self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_LOOK_HERO)
- -- end
+ self.leftBtn:setActive(false)
+ self.rightBtn:setActive(false)
+ for i = 1, 2 do
+ self.pageBtns[i]:setActive(false)
+ end
else
- self.btnHero:setActive(true)
- self.btnStar:setActive(true)
- self.btnSkin:setActive(true)
- self.btnLeft:setActive(self:isShowLeftArrow())
- self.btnRight:setActive(self:isShowRightArrow())
- -- self.commonInfo:setSizeDeltaY(SIZE_DELTA_Y_HERO)
+ self.leftBtn:setActive(self:isShowLeftArrow())
+ self.rightBtn:setActive(self:isShowRightArrow())
+ for i = 1, 2 do
+ self.pageBtns[i]:setActive(true)
+ if self.page == i then
+ self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_1")
+ self.pageBtnTxs[i]:setText(self.btnTxs[i])
+ else
+ self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_2")
+ self.pageBtnTxs[i]:setText("" .. self.btnTxs[i] .. "")
+ end
+ end
self:refreshRedPoint()
end
end
-- 刷新标签红点
function HeroDetailUI:refreshRedPoint()
- if self.heroEntity:canLvUp() then
- self.btnHero:addRedPoint(-55, 0, 0.6)
- else
- self.btnHero:removeRedPoint()
- end
+ -- if self.heroEntity:canLvUp() then
+ -- self.btnHero:addRedPoint(-55, 0, 0.6)
+ -- else
+ -- self.btnHero:removeRedPoint()
+ -- end
-- if DataManager.EquipData:canUpgradeStar(self.heroEntity:getCfgId()) then
-- self.btnStar:addRedPoint(-55, 0, 0.6)
-- else
@@ -242,11 +265,11 @@ end
function HeroDetailUI:showHeroInfo()
self.heroInfo:setActive(true)
- self.selectHero:setActive(true)
+ -- self.selectHero:setActive(true)
self.starInfo:setActive(false)
- self.selectStar:setActive(false)
+ -- self.selectStar:setActive(false)
self.skinInfo:setActive(false)
- self.selectSkin:setActive(false)
+ -- self.selectSkin:setActive(false)
self.bg:setActive(true)
if not self.compHero then
@@ -261,11 +284,11 @@ end
function HeroDetailUI:showStarInfo()
self.heroInfo:setActive(false)
- self.selectHero:setActive(false)
+ -- self.selectHero:setActive(false)
self.starInfo:setActive(true)
- self.selectStar:setActive(true)
+ -- self.selectStar:setActive(true)
self.skinInfo:setActive(false)
- self.selectSkin:setActive(false)
+ -- self.selectSkin:setActive(false)
self.bg:setActive(true)
if not self.compStar then
@@ -281,11 +304,11 @@ end
function HeroDetailUI:showskinInfo()
self.heroInfo:setActive(false)
- self.selectHero:setActive(false)
+ -- self.selectHero:setActive(false)
self.starInfo:setActive(false)
- self.selectStar:setActive(false)
+ -- self.selectStar:setActive(false)
self.skinInfo:setActive(true)
- self.selectSkin:setActive(true)
+ -- self.selectSkin:setActive(true)
self.bg:setActive(true)
if not self.compSkin then
@@ -301,7 +324,7 @@ end
-- 是否显示左箭头
function HeroDetailUI:isShowLeftArrow()
- if self.panelType == GConst.HeroConst.PANEL_TYPE.RUNES then
+ if self.page == GConst.HeroConst.PANEL_TYPE.RUNES then
return false
end
@@ -310,7 +333,7 @@ end
-- 是否显示右箭头
function HeroDetailUI:isShowRightArrow()
- if self.panelType == GConst.HeroConst.PANEL_TYPE.RUNES then
+ if self.page == GConst.HeroConst.PANEL_TYPE.RUNES then
return false
end
diff --git a/lua/app/ui/hero/hero_info_comp.lua b/lua/app/ui/hero/hero_info_comp.lua
index 3452e76e..f0c72935 100644
--- a/lua/app/ui/hero/hero_info_comp.lua
+++ b/lua/app/ui/hero/hero_info_comp.lua
@@ -56,7 +56,10 @@ function HeroInfoComp:init()
ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId(), self.heroEntity)
end)
self.btnUp5:addClickListener(function()
- local canLvUpLv = self.heroEntity:getLvUpLv()
+ local canLvUpLv, canLvUp = self.heroEntity:getLvUpLv()
+ if not canLvUp then
+ return
+ end
ModuleManager.HeroManager:upgradeHero(self.heroEntity:getCfgId(), self.heroEntity, canLvUpLv)
end)
self.btnskillDescTxs:addClickListener(function()
diff --git a/lua/app/ui/hero/star_info_comp.lua b/lua/app/ui/hero/star_info_comp.lua
index 76a80a18..8b505401 100644
--- a/lua/app/ui/hero/star_info_comp.lua
+++ b/lua/app/ui/hero/star_info_comp.lua
@@ -1,6 +1,6 @@
local StarInfoComp = class("StarInfoComp", LuaComponent)
-local STAR_CELL = "app/ui/hero/cell/star_cell"
+local STAR_CELL = "app/ui/hero/cell/star_info_cell"
function StarInfoComp:init()
local uiMap = self:getUIMap()
@@ -15,14 +15,8 @@ function StarInfoComp:init()
self.costCells[i] = uiMap["star_info.upgrade.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
end
- self.currStarImgs = {}
- self.nextStarImgs = {}
- for i = 1, 5 do
- self.currStarImgs[i] = uiMap["star_info.info_node.curr_star_bg.star_img_" .. i]
- self.nextStarImgs[i] = uiMap["star_info.info_node.next_star_bg.star_img_" .. i]
- end
- self.currStarBg = uiMap["star_info.info_node.curr_star_bg"]
- self.nextStarBg = uiMap["star_info.info_node.next_star_bg"]
+ 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"]
@@ -73,16 +67,7 @@ function StarInfoComp:refreshInfo()
self.currLvTx:setActive(true)
self.nextLvTx:setActive(false)
local currStar = self.heroEntity:getStar()
- local starType = math.ceil(currStar / 5)
- for i = 1, 5 do
- local star = (currStar - 1)%5 + 1
- if i <= star then
- self.currStarImgs[i]:setActive(true)
- self.currStarImgs[i]:setSprite(GFunc.getStarImg(starType))
- else
- self.currStarImgs[i]:setActive(false)
- end
- end
+ self.currStarBg:refresh(currStar)
local lv = self.heroEntity:getMaxLv()
self.currLvTx:setText(lv .. "/" .. lv)
else
@@ -92,29 +77,14 @@ function StarInfoComp:refreshInfo()
self.nextLvTx:setActive(true)
local currStar = self.heroEntity:getStar()
local nextStar = currStar + 1
- local starType = math.ceil(currStar / 5)
- local starTypeNext = math.ceil(nextStar / 5)
- for i = 1, 5 do
- local star = (currStar - 1)%5 + 1
- if i <= star then
- self.currStarImgs[i]:setActive(true)
- self.currStarImgs[i]:setSprite(GFunc.getStarImg(starType))
- else
- self.currStarImgs[i]:setActive(false)
- end
- local star2 = (nextStar - 1)%5 + 1
- if i <= star2 then
- self.nextStarImgs[i]:setActive(true)
- self.nextStarImgs[i]:setSprite(GFunc.getStarImg(starTypeNext))
- else
- self.nextStarImgs[i]:setActive(false)
- end
- end
+ self.currStarBg:refresh(currStar)
+ self.nextStarBg:refresh(nextStar)
local lv = self.heroEntity:getLv()
local maxLv = self.heroEntity:getCurrMaxLv()
local nextMaxLv = self.heroEntity:getNextMaxLv()
- self.currLvTx:setText(lv .. "/" .. maxLv)
- self.nextLvTx:setText(lv .. "/" .. nextMaxLv)
+ local lvStr = I18N:getGlobalText(I18N.GlobalConst.ACT_DESC_12)
+ self.currLvTx:setText(lvStr .. "" .. lv .. "" .. "/" .. maxLv)
+ self.nextLvTx:setText(lvStr .. lv .. "/" .. "" .. nextMaxLv .. "")
end
end
diff --git a/lua/app/userdata/hero/hero_entity.lua b/lua/app/userdata/hero/hero_entity.lua
index cdf3cb60..a867ae9e 100644
--- a/lua/app/userdata/hero/hero_entity.lua
+++ b/lua/app/userdata/hero/hero_entity.lua
@@ -435,7 +435,7 @@ function HeroEntity:getLvUpLv()
end
count = count + 1
end
- return count
+ return count + self.data.lv, count == 0
end
-- endregion