From 78ead0e8adebff56b6899c472dfa627cbd17e2ef Mon Sep 17 00:00:00 2001 From: ZhangBiao Date: Thu, 24 Dec 2020 15:13:03 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A4=A7=E9=97=B9=E5=A4=A9=E5=AE=AB?= =?UTF-8?q?=E3=80=91=E4=B8=80=E9=94=AE=E4=B8=8A=E9=98=B5=E6=8B=9B=E5=8B=9F?= =?UTF-8?q?=E8=8B=B1=E9=9B=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Formation/FormationPanelV2.lua | 45 +++++++++++++++++++ .../Formation/View/ExpeditionFormation.lua | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua index 0d1a7c8414..5ebcb4b1c5 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua @@ -989,4 +989,49 @@ function this.SetOneKeyGoWithCondition(Rules) this.OnClickTabBtn(proId) end +--设置大闹天宫一键上阵 +function this.SetOneKeyGoExpedition() + --获取需要上阵的位置 + local posArr=this.GetPosList() + if #posArr==0 then + PopupTipPanel.ShowTip(Language[10692]) + return + end + local theros = HeroManager.GetAllHeroDatas(limitLevel) + theros = ExpeditionManager.GetAllHeroDatas(theros,limitLevel) + --按战力从大到小排序 + table.sort(theros,function(a,b) + if a.warPower == b.warPower then + return a.id>b.id + else + return a.warPower > b.warPower + end + end) + --修改 upHeroSidTable 静态id 存储 有则跳过 + local upHeroSidTable = {} + this.order = 0 + this.choosedList = {} + for j = 1, #this.choosedList do + local curSingleherodata = HeroManager.GetSingleHeroData(this.choosedList[j].heroId) + upHeroSidTable[curSingleherodata.id] = curSingleherodata.id + end + for k, v in ipairs(theros) do + local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId) + if not upHeroSidTable[curSingleherodata.id] then + LogGreen("this.choosedList "..#this.choosedList) + if #this.choosedList < 6 then + for n = 1, #posArr do + upHeroSidTable[curSingleherodata.id] = curSingleherodata.id + table.insert(this.choosedList, {heroId = v.dynamicId, position=posArr[n]}) + table.remove(posArr,n) + this.order = this.order + 1 + break + end + end + end + end + this.SetCardsData() + this.OnClickTabBtn(proId) +end + return FormationPanelV2 \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/View/ExpeditionFormation.lua b/Assets/ManagedResources/~Lua/Modules/Formation/View/ExpeditionFormation.lua index b57bf001c2..a083b3df9a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/View/ExpeditionFormation.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/View/ExpeditionFormation.lua @@ -20,7 +20,7 @@ end --- btn1点击回调事件 function this.On_Btn1_Click() - this.root.SetOneKeyGo() + this.root.SetOneKeyGoExpedition() end function this.On_Btn2_Click()