diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index c63c7d03..fa3cc205 100644 --- a/lua/app/module/hero/hero_manager.lua +++ b/lua/app/module/hero/hero_manager.lua @@ -1,7 +1,7 @@ local HeroManager = class("HeroManager", BaseModule) -function HeroManager:showHeroDetailUI(heroId, onlyLook) - UIManager:showUI("app/ui/hero/hero_detail_ui", {heroId = heroId, onlyLook = onlyLook}) +function HeroManager:showHeroDetailUI(heroId, onlyLook, heroEntity) + UIManager:showUI("app/ui/hero/hero_detail_ui", {heroId = heroId, onlyLook = onlyLook, heroEntity = heroEntity}) end function HeroManager:showHeroUnlockUI(heroIdList) diff --git a/lua/app/ui/common/component/hero_formation_comp.lua b/lua/app/ui/common/component/hero_formation_comp.lua index 6640024c..3777c16f 100644 --- a/lua/app/ui/common/component/hero_formation_comp.lua +++ b/lua/app/ui/common/component/hero_formation_comp.lua @@ -42,6 +42,10 @@ function HeroFormationComp:refreshBriefInfo(formation) if formation[i] and DataManager.HeroData:isExistHeroById(formation[i].id) then heroCell:setVisible(true, 1) heroCell:refreshBriefInfo(formation[i].id, formation[i].level) + heroCell:addClickListener(function() + local heroEntity = DataManager.HeroData:getEntity(formation[i]) + ModuleManager.HeroManager:showHeroDetailUI(formation[i].id, true, heroEntity) + end) else heroCell:setVisible(false) end diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index 40fade4a..f0e199ac 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -20,9 +20,13 @@ function HeroDetailUI:onPressBackspace() end function HeroDetailUI:ctor(parmas) - local heroId = parmas.heroId self.onlyLook = parmas.onlyLook - self.heroEntity = DataManager.HeroData:getHeroById(heroId) + if parmas.heroEntity then + self.heroEntity = parmas.heroEntity + else + local heroId = parmas.heroId + self.heroEntity = DataManager.HeroData:getHeroById(heroId) + end end function HeroDetailUI:onLoadRootComplete()