无尽副本优化提交

dev_chengFeng
jiaoyangna 2021-05-15 18:25:45 +08:00
parent 848af2cbbe
commit 00497c7071
6 changed files with 123 additions and 100 deletions

View File

@ -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,70 +565,80 @@ 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
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
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
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 not dieHeros[a.dynamicId] and dieHeros[b.dynamicId]
end
else
return not dieHeros[a.dynamicId] and dieHeros[b.dynamicId]
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.id > b.id
end
else
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
return a.star > b.star
end
else
return a.heroConfig.Quality > b.heroConfig.Quality
end
else
return a.lv > b.lv
end
end
end
--设置每条英雄数据
function this.SingleHeroDataShow(_go, _heroData)
local go=_go

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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)