一键探索调整编队后探索地图修改提交

dev_chengFeng
jiaoyangna 2022-01-13 11:17:18 +08:00
parent 05e078dadc
commit 8b4533aac9
1 changed files with 27 additions and 10 deletions

View File

@ -77,7 +77,7 @@ end
--添加事件监听(用于子类重写)
function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Explore.UpdateFormation,this.OnShow)
Game.GlobalEvent:AddEvent(GameEvent.Explore.UpdateFormation,this.Init)
end
--移除事件监听(用于子类重写)
@ -100,10 +100,11 @@ function this:OnOpen(_parent,...)
this.mapTimeTipLayer.overrideSorting = true
this.mapTimeTipLayer.sortingOrder = sortingOrder + 1
this.mask.sortingOrder = sortingOrder + 1
this:Init()
end
--界面打开时调用(用于子类重写)
function this:OnShow()
function this:Init()
this.icon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(Explore[1].Cost[1]))
--队伍
for i = 1,math.max(#this.itemList,#this.data) do
@ -191,6 +192,10 @@ function this:OnShow()
this:TimeCountDown()
end
function this:OnShow()
this.RefreshFormations()
end
function this.RefreshMapNameColor()
--红 fe5757 黄 f3e168 绿 58f567
for k,v in pairs(this.mapDatas) do
@ -204,7 +209,7 @@ function this.RefreshMapNameColor()
end
end
function this.SetMapName(id)
function this.SetMapName(id)
local forId = id or this.formationId
if FormationManager.GetFormationPower(forId)/Explore[this.formationList[forId].mapId].Force < 0.8 then
this.itemList[this.formationList[forId].index].targgetBtnText.text = string.format("<color=#%s>%s</color>","fe5757", Explore[this.formationList[forId].mapId].Name)
@ -273,11 +278,14 @@ function this.SetPos(gobj,pos,formationId)
end
end
function this:Refresh(_data,_item,index)
_item.data = _data
_item.go.gameObject:SetActive(true)
_item.formation.gameObject:SetActive(true)
_item.name.text = string.format("队伍%s",_data.index)
function this.RefreshFormations()
--队伍
for i = 1,#this.itemList do
this.RefreshFormation(this.itemList[i],this.itemList[i].data)
end
end
function this.RefreshFormation(_item,_data)
for j, demon in ipairs(_item.heroList) do
_item.heroList[j].frame.sprite = this.spLoader:LoadSprite(GetQuantityImageByquality(1))
_item.heroList[j].hero:SetActive(false)
@ -322,7 +330,15 @@ function this:Refresh(_data,_item,index)
_item.heroList[pos].proIcon.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
_item.heroList[pos].heroData = heroData
end
this.SetMapName(_data.formationId)
end
function this:Refresh(_data,_item,index)
_item.data = _data
_item.go.gameObject:SetActive(true)
_item.formation.gameObject:SetActive(true)
_item.name.text = string.format("队伍%s",_data.index)
local formation = FormationManager.GetFormationByID(_data.formationId)
this.formationList[_data.formationId] = {} --formationId 为索引 预设index,mapId,exploreTime,formationId
this.formationList[_data.formationId].index = index
this.formationList[_data.formationId].formationId = _data.formationId
@ -347,7 +363,7 @@ function this:Refresh(_data,_item,index)
this.formationList[_data.formationId].exploreTime = this.mapDatas[1].exploreTime
_item.targgetTimeBtn.gameObject:SetActive(false)
end
this.SetMapName(_data.formationId)
this.RefreshFormation(_item,_data)
this.SetExploreTime(_data.formationId)
_item.selectIma.gameObject:SetActive(this.formationList[_data.formationId].select == 1)
Util.AddOnceClick(_item.select,function()
@ -418,7 +434,7 @@ function this:OnClose()
end
this.SetPos(this.mapTip,nil,this.formationId)
this.SetPos(this.mapTimeTip,nil,this.formationId)
Game.GlobalEvent:RemoveEvent(GameEvent.Explore.UpdateFormation,this.OnShow)
Game.GlobalEvent:RemoveEvent(GameEvent.Explore.UpdateFormation,this.Init)
end
--界面销毁时调用(用于子类重写)
@ -427,6 +443,7 @@ function this:OnDestroy()
this.itemList = {}
this.mapTipPreList = {}
this.mapTimeTipPreList = {}
this.formationList = {}
end
return this