This commit is contained in:
puxuan 2025-08-19 21:04:14 +08:00
parent 9f41da288b
commit 0fb6ce79bc

View File

@ -38,19 +38,19 @@ function HeroComp:init()
}
self.heroSpineList = {}
self.largeHeroCell = CellManager:addCellComp(self.uiMap["hero_ui.bottom_bg.scrollrect.viewport.content.large_hero_cell"], GConst.TYPEOF_LUA_CLASS.LARGE_HERO_CELL)
self.txTitle = self.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]
self.rimgTopBG = self.uiMap["hero_ui.top_bg"]
-- self.txTitle = self.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]
-- self.rimgTopBG = self.uiMap["hero_ui.top_bg"]
self.content = self.uiMap["hero_ui.bottom_bg.scrollrect.viewport.content"]
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
self.content:addClickListener(function()
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
end)
self.btnCollection = self.uiMap["hero_ui.btn_collect"]
self.btnCollection:addClickListener(function()
UIManager:showUI("app/ui/collection/collection_ui", GConst.CollectionConst.TYPE.HERO)
end)
self.uiMap["hero_ui.btn_collect.tx_collect"]:setText(I18N:getGlobalText(I18N.GlobalConst.COLLECTION_DESC_10))
-- self.btnCollection = self.uiMap["hero_ui.btn_collect"]
-- self.btnCollection:addClickListener(function()
-- UIManager:showUI("app/ui/collection/collection_ui", GConst.CollectionConst.TYPE.HERO)
-- end)
-- self.uiMap["hero_ui.btn_collect.tx_collect"]:setText(I18N:getGlobalText(I18N.GlobalConst.COLLECTION_DESC_10))
-- self.uiMap["hero_ui.bottom_bg.filter_bg.btn_0.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.COLLECTION_DESC_10))
self.uiMap["hero_ui.bottom_bg.filter_bg.btn_0.desc_tx"]:setText("ALL")
@ -87,15 +87,24 @@ function HeroComp:init()
end
end
self:bind(DataManager.CollectionData, "isDirty", function()
self:refreshCollectEntrance()
end)
self:bind(DataManager.HeroData, "isDirty", function()
self:refreshCollectEntrance()
end)
-- self:bind(DataManager.CollectionData, "isDirty", function()
-- self:refreshCollectEntrance()
-- end)
-- self:bind(DataManager.HeroData, "isDirty", function()
-- self:refreshCollectEntrance()
-- end)
self:bind(DataManager.SkinData, "isDirty", function()
self:refresh()
end)
local powerImg = self.uiMap["hero_ui.power_img"]
local formationBg = self.uiMap["hero_ui.formation"]
local bottomBg = self.uiMap["hero_ui.bottom_bg"]
local rect = self.baseObject:getRectSize()
local bgHeight = rect.height * 0.66
bottomBg:setSizeDeltaY(bgHeight)
formationBg:setAnchoredPositionY(bgHeight)
powerImg:setAnchoredPositionY(bgHeight + 20)
end
function HeroComp:refresh(battleType)
@ -103,7 +112,7 @@ function HeroComp:refresh(battleType)
self:clearAdapt()
self:adapt()
self:refreshCollectEntrance()
-- self:refreshCollectEntrance()
self:updateFilter()
if self.battleType == GConst.BattleConst.FORMATION_TYPE.STAGE then
self:refreshStageFormation()
@ -130,8 +139,8 @@ end
-- 展示主线章节阵容
function HeroComp:refreshStageFormation()
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_2))
self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
-- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_2))
-- self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
self.curFormation = DataManager.FormationData:getStageFormation()
self.onClickUseFunc = function(id, type)
@ -143,8 +152,8 @@ end
-- 展示竞技场进攻阵容
function HeroComp:refreshArenaFightFormation()
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_10))
self.rimgTopBG:setTexture("assets/arts/textures/background/arena/arena_bg_2.png")
-- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_10))
-- self.rimgTopBG:setTexture("assets/arts/textures/background/arena/arena_bg_2.png")
self.curFormation = DataManager.FormationData:getArenaAttackFormation()
self.onClickUseFunc = function(id, type)
@ -157,8 +166,8 @@ end
-- 展示竞技场防守阵容
function HeroComp:refreshArenaDefendFormation()
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_9))
self.rimgTopBG:setTexture("assets/arts/textures/background/arena/arena_bg_2.png")
-- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_9))
-- self.rimgTopBG:setTexture("assets/arts/textures/background/arena/arena_bg_2.png")
self.curFormation = DataManager.FormationData:getArenaDefendFormation()
self.onClickUseFunc = function(id, type)
@ -171,8 +180,8 @@ end
-- 展示武器副本
function HeroComp:refreshDungeonWeaponFormation()
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_15))
self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
-- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_WEAPON_DESC_15))
-- self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
self.curFormation = DataManager.FormationData:getDungeonWeaponFormation()
self.onClickUseFunc = function(id, type)
@ -185,8 +194,8 @@ end
-- 展示支线副本
function HeroComp:refreshDungeonArmorFormation()
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_ARMOR_DESC_4))
self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
-- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_ARMOR_DESC_4))
-- self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
self.curFormation = DataManager.FormationData:getDungeonArmorFormation()
self.onClickUseFunc = function(id, type)
@ -198,8 +207,8 @@ function HeroComp:refreshDungeonArmorFormation()
end
function HeroComp:refreshBossRushFormation()
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_BOSS_RUSH_DESC_9))
self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
-- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_BOSS_RUSH_DESC_9))
-- self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
self.curFormation = DataManager.FormationData:getBossRushFormation()
self.onClickUseFunc = function(id, type)
@ -211,8 +220,8 @@ function HeroComp:refreshBossRushFormation()
end
function HeroComp:refreshDungeonRuneFormation()
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_TITLE))
self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
-- self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_RUNE_TITLE))
-- self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
self.curFormation = DataManager.FormationData:getDungeonRuneFormation()
self.onClickUseFunc = function(id, type)
@ -349,17 +358,17 @@ function HeroComp:getHeroCell(heroId)
end
-- 刷新图鉴入口
function HeroComp:refreshCollectEntrance()
if self.battleType == GConst.BattleConst.FORMATION_TYPE.STAGE then
self.btnCollection:setVisible(DataManager.CollectionData:isOpen())
if DataManager.CollectionData:hasRedPoint() then
self.btnCollection:addRedPoint(25, 30, 0.6)
else
self.btnCollection:removeRedPoint()
end
else
self.btnCollection:setVisible(false)
end
end
-- function HeroComp:refreshCollectEntrance()
-- if self.battleType == GConst.BattleConst.FORMATION_TYPE.STAGE then
-- self.btnCollection:setVisible(DataManager.CollectionData:isOpen())
-- if DataManager.CollectionData:hasRedPoint() then
-- self.btnCollection:addRedPoint(25, 30, 0.6)
-- else
-- self.btnCollection:removeRedPoint()
-- end
-- else
-- self.btnCollection:setVisible(false)
-- end
-- end
return HeroComp