From d789b9e98e0e478636e791400e2d6c4fd2efaba6 Mon Sep 17 00:00:00 2001 From: ZhangBiao Date: Thu, 19 Nov 2020 17:37:13 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=BC=96=E9=98=9F=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E8=BD=A9=E8=BE=95=E5=AE=9D=E9=95=9C=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Formation/FormationPanelV2.lua | 93 +++++++++++++------ .../View/XuanYuanMirrorFormation.lua | 2 +- 2 files changed, 66 insertions(+), 29 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua index 8d72c307c5..4aa8e83f21 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua @@ -867,9 +867,6 @@ end function this.SetOneKeyGo() --获取需要上阵的位置 local posArr=this.GetPosList() - -- for i = 1, #posArr do - -- Log("可上阵位置索引"..posArr[i]) - -- end if #posArr==0 then PopupTipPanel.ShowTip(Language[10692]) return @@ -878,32 +875,12 @@ function this.SetOneKeyGo() local heros = HeroManager.GetAllHeroDatas(limitLevel) --按战力从大到小排序 table.sort(heros,function(a,b) - -- local aWarPower = HeroManager.CalculateHeroAllProValList(1,a.dynamicId,false)[HeroProType.WarPower] - -- local bWarPower = HeroManager.CalculateHeroAllProValList(1,b.dynamicId,false)[HeroProType.WarPower] - -- if aWarPower==bWarPower then - -- return a.id>b.id - -- else - -- return aWarPower>bWarPower - -- end if a.warPower == b.warPower then return a.id>b.id else return a.warPower > b.warPower end end) - --遍历英雄 去除已上阵英雄 - -- for j = 1, #this.choosedList do - -- for k, v in ipairs(heros) do - -- if HeroManager.GetSingleHeroData(v.dynamicId).id== HeroManager.GetSingleHeroData(this.choosedList[j].heroId).id then - - -- table.remove(heros,k) - -- break - -- end - -- end - -- end - -- if #heros == 0 then - -- return - -- end --修改 upHeroSidTable 静态id 存储 有则跳过 local upHeroSidTable = {} this.order = 0 @@ -927,12 +904,72 @@ function this.SetOneKeyGo() end end end + this.SetCardsData() + this.OnClickTabBtn(proId) +end - --缺几个空位 就上几个空位 - -- for n = 1, #posArr do - -- table.insert(this.choosedList, {heroId = heros[n].dynamicId, position=posArr[n]}) - -- end - -- this.order=this.order+#posArr +--设置轩辕宝镜一键上阵 +function this.SetOneKeyGoWithCondition(Rules) + local rulesType = Rules[1][1] + local rulesNum = Rules[1][2] + local curNum = 0 + --获取需要上阵的位置 + local posArr=this.GetPosList() + if #posArr==0 then + PopupTipPanel.ShowTip(Language[10692]) + return + end + + local heros = HeroManager.GetAllHeroDatas(limitLevel) + --按战力从大到小排序 + table.sort(heros,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(heros) 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 + if rulesType == v.heroConfig.PropertyName and curNum < rulesNum then + curNum = curNum + 1 + 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 + end + for k, v in ipairs(heros) 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 diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/View/XuanYuanMirrorFormation.lua b/Assets/ManagedResources/~Lua/Modules/Formation/View/XuanYuanMirrorFormation.lua index f2643e63a2..b2dfccd100 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/View/XuanYuanMirrorFormation.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/View/XuanYuanMirrorFormation.lua @@ -37,7 +37,7 @@ end --- btn1点击回调事件 function this.On_Btn1_Click() - this.root.SetOneKeyGo() + this.root.SetOneKeyGoWithCondition(data.teamRules) end -- 进入地图