From 00497c7071dbe4a9518817f7f672f2234c6f6bcd Mon Sep 17 00:00:00 2001 From: jiaoyangna <3046463818@qq.com> Date: Sat, 15 May 2021 18:25:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E5=B0=BD=E5=89=AF=E6=9C=AC=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Formation/FormationPanelV2.lua | 119 ++++++++++-------- .../Formation/View/CarbonFormation.lua | 30 +---- .../~Lua/Modules/Hero/HeroManager.lua | 2 +- .../~Lua/Modules/Map/EndLessMapManager.lua | 61 +++++++-- .../~Lua/Modules/Net/IndicationManager.lua | 9 -- .../~Lua/Modules/Net/NetManager.lua | 2 +- 6 files changed, 123 insertions(+), 100 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua index f5f5ddfb9e..03bc5fe285 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/FormationPanelV2.lua @@ -496,7 +496,7 @@ end --点击筛选 function this.OnClickTabBtn(_proId, isTop,isAni) - local heros + local heros = {} this.selectBtn:SetActive(proId ==_proId) this.selectBtn.transform:SetParent(tabs[_proId].transform) this.selectBtn.transform:DOAnchorPos(Vector3.zero,0) @@ -511,6 +511,7 @@ function this.OnClickTabBtn(_proId, isTop,isAni) end elseif this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then heros = EndLessMapManager.GetHeroDataByProperty(_proId, limitLevel) + heros = EndLessMapManager.GetHeroDataByProperty1(_proId, limitLevel,heros) else if _proId == ProIdConst.All then heros = HeroManager.GetAllHeroDatas(limitLevel) @@ -532,10 +533,13 @@ function this.SetRoleList(_roleDatas, isTop,isAni) this.SingleHeroDataShow(go, _roleDatas[index]) end, not isTop,not isAni) end + + --排序英雄数据 function this.SortHeroDatas(_heroDatas) local choosed = {} local dieHeros = {} + local notExisted = {} local curFormation = FormationManager.GetFormationByID(this.curFormationIndex) for i = 1, #_heroDatas do local heroHp = FormationManager.GetFormationHeroHp(this.curFormationIndex, _heroDatas[i].dynamicId) @@ -545,6 +549,11 @@ function this.SortHeroDatas(_heroDatas) end end end + for i = 1, #_heroDatas do + if _heroDatas[i].exist and _heroDatas[i].exist == 0 then + notExisted[_heroDatas[i].dynamicId] = _heroDatas[i].dynamicId + end + end for j = 1, #curFormation.teamHeroInfos do local teamInfo = curFormation.teamHeroInfos[j] if teamInfo then @@ -556,69 +565,79 @@ function this.SortHeroDatas(_heroDatas) if (choosed[a.dynamicId] and choosed[b.dynamicId]) or (not choosed[a.dynamicId] and not choosed[b.dynamicId]) then - if (dieHeros[a.dynamicId] and dieHeros[b.dynamicId]) or - (not dieHeros[a.dynamicId] and not dieHeros[b.dynamicId]) + if (notExisted[a.dynamicId] and notExisted[b.dynamicId]) or + (not notExisted[a.dynamicId] and not notExisted[b.dynamicId]) then - if sortType == SortTypeConst.Natural then - if a.heroConfig.Natural == b.heroConfig.Natural then - if a.heroConfig.Quality == b.heroConfig.Quality then - if a.star == b.star then - if a.lv == b.lv then - if a.warPower == b.warPower then - if a.id == b.id then - return a.sortId > b.sortId - else - return a.id > b.id - end - else - return a.warPower > b.warPower - end - else - return a.lv > b.lv - end + if (dieHeros[a.dynamicId] and dieHeros[b.dynamicId]) or + (not dieHeros[a.dynamicId] and not dieHeros[b.dynamicId]) + then + return this.NaturalSort(sortType == SortTypeConst.Natural,a,b) + else + return not dieHeros[a.dynamicId] and dieHeros[b.dynamicId] + end + else + return notExisted[a.dynamicId] and not notExisted[b.dynamicId] + end + else + return choosed[a.dynamicId] and not choosed[b.dynamicId] + end + end) +end + +function this.NaturalSort(isNature,a,b) + if isNature then + if a.heroConfig.Natural == b.heroConfig.Natural then + if a.heroConfig.Quality == b.heroConfig.Quality then + if a.star == b.star then + if a.lv == b.lv then + if a.warPower == b.warPower then + if a.id == b.id then + return a.sortId > b.sortId else - return a.star > b.star + return a.id > b.id end else - return a.heroConfig.Quality > b.heroConfig.Quality + return a.warPower > b.warPower + end + else + return a.lv > b.lv + end + else + return a.star > b.star + end + else + return a.heroConfig.Quality > b.heroConfig.Quality + end + else + return a.heroConfig.Natural > b.heroConfig.Natural + end + else + if a.lv == b.lv then + if a.heroConfig.Quality == b.heroConfig.Quality then + if a.star == b.star then + if a.heroConfig.Natural == b.heroConfig.Natural then + if a.warPower == b.warPower then + if a.id == b.id then + return a.sortId > b.sortId + else + return a.id > b.id + end + else + return a.warPower > b.warPower end else return a.heroConfig.Natural > b.heroConfig.Natural end else - if a.lv == b.lv then - if a.heroConfig.Quality == b.heroConfig.Quality then - if a.star == b.star then - if a.heroConfig.Natural == b.heroConfig.Natural then - if a.warPower == b.warPower then - if a.id == b.id then - return a.sortId > b.sortId - else - return a.id > b.id - end - else - return a.warPower > b.warPower - end - else - return a.heroConfig.Natural > b.heroConfig.Natural - end - else - return a.star > b.star - end - else - return a.heroConfig.Quality > b.heroConfig.Quality - end - else - return a.lv > b.lv - end + return a.star > b.star end else - return not dieHeros[a.dynamicId] and dieHeros[b.dynamicId] + return a.heroConfig.Quality > b.heroConfig.Quality end else - return choosed[a.dynamicId] and not choosed[b.dynamicId] + return a.lv > b.lv end - end) + end end --设置每条英雄数据 function this.SingleHeroDataShow(_go, _heroData) diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/View/CarbonFormation.lua b/Assets/ManagedResources/~Lua/Modules/Formation/View/CarbonFormation.lua index 0f9918073d..ddd3cd0d00 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/View/CarbonFormation.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/View/CarbonFormation.lua @@ -66,7 +66,7 @@ function this.RrefreshFormation() local curFormation = FormationManager.GetFormationByID(index) LogGreen("curFormation.teamHeroInfos:"..#curFormation.teamHeroInfos) for k,v in pairs(curFormation.teamHeroInfos) do - if EndLessMapManager.heroDataLists[v.heroId] then + if EndLessMapManager.GetSingleHeroData(v.heroId) then table.insert(tempList,v) end end @@ -201,34 +201,6 @@ function this.IniFormationSet(type) this.IsNeedChangeFormation = type ~= CARBON_TYPE.ENDLESS end - --- 普通,精英副本设置 --- function this.NormalCarbon() --- this.root.bg:SetActive(true) --- this.root.btn_1:SetActive(true) --- this.root.btn_2:SetActive(true) --- this.root.btn_1_lab.text = "扫 荡" --- this.root.btn_2_lab.text = "进入副本" --- -- 进入副本显示设置 --- MapManager.isCarbonEnter = true - --- -- 设置扫荡条件 --- local canSweep = CarbonManager.GetMapSweepState(this.curMapId) --- local rgbValue = canSweep and 1 or 0.5 --- Util.SetColor(this.root.btn_1, Color.New(rgbValue, rgbValue, rgbValue, 1)) --- this.root.btn_1:GetComponent("Button").enabled = canSweep --- this.SetTipShowByType(CarbonManager.difficulty, canSweep) --- end - --- -- 设置精英副本跟普通副本的提示显示 --- function this.SetTipShowByType(type, canSweep) --- local isEliteCarbon = type == 3 --- this.root.mobTip:SetActive(not canSweep and not isEliteCarbon) --- this.root.eliteTip:SetActive(not canSweep and isEliteCarbon) --- -- 普通-精英副本得到的地图ID this.curMapId --- this.root.eliteNumNeed.text = CarbonManager.EliteSweepCondition(this.curMapId) --- end - -- 试炼副本设置 function this.TrialCarbon() this.root.bg:SetActive(true) diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua index 5b7204417d..f4e7ff7a90 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua @@ -642,7 +642,7 @@ function this.GetSingleHeroData(heroDId) heroData = ExpeditionManager.GetSingleHeroData(heroDId) end if not heroData then - heroData = EndLessMapManager.heroDataLists[heroDId] + heroData = EndLessMapManager.GetSingleHeroData(heroDId) end return heroData end diff --git a/Assets/ManagedResources/~Lua/Modules/Map/EndLessMapManager.lua b/Assets/ManagedResources/~Lua/Modules/Map/EndLessMapManager.lua index 9e09d2f5d5..c6f427caef 100644 --- a/Assets/ManagedResources/~Lua/Modules/Map/EndLessMapManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Map/EndLessMapManager.lua @@ -451,15 +451,12 @@ end --------------------------------------------------------------------------------编队 神将------------------------------------------------------------------------------- this.heroDataLists = {} function this.InitAllEndlessHero(heroList,isClear) - if isClear then + if not this.heroDataLists then this.heroDataLists = {} end for i = 1 ,#heroList do this.InitSingleEndlessHero(heroList[i]) end - for k,v in pairs(this.heroDataLists) do - LogGreen(v.dynamicId.." lv:"..v.lv.." heroData.star:"..v.star) - end end function this.InitSingleEndlessHero(_msgHeroData) @@ -673,21 +670,65 @@ function this.SetHeroFormationList(heroDid,teamId,isAddOrDel) end +function this.GetSingleHeroData(heroDid) + if this.heroDataLists[heroDid] then + return this.heroDataLists[heroDid] + end +end + +function this.GetCanUseHeroDatas() + if not this.canUseHeroDatas then + this.canUseHeroDatas = {} + end + for k,v in pairs(this.heroDataLists) do + if PlayerManager.GetHeroDataByStar(0,v.id) and not this.canUseHeroDatas[v.dynamicId] then + this.canUseHeroDatas[v.dynamicId] = v + end + end +end + function this.GetHeroDataByProperty(_proId, limitLevel) + this.GetCanUseHeroDatas() local heros = {} local index = 1 - for i, v in pairs(this.heroDataLists) do - if v.property == _proId or _proId == 0 then - if v.lv >= limitLevel then - heros[index] = v - index = index + 1 + if this.canUseHeroDatas then + for i, v in pairs(this.canUseHeroDatas) do + if v.property == _proId or _proId == 0 then + if v.lv >= limitLevel then + heros[index] = v + heros[index].exist = 1 + index = index + 1 + end end end end return heros - end +function this.GetHeroDataByProperty1(_proId, limitLevel,_heros) + local index = 0 + local heros = {} + for i, v in pairs(this.heroDataLists) do + local isExist = false + for j, k in pairs(this.canUseHeroDatas) do + if (v.property == _proId or _proId == 0) and k.id == v.id then + isExist = true + break + end + end + if not isExist then + index = #heros + 1 + heros[index] = v + heros[index].exist = 0 + end + end + return heros +end +function this.SortHeroData(herolist) + table.sort(herolist,function(a,b) + + end) +end -------------------------------------------------------------------------------------------------------------------------------------------------------------------- return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua index cf08e39a6c..049c43793f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua @@ -126,15 +126,6 @@ function this.RegisterMessage(network) socket:RegistNetMessage(MessageTypeProto_pb.RECHARGE_SUCCESS_INDICATION, this.RechargeSuccessOrder) -- 礼包拍脸推送 socket:RegistNetMessage(MessageTypeProto_pb.PUSH_WELFARE_RESPONSE, this.BackPatFaceData) - socket:RegistNetMessage(MessageTypeProto_pb.ENDLESS_NEW_HERO_GET_INDICATION, this.EndlessNewHeroGetIndication) -end - -function this.EndlessNewHeroGetIndication(buffer) - local data = buffer:DataByte() - local msg = HeroInfoProto_pb.GetEndlessHeroListInfoResponse() - msg:ParseFromString(data) - LogGreen("EndlessNewHeroGetIndication") - EndLessMapManager.InitAllEndlessHero(msg.heroList,false) end function this.OpenHongMengTowerGuideIndication(buffer) diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 2cda9fdbe1..27502c7ae1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -5006,7 +5006,7 @@ function this.AllEndLessHeroDataResponse(_index,func) func(msg) end else - _index = _index + #msg.heroList + _index = _index + #msg.heroList this.AllEndLessHeroDataResponse(_index,func) end end)