From 8b4533aac9d8824461d9277de4a29ba379dd093b Mon Sep 17 00:00:00 2001 From: jiaoyangna <3046463818@qq.com> Date: Thu, 13 Jan 2022 11:17:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E9=94=AE=E6=8E=A2=E7=B4=A2=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E7=BC=96=E9=98=9F=E5=90=8E=E6=8E=A2=E7=B4=A2=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GeneralSizeFitterPopup_OneKeyExplore.lua | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralSizeFitterPopup_OneKeyExplore.lua b/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralSizeFitterPopup_OneKeyExplore.lua index a36707ed41..b909569659 100644 --- a/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralSizeFitterPopup_OneKeyExplore.lua +++ b/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralSizeFitterPopup_OneKeyExplore.lua @@ -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("%s","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 \ No newline at end of file