英雄排序方式
This commit is contained in:
parent
0137884ad9
commit
7babd6aaec
@ -1,7 +1,7 @@
|
|||||||
local HeroManager = class("HeroManager", BaseModule)
|
local HeroManager = class("HeroManager", BaseModule)
|
||||||
|
|
||||||
function HeroManager:showHeroDetailUI(heroId, onlyLook, heroEntity, 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})
|
UIManager:showUI("app/ui/hero/hero_detail_ui", {heroId = heroId, onlyLook = onlyLook, heroEntity = heroEntity, skinId = skinId, formationType = formationType})
|
||||||
end
|
end
|
||||||
|
|
||||||
function HeroManager:showHeroUnlockUI(heroIdList)
|
function HeroManager:showHeroUnlockUI(heroIdList)
|
||||||
|
|||||||
@ -58,7 +58,7 @@ function HeroComp:init()
|
|||||||
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)
|
ModuleManager.HeroManager:showHeroDetailUI(heroId, nil, nil, nil, self.battleType)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -167,7 +167,7 @@ function HeroComp:refreshDungeonArmorFormation()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function HeroComp:refreshScrollRect()
|
function HeroComp:refreshScrollRect()
|
||||||
self.heroList = DataManager.HeroData:getAllHeroesSort() -- 每次都重新算一次
|
self.heroList = DataManager.HeroData:getAllHeroesSort(self.battleType) -- 每次都重新算一次
|
||||||
|
|
||||||
for i = 1, 5 do
|
for i = 1, 5 do
|
||||||
local heroId = self.curFormation[i]
|
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:refresh(entity, not entity:isActived(), self.onClickUseFunc)
|
||||||
self.largeHeroCell:showCheck(self.curFormation[entity:getMatchType()] == heroId)
|
self.largeHeroCell:showCheck(self.curFormation[entity:getMatchType()] == heroId)
|
||||||
else
|
else
|
||||||
ModuleManager.HeroManager:showHeroDetailUI(heroId)
|
ModuleManager.HeroManager:showHeroDetailUI(heroId, nil, nil, nil, self.battleType)
|
||||||
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@ -26,6 +26,7 @@ function HeroDetailUI:ctor(parmas)
|
|||||||
else
|
else
|
||||||
self.panelType = parmas.panelType or GConst.HeroConst.PANEL_TYPE.HERO
|
self.panelType = parmas.panelType or GConst.HeroConst.PANEL_TYPE.HERO
|
||||||
end
|
end
|
||||||
|
self.formationType = parmas.formationType
|
||||||
self.onlyLook = parmas.onlyLook
|
self.onlyLook = parmas.onlyLook
|
||||||
if parmas.heroEntity then
|
if parmas.heroEntity then
|
||||||
self.heroEntity = parmas.heroEntity
|
self.heroEntity = parmas.heroEntity
|
||||||
@ -94,7 +95,7 @@ function HeroDetailUI:onLoadRootComplete()
|
|||||||
self.lockSkin:setVisible(false)
|
self.lockSkin:setVisible(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.heroList = DataManager.HeroData:getAllHeroesSort()
|
self.heroList = DataManager.HeroData:getAllHeroesSort(self.formationType)
|
||||||
self:updateSide()
|
self:updateSide()
|
||||||
self:refreshShow()
|
self:refreshShow()
|
||||||
|
|
||||||
|
|||||||
@ -270,7 +270,15 @@ function HeroData:getAllHeroesBIStr()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 获取所有英雄列表(等级>品质>id)
|
-- 获取所有英雄列表(等级>品质>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 result = {}
|
||||||
local heroCfg = ConfigManager:getConfig("hero")
|
local heroCfg = ConfigManager:getConfig("hero")
|
||||||
for id, v in pairs(heroCfg) do
|
for id, v in pairs(heroCfg) do
|
||||||
@ -296,6 +304,14 @@ function HeroData:getAllHeroesSort()
|
|||||||
sort = sort + 100000000000
|
sort = sort + 100000000000
|
||||||
end
|
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
|
info.sort = sort
|
||||||
end
|
end
|
||||||
table.sort(result, function(a, b)
|
table.sort(result, function(a, b)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user