From 7babd6aaec836d66dcadb03e56fdf09589c3da88 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 18 Aug 2023 18:46:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E6=8E=92=E5=BA=8F=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= 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/hero_comp.lua | 6 +++--- lua/app/ui/hero/hero_detail_ui.lua | 3 ++- lua/app/userdata/hero/hero_data.lua | 18 +++++++++++++++++- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/lua/app/module/hero/hero_manager.lua b/lua/app/module/hero/hero_manager.lua index 7f3559c0..80618ba2 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, heroEntity, skinId) - UIManager:showUI("app/ui/hero/hero_detail_ui", {heroId = heroId, onlyLook = onlyLook, heroEntity = heroEntity, skinId = skinId}) +function HeroManager:showHeroDetailUI(heroId, onlyLook, heroEntity, skinId, formationType) + UIManager:showUI("app/ui/hero/hero_detail_ui", {heroId = heroId, onlyLook = onlyLook, heroEntity = heroEntity, skinId = skinId, formationType = formationType}) end function HeroManager:showHeroUnlockUI(heroIdList) diff --git a/lua/app/ui/hero/hero_comp.lua b/lua/app/ui/hero/hero_comp.lua index 142b80bb..4dba8039 100644 --- a/lua/app/ui/hero/hero_comp.lua +++ b/lua/app/ui/hero/hero_comp.lua @@ -58,7 +58,7 @@ function HeroComp:init() if heroId then local hero = DataManager.HeroData:getHeroById(heroId) if hero then - ModuleManager.HeroManager:showHeroDetailUI(heroId) + ModuleManager.HeroManager:showHeroDetailUI(heroId, nil, nil, nil, self.battleType) end end end) @@ -167,7 +167,7 @@ function HeroComp:refreshDungeonArmorFormation() end function HeroComp:refreshScrollRect() - self.heroList = DataManager.HeroData:getAllHeroesSort() -- 每次都重新算一次 + self.heroList = DataManager.HeroData:getAllHeroesSort(self.battleType) -- 每次都重新算一次 for i = 1, 5 do local heroId = self.curFormation[i] @@ -235,7 +235,7 @@ function HeroComp:onClickHero(cell, heroId) self.largeHeroCell:refresh(entity, not entity:isActived(), self.onClickUseFunc) self.largeHeroCell:showCheck(self.curFormation[entity:getMatchType()] == heroId) else - ModuleManager.HeroManager:showHeroDetailUI(heroId) + ModuleManager.HeroManager:showHeroDetailUI(heroId, nil, nil, nil, self.battleType) self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X) end else diff --git a/lua/app/ui/hero/hero_detail_ui.lua b/lua/app/ui/hero/hero_detail_ui.lua index 4da27830..e969a868 100644 --- a/lua/app/ui/hero/hero_detail_ui.lua +++ b/lua/app/ui/hero/hero_detail_ui.lua @@ -26,6 +26,7 @@ function HeroDetailUI:ctor(parmas) else self.panelType = parmas.panelType or GConst.HeroConst.PANEL_TYPE.HERO end + self.formationType = parmas.formationType self.onlyLook = parmas.onlyLook if parmas.heroEntity then self.heroEntity = parmas.heroEntity @@ -94,7 +95,7 @@ function HeroDetailUI:onLoadRootComplete() self.lockSkin:setVisible(false) end - self.heroList = DataManager.HeroData:getAllHeroesSort() + self.heroList = DataManager.HeroData:getAllHeroesSort(self.formationType) self:updateSide() self:refreshShow() diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index 74d4d439..2686cec2 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -270,7 +270,15 @@ function HeroData:getAllHeroesBIStr() end -- 获取所有英雄列表(等级>品质>id) -function HeroData:getAllHeroesSort() +function HeroData:getAllHeroesSort(formationType) + local formationMap + if formationType then + local formation = DataManager.FormationData:getFormation(formationType) + formationMap = {} + for _, heroId in pairs(formation) do + formationMap[heroId] = true + end + end local result = {} local heroCfg = ConfigManager:getConfig("hero") for id, v in pairs(heroCfg) do @@ -296,6 +304,14 @@ function HeroData:getAllHeroesSort() sort = sort + 100000000000 end + if formationMap and formationMap[info.cfgId] then --在布阵中 + sort = sort + 10000000000000 + end + + if not heroEntity:isActived() and heroEntity:canLvUp() then + sort = sort + 1000000000000 + end + info.sort = sort end table.sort(result, function(a, b)