英雄排序方式

This commit is contained in:
xiekaidong 2023-08-18 18:46:44 +08:00
parent 0137884ad9
commit 7babd6aaec
4 changed files with 24 additions and 7 deletions

View File

@ -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)

View File

@ -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

View File

@ -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()

View File

@ -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)