【头像】加入英雄是否进入版本判断
parent
7a010e5e7d
commit
a2ee17f6c3
|
@ -65,6 +65,14 @@ function this.Initialize()
|
|||
}
|
||||
end
|
||||
this.SetAllStarBreakIdData()
|
||||
|
||||
-- 初始化碎片和英雄的对应关系
|
||||
this._ChipToHero = {}
|
||||
for id, data in ConfigPairs(heroConfig) do
|
||||
if data.PiecesId then
|
||||
this._ChipToHero[data.PiecesId] = id
|
||||
end
|
||||
end
|
||||
end
|
||||
--初始化英雄数据
|
||||
function this.InitHeroData(_msgHeroList)
|
||||
|
@ -4272,16 +4280,9 @@ end
|
|||
|
||||
-- 英雄碎片id转英雄id
|
||||
function this.ChipIdToHeroId(chipId)
|
||||
local item = itemConfig[chipId]
|
||||
if not item then
|
||||
return
|
||||
if chipId then
|
||||
return this._ChipToHero[chipId]
|
||||
end
|
||||
local reward = rewardGroup[item.RewardGroup[1]]
|
||||
if not reward or not reward.ShowItem or not reward.ShowItem[1] then
|
||||
return
|
||||
end
|
||||
local heroId = reward.ShowItem[1][1]
|
||||
return heroId
|
||||
end
|
||||
|
||||
return this
|
|
@ -13,6 +13,16 @@ function HeadManager.Initialize()
|
|||
this._MyHeadList = {}
|
||||
this._MyHeadFrameList = {}
|
||||
|
||||
-- 初始化头像和英雄的对应关系
|
||||
this._HeadToHero = {}
|
||||
local Heros = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.ItemConfig, "ItemType", ItemType.Hero)
|
||||
for _, data in ipairs(Heros) do
|
||||
if data.ExtraReward and data.ExtraReward[2] then
|
||||
local headId = data.ExtraReward[2][1]
|
||||
this._HeadToHero[headId] = data.Id
|
||||
end
|
||||
end
|
||||
|
||||
-- 注册事件
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Bag.GetNewItem, this.OnNewItem)
|
||||
end
|
||||
|
@ -65,16 +75,22 @@ function HeadManager.GetHeadList()
|
|||
local curMyHeadList = {}--只做条件判断 没什么用
|
||||
for _, head in ipairs(AllHeadList) do
|
||||
if head.Ifopen == 1 then
|
||||
if head.Name == Language[11393] then
|
||||
for i = 1, #configs do
|
||||
if configs[i].RolePic == head.Id and not curMyHeadList[head.Id] then
|
||||
table.insert(this._MyHeadList, head)
|
||||
curMyHeadList[head.Id] = head.Id
|
||||
-- 判断神将是否进入版本
|
||||
local heroId = this.HeadIdToHeroId(head.Id)
|
||||
LogRed("head.id:"..head.Id)
|
||||
LogRed("heroId:"..tostring(heroId))
|
||||
if not heroId or HeroManager.InVersion(heroId) then
|
||||
if head.Name == Language[11393] then
|
||||
for i = 1, #configs do
|
||||
if configs[i].RolePic == head.Id and not curMyHeadList[head.Id] then
|
||||
table.insert(this._MyHeadList, head)
|
||||
curMyHeadList[head.Id] = head.Id
|
||||
end
|
||||
end
|
||||
else
|
||||
table.insert(this._MyHeadList, head)
|
||||
curMyHeadList[head.Id] = head.Id
|
||||
end
|
||||
else
|
||||
table.insert(this._MyHeadList, head)
|
||||
curMyHeadList[head.Id] = head.Id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -231,4 +247,12 @@ function HeadManager.GetCurFrameId()
|
|||
HeadManager.SetCurFrameId(80000)
|
||||
return PlayerManager.frame
|
||||
end
|
||||
|
||||
-- 头像id转英雄id
|
||||
function HeadManager.HeadIdToHeroId(headId)
|
||||
if headId then
|
||||
return this._HeadToHero[headId]
|
||||
end
|
||||
end
|
||||
|
||||
return HeadManager
|
Loading…
Reference in New Issue