This commit is contained in:
puxuan 2025-10-27 15:23:43 +08:00
parent 9d97844bea
commit 897bd97fe4
4 changed files with 56 additions and 58 deletions

View File

@ -24,26 +24,26 @@ function BagMainUI:onLoadRootComplete()
self.titleTx = uiMap["bag_main_ui.bg.title_tx"] self.titleTx = uiMap["bag_main_ui.bg.title_tx"]
self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16)} self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16)}
self.pageBtns = {} -- self.pageBtns = {}
self.pageBtnTxs = {} -- self.pageBtnTxs = {}
self.pageBtnLocks = {} -- self.pageBtnLocks = {}
self.pageRedImgs = {} -- self.pageRedImgs = {}
for i = 1, 2 do -- for i = 1, 2 do
self.pageBtns[i] = uiMap["bag_main_ui.bg.btns.page_btn_" .. i] -- self.pageBtns[i] = uiMap["bag_main_ui.bg.btns.page_btn_" .. i]
self.pageBtnTxs[i] = uiMap["bag_main_ui.bg.btns.page_btn_" .. i .. ".text"] -- self.pageBtnTxs[i] = uiMap["bag_main_ui.bg.btns.page_btn_" .. i .. ".text"]
self.pageBtnLocks[i] = uiMap["bag_main_ui.bg.btns.page_btn_" .. i .. ".lock_img"] -- self.pageBtnLocks[i] = uiMap["bag_main_ui.bg.btns.page_btn_" .. i .. ".lock_img"]
self.pageRedImgs[i] = uiMap["bag_main_ui.red_node.red_img_" .. i] -- self.pageRedImgs[i] = uiMap["bag_main_ui.red_node.red_img_" .. i]
-- if self.pageBtnLocks[i] then -- -- if self.pageBtnLocks[i] then
-- self.pageBtnLocks[i]:setActive(not self:getIsOpen(i)) -- -- self.pageBtnLocks[i]:setActive(not self:getIsOpen(i))
-- end -- -- end
self.pageBtns[i] :addClickListener(function() -- self.pageBtns[i] :addClickListener(function()
if not self:getIsOpen(i) or self.page == i then -- if not self:getIsOpen(i) or self.page == i then
return -- return
end -- end
self.page = i -- self.page = i
self:onRefresh() -- self:onRefresh()
end) -- end)
end -- end
self.scrollrect = uiMap["bag_main_ui.bg.scrollrect"] self.scrollrect = uiMap["bag_main_ui.bg.scrollrect"]
self.scrollRectComp = uiMap["bag_main_ui.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) self.scrollRectComp = uiMap["bag_main_ui.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
@ -65,7 +65,7 @@ end
function BagMainUI:onRefresh() function BagMainUI:onRefresh()
self:initList() self:initList()
self:refreshPageBtn() -- self:refreshPageBtn()
self:refreshScrollrect() self:refreshScrollrect()
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.BAG_DESC_1)) self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.BAG_DESC_1))
@ -76,20 +76,20 @@ function BagMainUI:initList()
end end
-- 刷新标签红点 -- 刷新标签红点
function BagMainUI:refreshPageBtn() -- function BagMainUI:refreshPageBtn()
for i = 1, 2 do -- for i = 1, 2 do
self.pageBtns[i]:setActive(false) -- self.pageBtns[i]:setActive(false)
if self.page == i then -- if self.page == i then
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_1") -- self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_1")
self.pageBtnTxs[i]:setText(self.btnTxs[i]) -- self.pageBtnTxs[i]:setText(self.btnTxs[i])
else -- else
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_2") -- self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_2")
self.pageBtnTxs[i]:setText("<color=#72778C>" .. self.btnTxs[i] .. "</color>") -- self.pageBtnTxs[i]:setText("<color=#72778C>" .. self.btnTxs[i] .. "</color>")
end -- end
-- self.pageRedImgs[i]:setActive(self.heroEntity:showRedPoint(i)) -- -- self.pageRedImgs[i]:setActive(self.heroEntity:showRedPoint(i))
self.pageRedImgs[i]:setActive(false) -- self.pageRedImgs[i]:setActive(false)
end -- end
end -- end
function BagMainUI:refreshScrollrect() function BagMainUI:refreshScrollrect()
self.scrollRectComp:refillCells(#self.list) self.scrollRectComp:refillCells(#self.list)

View File

@ -141,7 +141,7 @@ function HeroCell:_refresh(id, isGray)
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position]) self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
self.check:setVisible(false) self.check:setVisible(false)
self:refreshHeroIcon(heroInfo.icon) self:refreshHeroIcon(heroInfo.icon)
self:setGray(isGray) -- self:setGray(isGray)
self.nameTx:setText(ModuleManager.HeroManager:getHeroName(id)) self.nameTx:setText(ModuleManager.HeroManager:getHeroName(id))
end end
@ -162,12 +162,12 @@ function HeroCell:setSpineVisible(visible, scale)
end end
function HeroCell:setGray(isGray) function HeroCell:setGray(isGray)
if self.isGray == isGray then -- if self.isGray == isGray then
return -- return
end -- end
self.isGray = isGray -- self.isGray = isGray
self.icon:setImageGray(isGray) -- self.icon:setImageGray(isGray)
self.matchImg:setImageGray(isGray) -- self.matchImg:setImageGray(isGray)
end end
return HeroCell return HeroCell

View File

@ -52,9 +52,7 @@ function CommonBoxUI:onLoadRootComplete()
self.btnClose = uiMap["common_box_ui.content.btn_close"] self.btnClose = uiMap["common_box_ui.content.btn_close"]
self.rewardCell = uiMap["common_box_ui.content.info_node.reward_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL) self.rewardCell = uiMap["common_box_ui.content.info_node.reward_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
self.txName = uiMap["common_box_ui.content.info_node.tx_name"] self.txName = uiMap["common_box_ui.content.info_node.tx_name"]
self.txType = uiMap["common_box_ui.content.info_node.tx_type"] self.txDesc = uiMap["common_box_ui.content.info_node.tx_desc"]
self.txCount = uiMap["common_box_ui.content.info_node.tx_count"]
self.txDesc = uiMap["common_box_ui.content.desc.tx_desc"]
self.scrollrect = uiMap["common_box_ui.content.scrollrect"] self.scrollrect = uiMap["common_box_ui.content.scrollrect"]
self.selectNode = uiMap["common_box_ui.content.select"] self.selectNode = uiMap["common_box_ui.content.select"]
self.txSelect = uiMap["common_box_ui.content.select.tx_select"] self.txSelect = uiMap["common_box_ui.content.select.tx_select"]
@ -113,8 +111,8 @@ end
function CommonBoxUI:onRefresh() function CommonBoxUI:onRefresh()
self.rewardCell:refreshById(self.id) self.rewardCell:refreshById(self.id)
self.txName:setText(ModuleManager.ItemManager:getItemName(self.id)) self.txName:setText(ModuleManager.ItemManager:getItemName(self.id))
self.txType:setText(I18N:getGlobalText(I18N.GlobalConst["ITEM_TYPE_" .. ModuleManager.ItemManager:getItemType(self.id)])) -- self.txType:setText(I18N:getGlobalText(I18N.GlobalConst["ITEM_TYPE_" .. ModuleManager.ItemManager:getItemType(self.id)]))
self.txCount:setText(I18N:getGlobalText(I18N.GlobalConst.ITEM_DESC_1, self.maxCount)) -- self.txCount:setText(I18N:getGlobalText(I18N.GlobalConst.ITEM_DESC_1, self.maxCount))
self.txDesc:setText(ModuleManager.ItemManager:getItemDesc(self.id)) self.txDesc:setText(ModuleManager.ItemManager:getItemDesc(self.id))
self.txSelect:setText(self.curCount) self.txSelect:setText(self.curCount)
@ -152,12 +150,12 @@ function CommonBoxUI:onRefresh()
-- 展示宝箱tips -- 展示宝箱tips
self.selectNode:setActive(false) self.selectNode:setActive(false)
self.btnUse:setActive(false) self.btnUse:setActive(false)
self.contentNode:setSizeDeltaY(580) self.contentNode:setSizeDeltaY(620)
else else
-- 展示宝箱开奖励 -- 展示宝箱开奖励
self.selectNode:setActive(true) self.selectNode:setActive(true)
self.btnUse:setActive(true) self.btnUse:setActive(true)
self.contentNode:setSizeDeltaY(728) self.contentNode:setSizeDeltaY(768)
end end
end end

View File

@ -42,15 +42,15 @@ function MainComp:init()
self.heroNodeList = {} self.heroNodeList = {}
for i = 1, 5 do for i = 1, 5 do
self.heroNodeList[i] = uiMap["main_comp.formation.hero_" .. i] self.heroNodeList[i] = uiMap["main_comp.formation.hero_" .. i]
self.heroNodeList[i]:addClickListener(function() -- self.heroNodeList[i]:addClickListener(function()
local heroId = self.curFormation[i] -- local heroId = self.curFormation[i]
if heroId then -- if heroId then
local hero = DataManager.HeroData:getHeroById(heroId) -- local hero = DataManager.HeroData:getHeroById(heroId)
if hero then -- if hero then
ModuleManager.HeroManager:showHeroDetailUI(heroId, nil, nil, GConst.BattleConst.FORMATION_TYPE.STAGE) -- ModuleManager.HeroManager:showHeroDetailUI(heroId, nil, nil, GConst.BattleConst.FORMATION_TYPE.STAGE)
end -- end
end -- end
end) -- end)
end end
self.chapterMiddleBg = uiMap["main_comp.middle_bg"] self.chapterMiddleBg = uiMap["main_comp.middle_bg"]