【编队优化】

dev_chengFeng
gaoxin 2021-09-10 16:25:38 +08:00
parent 3257b89e70
commit 16633b37a8
27 changed files with 543 additions and 581 deletions

View File

@ -474,7 +474,7 @@ function this.InitQuickFightData(monsterGroupId, eventId, msg)
Game.GlobalEvent:DispatchEvent(GameEvent.Map.DeadOut, 0, lastPos)
-- battledHp = 0
if MapManager.curCarbonType == CarBonTypeId.ENDLESS then
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_ENDLESS_MAP,{},{})
FormationManager.SaveFormation(FormationTypeDef.FORMATION_ENDLESS_MAP,{},{})
end
else
MapManager.RefreshFormationHp(data)

View File

@ -67,6 +67,7 @@ function this.UpdateFormation(msg)
-- this.curFormationIndex = this.SetCurFormationIndex()
this.curFormationIndex = 1
for i, team in ipairs(msg.TeamPosInfo) do
Log("编队id:"..team.teamId.. " 编队人数:"..#team.teamHeroInfos)
local oTeam = this.MakeAEmptyTeam(team.teamId)
for j = 1, #team.teamHeroInfos do
@ -92,7 +93,7 @@ function this.UpdateFormation(msg)
this.CheckGuildFightDefendFormation()
end
function this.RefreshFormation(index, roleList, pokemonList,isDiffmonster)
function this.SaveFormation(index, roleList, pokemonList,isDiffmonster)
local curFormation = this.formationList[index]
if not curFormation or #this.formationList == 0 then
return
@ -205,7 +206,7 @@ function this.GetFormationByID(teamId)
table.insert(this.formationList[teamId].teamHeroInfos, this.formationList[1].teamHeroInfos[n])
end
--
FormationManager.RefreshFormation(teamId, this.formationList[teamId].teamHeroInfos, {})
FormationManager.SaveFormation(teamId, this.formationList[teamId].teamHeroInfos, {})
return this.formationList[teamId]
end
end
@ -322,7 +323,7 @@ function this.CheckFormationHp(formationIndex)
table.insert(newFormation, singleData)
end
end
this.RefreshFormation(formationIndex, newFormation, formation.teamPokemonInfos)
this.SaveFormation(formationIndex, newFormation, formation.teamPokemonInfos)
end
-- 检测编队是否有上阵人数
@ -350,7 +351,7 @@ function FormationManager.CheckGuildFightDefendFormation()
singleData.position = index
table.insert(newFormation, singleData)
end
this.RefreshFormation(FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND, newFormation, formation.teamPokemonInfos)
this.SaveFormation(FormationTypeDef.FORMATION_GUILD_FIGHT_DEFEND, newFormation, formation.teamPokemonInfos)
end
end
end
@ -525,7 +526,7 @@ function this.SetOneKeyGoWithoutUI(formationType,limitLevel)
end
end
--保存编队
FormationManager.RefreshFormation(formationType, choosedList,FormationManager.formationList[formationType].teamPokemonInfos)
FormationManager.SaveFormation(formationType, choosedList,FormationManager.formationList[formationType].teamPokemonInfos)
end
return this

View File

@ -1,4 +1,9 @@
require("Base/BasePanel")
-- 编队动作
FORMATION_ACTION = {
DOWN = 0, -- 下阵神将
UP = 1 -- 上阵神将
}
require("Base/BasePanel")
FormationPanelV2 = Inherit(BasePanel)
local this = FormationPanelV2
local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig)
@ -20,10 +25,8 @@ local effectList = {}--特效列表
local tabs = {}--筛选按钮
local proId=0--0 全部 1 火 2风 3 水 4 地
local limitLevel = 0--猎妖师等级限制
local sortType = 1 -- 1品阶 2等级
this.order=0
local chooseIndex=0
local chooseHeroObj --当前选中英雄
@ -246,15 +249,13 @@ function this:OnOpen(_panelType,...)
this.opView = require(this.PanelOptionView[_panelType])
this.opView.Init(this, ...)
parameter = ...
this.curFormationIndex = this.opView.GetFormationIndex()
FormationManager.currentFormationIndex = this.opView.GetFormationIndex()
this.SetCurFormationIndex(this.opView:GetFormationIndex())
SoundManager.PlaySound(SoundConfig.Sound_BattleStart_01)
end
function this:OnShow()
this.ElementalResonanceView:OnOpen({sortOrder=self.sortingOrder})
this.SetDrawLevel()
this.RefreshFormation(true,true)
end
function this:OnClose()
@ -285,62 +286,55 @@ function this:OnDestroy()
this.scrollView = nil
end
local yxAllHeros=nil
function this.SetCurFormationIndex(_index)
this.curFormationIndex=_index
function this.SetCurFormationIndex(_index)
this.curFormationIndex = _index
FormationManager.currentFormationIndex = _index
-- 刷新显示
this.RefreshFormation(true,true)
end
--刷新编队
function this.RefreshFormation(isTop,isAni)
proId=0
if this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then
this.opView:RrefreshFormation()
end
--获取当前编队数据
if this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then
EndLessMapManager.RrefreshFormation()
elseif this.curFormationIndex == FormationTypeDef.EXPEDITION then
ExpeditionManager.ExpeditionRrefreshFormation()--刷新编队
elseif this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL then
FightLevelManager.RrefreshFormation(parameter)--刷新编队
end
curFormation = FormationManager.GetFormationByID(this.curFormationIndex)
--如果是玉虚论道
if this.curFormationIndex==FormationTypeDef.FORMATION_YUXUNLUNDAO1 or
this.curFormationIndex==FormationTypeDef.FORMATION_YUXUNLUNDAO2 or
this.curFormationIndex==FormationTypeDef.FORMATION_YUXUNLUNDAO3 then
curFormation=this.opView.GetTeamInfoByIndex(this.curFormationIndex)
LogError("获取阵容信息")
yxAllHeros=this.opView.GetAllHeros()
proId= ProIdConst.All
if this.opView.GetCurFormation then
curFormation = this.opView.GetCurFormation()
else
--获取当前编队数据
if this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then
this.opView:RrefreshFormation()
elseif this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then
EndLessMapManager.RrefreshFormation()
elseif this.curFormationIndex == FormationTypeDef.EXPEDITION then
ExpeditionManager.ExpeditionRrefreshFormation()--刷新编队
elseif this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL then
FightLevelManager.RrefreshFormation(parameter)--刷新编队
end
curFormation = FormationManager.GetFormationByID(this.curFormationIndex)
end
--上阵列表赋值
this.choosedList ={}
for j = 1, #curFormation.teamHeroInfos do
local teamInfo = curFormation.teamHeroInfos[j]
-- 加空判断避免不知名错误
if teamInfo then
table.insert(this.choosedList, {heroId =teamInfo.heroId,position=teamInfo.position})
if curFormation.teamHeroInfos then
for j = 1, #curFormation.teamHeroInfos do
local teamInfo = curFormation.teamHeroInfos[j]
-- 加空判断避免不知名错误
if teamInfo then
table.insert(this.choosedList, {heroId = teamInfo.heroId, position = teamInfo.position})
end
end
end
this.order = #this.choosedList
-- 妖灵师等级限制
limitLevel = 0
limitLevel = CarbonManager.difficulty == 4 and EndLessMapManager.limiteLevel or 0
if this.curFormationIndex == FormationTypeDef.EXPEDITION then
limitLevel = 20
elseif this.curFormationIndex == FormationTypeDef.XUANYUAN_MIRROR then
limitLevel = 0
end
-- 刷新显示
this.RefreshShow(isTop,isAni)
end
function this.RefreshShow(isTop,isAni)
--设置上阵英雄信息
this.SetCardsData()
--显示英雄列表
this.OnClickTabBtn(proId, isTop,isAni)
this.OnClickTabBtn(proId, isTop, isAni)
--战力
this.RefreshPower()
end
function this.RefreshHeroList()
this.OnClickTabBtn(proId,false,false)
end
@ -541,37 +535,22 @@ end
--点击筛选
function this.OnClickTabBtn(_proId, isTop,isAni)
local heros = {}
this.selectBtn:SetActive(proId ==_proId)
this.selectBtn.transform:SetParent(tabs[_proId].transform)
this.selectBtn.transform:DOAnchorPos(Vector3.zero,0)
this.selectBtn.transform:DOScale(Vector3.one,0)
if this.curFormationIndex == FormationTypeDef.EXPEDITION then--大闹天宫
if _proId == ProIdConst.All then
heros = HeroManager.GetAllHeroDatas(limitLevel)
heros = ExpeditionManager.GetAllHeroDatas(heros,limitLevel)
else
heros = HeroManager.GetHeroDataByProperty(_proId, limitLevel)
heros = ExpeditionManager.GetHeroDataByProperty(heros,_proId, limitLevel)
end
elseif this.curFormationIndex == FormationTypeDef.FORMATION_ENDLESS_MAP then
heros = EndLessMapManager.GetHeroDataByProperty(_proId)
heros = EndLessMapManager.GetHeroDataByProperty1(_proId,heros)
elseif this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL then--山河社稷图副官卡
if _proId == ProIdConst.All then
heros = FightLevelManager.GetAllHeroDatas(limitLevel,parameter)--parameter 山河社稷图小关卡数据
else
heros = FightLevelManager.GetHeroDataByProperty(_proId, limitLevel,parameter)
end
-- 定制显示
local heros = {}
if this.opView.GetHeroList then
heros = this.opView.GetHeroList(_proId)
else
if _proId == ProIdConst.All then
heros = HeroManager.GetAllHeroDatas(limitLevel)
heros = HeroManager.GetAllHeroDatas()
else
heros = HeroManager.GetHeroDataByProperty(_proId, limitLevel)
heros = HeroManager.GetHeroDataByProperty(_proId)
end
end
this.empty:SetActive(#heros<=0)
this.SetRoleList(heros, isTop,isAni)
end
@ -579,9 +558,6 @@ end
--设置英雄列表数据
function this.SetRoleList(_roleDatas, isTop,isAni)
if this.curFormationIndex==2001 or this.curFormationIndex==2002 or this.curFormationIndex==2003 then
this.opView.RemoveTeamByIndex(this.curFormationIndex)
end
this.SortHeroDatas(_roleDatas)
-- local curFormation = FormationManager.formationList[this.curFormationIndex]
this.scrollView:SetData(_roleDatas, function(index, go)
@ -697,7 +673,6 @@ end
--设置每条英雄数据
function this.SingleHeroDataShow(_go, _heroData)
local go=_go
local yxID=0
local heroData=_heroData
local frame=Util.GetGameObject(go,"frame"):GetComponent("Image")
local icon=Util.GetGameObject(go, "icon"):GetComponent("Image")
@ -706,6 +681,7 @@ function this.SingleHeroDataShow(_go, _heroData)
local pos= Util.GetGameObject(go, "posIcon"):GetComponent("Image")
local yxInfo=Util.GetGameObject(go, "yxteamName")
local yxTeamName=Util.GetGameObject(go, "yxteamName/Text"):GetComponent("Text")
yxInfo:SetActive(false)
Util.GetGameObject(go, "posIcon"):SetActive(this.curFormationIndex == FormationTypeDef.FIGHT_LEVEL or this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL)
local starGrid = Util.GetGameObject(go, "star")
local yuanImage = Util.GetGameObject(go, "yuanImage")
@ -756,30 +732,89 @@ function this.SingleHeroDataShow(_go, _heroData)
for i,v in pairs(this.choosedList) do
if(heroData.dynamicId==v.heroId) then
choosedObj:SetActive(true)
--如果是玉虚论道
if this.curFormationIndex==2001 or this.curFormationIndex==2002 or this.curFormationIndex==2003 then
this.opView.AddHeroToTeam(heroData.dynamicId,v.position,this.curFormationIndex)
end
end
if panelType == FORMATION_TYPE.WORLDARENA then
if this.opView.GetHeroTeam then
local index = this.opView.GetHeroTeam(heroData.dynamicId)
if index and index ~= this.curFormationIndex then
yxInfo:SetActive(true)
if index==2001 then
yxTeamName.text="第一队"
elseif index==2002 then
yxTeamName.text="第二队"
elseif index==2003 then
yxTeamName.text="第三队"
end
end
end
end
local index
if yxAllHeros and yxAllHeros[heroData.dynamicId] and yxAllHeros[heroData.dynamicId].index~=this.curFormationIndex then
yxInfo:SetActive(true)
index=yxAllHeros[heroData.dynamicId].index
if index==2001 then
yxTeamName.text="第一队"
elseif index==2002 then
yxTeamName.text="第二队"
elseif index==2003 then
yxTeamName.text="第三队"
end
yxID=index
else
yxInfo:SetActive(false)
end
-- 点击事件
Util.AddOnceClick(go, function()
--已上阵取消勾选
if not this.opView.NoUpOrDownFormation then
-- 判断是上阵还是下阵
local formationAction = FORMATION_ACTION.UP
for k, v in ipairs(this.choosedList) do
if v.heroId == heroData.dynamicId then
formationAction = FORMATION_ACTION.DOWN
break
end
end
-- 检测失败方法
local CheckFail = function(tip)
PopupTipPanel.ShowTip(tip)
end
-- 检测成功方法
local CheckSuccess = function(params)
if params.action == FORMATION_ACTION.UP then
if curHeroHpVal and curHeroHpVal <= 0 then
PopupTipPanel.ShowTip(Language[10688])
return
end
if heroData.exist and heroData.exist == 0 then
PopupTipPanel.ShowTip("激活神将图鉴后才可使用!")
return
end
-- 当前可选的最大上阵人数
local maxNum = ActTimeCtrlManager.MaxArmyNum()
if LengthOfTable(this.choosedList) >= maxNum then
PopupTipPanel.ShowTip(Language[10689])
return
end
--判断是否上阵相同猎妖师
for k, v in pairs(this.choosedList) do
if HeroManager.GetSingleHeroData(v.heroId).id == heroData.id then
PopupTipPanel.ShowTip(Language[10690])
return
end
end
--自动计算位置 并赋值pos
local curPos=this.GetPos()
if curPos == 0 then
PopupTipPanel.ShowTip(Language[10689])
return
end
-- 上阵生效
table.insert(this.choosedList, {heroId = heroData.dynamicId, position=curPos})
-- 刷新显示
this.RefreshShow(false, false)
return curPos
elseif params.action == FORMATION_ACTION.DOWN then
for k, v in ipairs(this.choosedList) do
if v.heroId == heroData.dynamicId then
table.remove(this.choosedList,k)
-- 刷新显示
this.RefreshShow(false, false)
return
end
end
end
end
--
local curPos=this.GetPos()
if formationAction == FORMATION_ACTION.UP then
if curHeroHpVal and curHeroHpVal <= 0 then
PopupTipPanel.ShowTip(Language[10688])
return
@ -788,30 +823,12 @@ function this.SingleHeroDataShow(_go, _heroData)
PopupTipPanel.ShowTip("激活神将图鉴后才可使用!")
return
end
for k, v in ipairs(this.choosedList) do
if v.heroId == heroData.dynamicId then
choosedObj:SetActive(false)
this.order=this.order-1
-- --LogGreen("当前下阵位置 "..v.position)
chooseIndex=v.position
table.remove(this.choosedList,k)
this.SetCardsData(this.choosedList)
return
end
end
-- 当前可选的最大上阵人数
local maxNum = ActTimeCtrlManager.MaxArmyNum()
if this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL then--山河社稷图判断上阵数量
local curmaxNum = FightLevelManager.GetFormationHeroMaxNum(parameter)
maxNum = maxNum <= curmaxNum and maxNum or curmaxNum
end
if LengthOfTable(this.choosedList) >= maxNum then
PopupTipPanel.ShowTip(Language[10689])
return
end
--判断是否上阵相同猎妖师
for k, v in pairs(this.choosedList) do
if HeroManager.GetSingleHeroData(v.heroId).id == heroData.id then
@ -819,39 +836,24 @@ function this.SingleHeroDataShow(_go, _heroData)
return
end
end
-- 判断是否有血量
-- if heroHp and heroHp <= 0 then PopupTipPanel.ShowTip("猎妖师重伤,不可上阵!") return end
choosedObj:SetActive(true)
this.order=this.order+1
--自动计算位置 并赋值pos
if this.GetPos()==0 then
if curPos == 0 then
PopupTipPanel.ShowTip(Language[10689])
return
end
--如果在玉虚三个队里面的另外一个队
local curPos=this.GetPos()
if yxID~=0 and yxID~=this.curFormationIndex then
MsgPanel.ShowTwo("该神将正处于其他队伍,是否要编入当前队伍内",nil, function()
--改变英雄队伍id改变
this.opView.ChangeHeroTeam(heroData.dynamicId,this.curFormationIndex,curPos)
yxID=this.curFormationIndex
yxInfo:SetActive(false)
table.insert(this.choosedList, {heroId = heroData.dynamicId, position=curPos})
this.SetCardsData(this.choosedList)
end)
return
end
table.insert(this.choosedList, {heroId = heroData.dynamicId, position=curPos})
--如果是玉虚论道
if this.curFormationIndex==2001 or this.curFormationIndex==2002 or this.curFormationIndex==2003 then
this.opView.AddHeroToTeam(heroData.dynamicId,curPos,this.curFormationIndex)
end
this.SetCardsData(this.choosedList)
end
-- 判断是否有编队上阵条件
local params = {
action = formationAction,
heroData = heroData,
choosedList = this.choosedList,
position = curPos
}
if this.opView.HeroUpDownCheck then
this.opView.HeroUpDownCheck(params, CheckFail, CheckSuccess)
else
PopupTipPanel.ShowTip(Language[10691])
CheckSuccess(params)
end
end)
@ -983,7 +985,6 @@ function this.OnEndDrag(Pointgo,data)--结束拖动
elseif nameIn=="ScrollCycleView" or nameIn==itemName or nameIn == "MaskClick" or nameIn == "btnLab"
or nameIn == "Btn0" or nameIn == "Btn1" or nameIn == "Btn2" or nameIn == "Btn3" or nameIn == "Btn4" or nameIn == "ExampleBtn" then
if not this.opView.NoUpOrDownFormation then
this.order=this.order-1
for i, v in ipairs(this.choosedList) do
if _j==v.position then
table.remove(this.choosedList,i)
@ -1019,7 +1020,7 @@ function this.OnDrag(Pointgo,data)--拖动中
end
this.line.transform:SetAsFirstSibling()
if panelType == FORMATION_TYPE.EXPEDITION or panelType == FORMATION_TYPE.CARBON then
this.line.transform:DOAnchorPos(Vector3.New(0,15,0),0)
this.line.transform:DOAnchorPos(Vector3.New(0,15,0),0)
else
this.line.transform:DOAnchorPos(Vector3.New(0,30,0),0)
end
@ -1051,12 +1052,16 @@ function this.SetOneKeyGo()
PopupTipPanel.ShowTip(Language[10689])
return
end
-- 获取数据
local heros = {}
if this.curFormationIndex == FormationTypeDef.FIGHT_ASSISTANTLEVEL then--山河社稷图副官卡
heros = FightLevelManager.GetAllHeroDatas(limitLevel,parameter)--parameter 山河社稷图小关卡数据
if this.opView.GetOneKeyUpHeroList then
heros = this.opView.GetOneKeyUpHeroList()
else
heros = HeroManager.GetAllHeroDatas(limitLevel)
heros = HeroManager.GetAllHeroDatas()
end
if not heros or #heros <= 0 then
PopupTipPanel.ShowTip("未找到符合条件得神将")
return
end
--按战力从大到小排序
table.sort(heros,function(a,b)
@ -1068,11 +1073,9 @@ function this.SetOneKeyGo()
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
if this.opView.RemoveTeamByIndex then
this.opView.RemoveTeamByIndex(this.curFormationIndex)
end
for k, v in ipairs(heros) do
local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId)
@ -1081,9 +1084,10 @@ function this.SetOneKeyGo()
for n = 1, #posArr do
upHeroSidTable[curSingleherodata.id] = curSingleherodata.id
table.insert(this.choosedList, {heroId = v.dynamicId, position=posArr[n]})
this.opView.AddHeroToTeam(v.dynamicId,posArr[n],this.curFormationIndex)
if this.opView.AddHeroToTeam then
this.opView.AddHeroToTeam(v.dynamicId, posArr[n], this.curFormationIndex)
end
table.remove(posArr,n)
this.order = this.order + 1
break
end
end
@ -1094,215 +1098,5 @@ function this.SetOneKeyGo()
end
--设置无尽副本一键上阵
function this.SetOneKeyCarBonGo()
--获取需要上阵的位置
local posArr=this.GetPosList()
if #posArr==0 then
PopupTipPanel.ShowTip(Language[10689])
return
end
local heros = EndLessMapManager.GetHeroDataByProperty(0)
--按战力从大到小排序
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)
local hp = FormationManager.GetFormationHeroHp(this.curFormationIndex,v.dynamicId)
if not upHeroSidTable[curSingleherodata.id] and hp > 0 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,false,false)
end
--设置轩辕宝镜一键上阵
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[10689])
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
--设置大闹天宫一键上阵
function this.SetOneKeyGoExpedition()
--获取需要上阵的位置
local posArr=this.GetPosList()
if #posArr==0 then
PopupTipPanel.ShowTip(Language[10689])
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)
local hp = FormationManager.GetFormationHeroHp(this.curFormationIndex,v.dynamicId)
if not upHeroSidTable[curSingleherodata.id] and hp > 0 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
--设置玉虚论道一键上阵
function this.SetOneKeyGoYuXunLunDao()
--获取需要上阵的位置
local posArr=this.GetPosList()
if #posArr==0 then
PopupTipPanel.ShowTip(Language[10689])
return
end
local theros = HeroManager.GetAllHeroDatas(limitLevel)
--theros = ExpeditionManager.GetAllHeroDatas(theros,limitLevel)
--获取其他队伍上阵的英雄id
local ids=this.opView.GetOtherTeamAllHeroIds(this.curFormationIndex)
--按战力从大到小排序
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 isCon=BattleUtil.ChecklistIsContainValue(ids,v.dynamicId)
if not isCon then
local curSingleherodata = HeroManager.GetSingleHeroData(v.dynamicId)
local hp = FormationManager.GetFormationHeroHp(this.curFormationIndex,v.dynamicId)
if not upHeroSidTable[curSingleherodata.id] and hp > 0 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
end
this.SetCardsData()
this.OnClickTabBtn(proId)
end
return FormationPanelV2

View File

@ -346,7 +346,7 @@ function FormationSetPanel:FormationSureBtnClick()
end)
local limitNum = 1 -- 数量限制
if index > limitNum then
FormationManager.RefreshFormation(funForMationIds[funFormationId], selectHeroIdListData, FormationManager.formationList[funForMationIds[funFormationId]].teamPokemonInfos)
FormationManager.SaveFormation(funForMationIds[funFormationId], selectHeroIdListData, FormationManager.formationList[funForMationIds[funFormationId]].teamPokemonInfos)
PopupTipPanel.ShowTip(Language[10698])
else
PopupTipPanel.ShowTip(string.format(Language[10699], limitNum))

View File

@ -19,7 +19,7 @@ function this.On_Btn1_Click()
local isSkip = 0--ArenaManager.IsSkipFight() and 1 or 0
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))

View File

@ -28,7 +28,7 @@ function this.On_Btn2_Click()
end
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))

View File

@ -29,7 +29,7 @@ function this.On_Btn2_Click()
hadClick = true
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
this.OnCloseBtnClick()
else
@ -76,7 +76,18 @@ function this.InitView()
--this.root.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Arena })
end
-- 神将上阵下阵条件检测
function this.HeroUpDownCheck(params, checkFail, CheckSuccess)
if this.NoUpOrDownFormation then
if checkFail then
checkFail(Language[10691])
end
else
if CheckSuccess then
CheckSuccess(params)
end
end
end
return this

View File

@ -33,26 +33,7 @@ end
-- 扫荡按钮
--- btn1点击回调事件
function this.On_Btn1_Click()
-- this.root.SetOneKeyGo()
this.root.SetOneKeyCarBonGo()
--以前的换成的一键上阵
-- if CarbonManager.difficulty == CARBON_TYPE.ENDLESS and MapManager.Mapping then
-- if this.root.order>=1 then
-- --保存编队
-- FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
-- FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
-- PopupTipPanel.ShowTip("保存编队成功!")
-- else
-- PopupTipPanel.ShowTip("未上阵神将,无法保存阵容!")
-- end
-- return
-- end
-- 刷新扫荡数据--应该是没了
-- this.root.ShowStartMopUpInfoData()
-- -- 显示扫荡界面
-- this.root.mopUpGo:SetActive(true)
-- PlayUIAnim( this.root.mopUpGo)
this.root.SetOneKeyGo()
end
--- btn2点击回调事
@ -83,7 +64,7 @@ end
function this.On_Btn2_Click()
--保存编队
if this.root.order>=1 then
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
table.sort(FormationManager.formationList[this.root.curFormationIndex].teamHeroInfos,function(a,b)
return a.position < b.position
@ -99,7 +80,7 @@ function this.On_Btn2_Click()
if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
if MapManager.Mapping then--在地图里
if this.root.order>=1 then
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
PopupTipPanel.ShowTip(Language[10713])
else
@ -110,67 +91,6 @@ function this.On_Btn2_Click()
this.EnterMapbyType(CarbonManager.difficulty)--, itemId)
end
end
--+=======================================
-- if this.root.order>=1 then
-- --保存编队
-- FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
-- FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
-- else
-- PopupTipPanel.ShowTip(string.format("编队至少上阵%d个神将", 1))
-- return
-- end
-- -- 判断当前选择的副本类型
-- local itemId = itemType[CarbonManager.difficulty]
-- 无尽副本
-- if CarbonManager.difficulty == CARBON_TYPE.ENDLESS then
-- if #FormationManager.GetFormationByID(401).teamHeroInfos == 0 then
-- PopupTipPanel.ShowTip("未上阵神将,无法保存阵容!")
-- return
-- end
-- else
-- if #FormationManager.formationList[FormationManager.curFormationIndex].teamHeroInfos == 0 then
-- Log("q其他副本编队")
-- PopupTipPanel.ShowTip("未上阵神将,无法保存阵容!")
-- return
-- end
-- end
-- 判断挑战次数
-- if CarbonManager.difficulty == CARBON_TYPE.NORMAL then -- 普通副本
-- if BagManager.GetItemCountById(itemId) <= 0 and CarbonManager.GetNormalState(this.curMapId)then
-- PopupTipPanel.ShowTip("剧情副本剩余次数为0")
-- return
-- end
-- elseif CarbonManager.difficulty == CARBON_TYPE.HERO then -- 英雄副本
-- if BagManager.GetItemCountById(itemId) <= 0 then
-- PopupTipPanel.ShowTip("精英副本剩余次数为0")
-- UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.EliteCarbonTicket })
-- return
-- end
-- end
-- if CarbonManager.difficulty == CARBON_TYPE.NORMAL or CarbonManager.difficulty == CARBON_TYPE.HERO then
-- -- 战斗力判断
-- if this.root.formationPower <CarbonManager.recommendFightAbility[this.curMapId] then
-- MsgPanel.ShowTwo("当前队伍战力小于推荐战力,战斗可能会有失败风险。确定是否要继续进入副本?", function()
-- end, function()
-- -- 开始挑战
-- this.EnterMapbyType(CarbonManager.difficulty, itemId)
-- end, "取消", "确定"
-- )
-- else
-- this.EnterMapbyType(CarbonManager.difficulty, itemId)
-- end
-- else
-- --LogGreen("进入的副本difficulty:"..CarbonManager.difficulty.." itemId: "..tostring(itemId))
-- this.EnterMapbyType(CarbonManager.difficulty, itemId)
-- end
end
-- 根据不同的副本类型进入地图
@ -247,4 +167,28 @@ function this.EndLessCarbon()
--this.root.formTip:GetComponent("Text").text = Language[10717] .. gameConfig[1].EndlessMinLevel .. Language[10718]
end
-- 获取要显示得英雄列表
function this.GetHeroList()
if this.GetFormationIndex() == FormationTypeDef.FORMATION_ENDLESS_MAP then
return EndLessMapManager.GetHeroDataByProperty(ProIdConst.All)
else
return HeroManager.GetAllHeroDatas()
end
end
-- 获取一键上阵所需要的英雄列表
function this.GetOneKeyUpHeroList()
local heros = {}
local allHeros = this.GetHeroList()
for k, v in ipairs(allHeros) do
local hp = FormationManager.GetFormationHeroHp(this.GetFormationIndex(), v.dynamicId)
if hp > 0 then
table.insert(heros, v)
end
end
return heros
end
return this

View File

@ -4,6 +4,8 @@ local this = ExpeditionFormation
--- 是否需要切换编队的功能
this.IsNeedChangeFormation = false
local hadClick = false
-- 大闹天宫限制等级20
local limitLevel = 20
--local GetCurNodeInfo
this.nodeData = {}
--- 逻辑初始化
@ -20,7 +22,7 @@ end
--- btn1点击回调事件
function this.On_Btn1_Click()
this.root.SetOneKeyGoExpedition()
this.root.SetOneKeyGo()
end
function this.On_Btn2_Click()
@ -28,7 +30,7 @@ function this.On_Btn2_Click()
hadClick = true
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))
@ -81,5 +83,30 @@ function this.StartFight()
this.root:ClosePanel()
end)
end
-- 获取要显示得英雄列表
function this.GetHeroList(_proId)
local heros = {}
if not _proId or _proId == ProIdConst.All then
heros = HeroManager.GetAllHeroDatas(limitLevel)
heros = ExpeditionManager.GetAllHeroDatas(heros,limitLevel)
else
heros = HeroManager.GetHeroDataByProperty(_proId, limitLevel)
heros = ExpeditionManager.GetHeroDataByProperty(heros,_proId, limitLevel)
end
return heros
end
-- 获取要显示得英雄列表
function this.GetOneKeyUpHeroList()
local heros = {}
local allHeros = this.GetHeroList()
for k, v in ipairs(allHeros) do
local hp = FormationManager.GetFormationHeroHp(this.GetFormationIndex(), v.dynamicId)
if hp > 0 then
table.insert(heros, v)
end
end
return heros
end
return this

View File

@ -32,7 +32,7 @@ function this.On_Btn2_Click()
hadClick = true
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))
@ -78,4 +78,45 @@ function this.StartFight()
end)
end
-- 获取要显示得英雄列表
function this.GetHeroList(proId)
if this.GetFormationIndex() == FormationTypeDef.FIGHT_ASSISTANTLEVEL then
if not proId or proId == ProIdConst.All then
return FightLevelManager.GetAllHeroDatas(0, this.nodeData)
else
return FightLevelManager.GetHeroDataByProperty(proId, 0, this.nodeData)
end
else
if not proId or proId == ProIdConst.All then
return HeroManager.GetAllHeroDatas()
else
return HeroManager.GetHeroDataByProperty(proId, 0)
end
end
end
-- 获取一键上阵所需要的英雄列表
function this.GetOneKeyUpHeroList()
return this.GetHeroList()
end
-- 上下阵检测
function this.HeroUpDownCheck(params, checkFail, CheckSuccess)
if params.action == FORMATION_ACTION.UP then
if this.GetFormationIndex() == FormationTypeDef.FIGHT_ASSISTANTLEVEL then--山河社稷图判断上阵数量
local curmaxNum = FightLevelManager.GetFormationHeroMaxNum(this.nodeData)
if LengthOfTable(this.choosedList) >= curmaxNum then
if checkFail then
checkFail(Language[10689])
end
end
end
end
if CheckSuccess then
CheckSuccess(params)
end
end
return this

View File

@ -24,7 +24,7 @@ function this.On_Btn2_Click()
hadClick = true
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))

View File

@ -38,7 +38,7 @@ end
function this.On_Btn2_Click()
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))

View File

@ -27,7 +27,7 @@ function this.On_Btn2_Click()
hadClick = true
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))

View File

@ -27,7 +27,7 @@ function this.On_Btn2_Click()
end
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10701], 1))

View File

@ -20,7 +20,7 @@ end
function this.On_Btn2_Click()
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))

View File

@ -24,7 +24,7 @@ end
function this.On_Btn2_Click()
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(string.format(Language[10699], 1))

View File

@ -33,7 +33,7 @@ function this.On_Btn1_Click()
end
function this.On_Btn2_Click()
if this.root.order>=1 then
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
PopupTipPanel.ShowTip(Language[10713])
this.root:ClosePanel()

View File

@ -30,7 +30,7 @@ function this.On_Btn2_Click()
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
PopupTipPanel.ShowTip(Language[10700])
@ -76,7 +76,7 @@ end
function this.StartFight()
if this.root.order>=1 then
--保存编队
FormationManager.RefreshFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.SaveFormation(this.root.curFormationIndex, this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos)
else
hadClick = false

View File

@ -12,9 +12,9 @@ local checkFunc = function ()
this.lightList[j]:SetActive(false)
end
this.lightList[this.curIndex]:SetActive(true)
LogError("curindex=="..this.curIndex)
this.root.SetCurFormationIndex(this.curIndex+2000)
this.root.RefreshFormation(true,true)
local formationID = this.GetFormationIndex()
this.root.SetCurFormationIndex(formationID)
end
local switchFunc = function (type)
@ -43,7 +43,6 @@ local switchFunc = function (type)
end
--- 逻辑初始化
function this.Init(root,...)
this.root = root
@ -76,13 +75,10 @@ function this.Init(root,...)
Util.AddOnceClick(this.btnSwitch1,function ()
switchFunc(1)
checkFunc()
end)
Util.AddOnceClick(this.btnSwitch2,function ()
switchFunc(2)
checkFunc()
end)
--单个按钮
@ -93,46 +89,58 @@ function this.Init(root,...)
this.lightList[i] = Util.GetGameObject(this.numList[i],"Image")
this.lightList[i]:SetActive(false)
Util.AddOnceClick(this.numList[i],function ()
FormationManager.currentFormationIndex = this.GetFormationIndex()
this.root.RefreshFormation(false,false)
this.curIndex = i
checkFunc()
end)
end
this.lightList[this.curIndex]:SetActive(true)
for i = 2001, 2003 do
local team=FormationManager.GetFormationByID(i)
local team = FormationManager.GetFormationByID(i)
local cTeam = FormationManager.MakeAEmptyTeam(i)
for j = 1, #team.teamHeroInfos do
local teamInfo = team.teamHeroInfos[j]
table.insert(cTeam.teamHeroInfos, teamInfo)
--table.insert(allHeros,{Id=teamInfo.heroId,pos=teamInfo.position,index=i-2000})
allHeros[teamInfo.heroId]={Id=teamInfo.heroId,pos=teamInfo.position,index=i}
end
--缓存本地所有玉虚论道队伍的数据
-- table.insert(currAllTeams,team)
currAllTeams[i]=team
Log("玉虚初始化: 编队id:"..cTeam.teamId.. " 编队人数:"..#cTeam.teamHeroInfos)
currAllTeams[i]=cTeam
end
end
--- 获取需要显示的编队id
function this.GetFormationIndex()
return 2000 + this.curIndex
end
--移除缓存数据
function this.RemoveTeamByIndex(_index)
if currAllTeams[_index] then
currAllTeams[_index]={}
end
for key, value in pairs(allHeros) do
if value.index==_index then
table.removebyvalue(allHeros,value)
end
local value = currAllTeams[_index]
for i = 1, #value.teamHeroInfos do
allHeros[value.teamHeroInfos[i].heroId] = nil
end
currAllTeams[_index].teamHeroInfos = {}
end
--移除缓存数据
function this.RemoveHero(id)
--旧队伍里移除
for key, value in pairs(currAllTeams) do
for i = 1, #value.teamHeroInfos do
if value.teamHeroInfos[i].heroId==id then
table.removebyvalue(value.teamHeroInfos,value.teamHeroInfos[i])
break
end
end
end
allHeros[id] = nil
end
-- 改变神将编队
function this.ChangeHeroTeam(id,_index,_pos)
Log("玉虚ChangeHeroTeam: id:"..id)
Log(" _index ".._index)
Log(" _pos ".._pos)
local hero=nil
--旧队伍里移除
for key, value in pairs(currAllTeams) do
@ -180,37 +188,32 @@ end
function this.GetTeamInfoByIndex(index)
if currAllTeams[index] then
return currAllTeams[index]
return currAllTeams[index]
else
if index==2001 then
local team=FormationManager.GetFormationByID(this.curFormationIndex)
return team
else
return FormationManager.MakeAEmptyTeam(index)
end
local team=FormationManager.GetFormationByID(this.index)
return team
end
return nil
end
--改变编队id
function this.ChangeTeamIndex(type)
local one=currAllTeams[type+2000].teamHeroInfos
local two=currAllTeams[type+1+2000].teamHeroInfos
if one==nil then
one={}
end
if two==nil then
two={}
end
currAllTeams[type+2000].teamHeroInfos=two
currAllTeams[type+2000+1].teamHeroInfos=one
for key, value in pairs(allHeros) do
if value.index==type then
value.index=type+1
elseif value.index==type+1 then
value.index=type
end
end
local one=currAllTeams[type+2000].teamHeroInfos
local two=currAllTeams[type+1+2000].teamHeroInfos
if one==nil then
one={}
end
if two==nil then
two={}
end
currAllTeams[type+2000].teamHeroInfos=two
currAllTeams[type+2000+1].teamHeroInfos=one
for _, hero in ipairs(one) do
allHeros[hero.heroId].index = type+2000+1
end
for _, hero in ipairs(two) do
allHeros[hero.heroId].index = type+2000
end
end
@ -218,6 +221,11 @@ function this.ChangeTeamIndex(type)
function this.GetAllHeros()
return allHeros
end
function this.GetHeroTeam(dId)
if allHeros and allHeros[dId] then
return allHeros[dId].index
end
end
--- 关闭界面事件
function this.OnCloseBtnClick()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
@ -225,7 +233,7 @@ function this.OnCloseBtnClick()
end
function this.On_Btn1_Click()
this.root.SetOneKeyGoYuXunLunDao()
this.root.SetOneKeyGo()
end
--获取其他两队所有的英雄id
@ -245,37 +253,93 @@ function this.On_Btn2_Click()
local twoTeam={}
local threeTeam={}
local allTeam={}
if this.root.order>=1 then
--检测三个队伍是否有重复英雄
LogError(LengthOfTable(allHeros))
for key, value in pairs(allHeros) do
local newHero={}
newHero.heroId=value.Id
newHero.position=value.pos
LogError(" id=="..value.Id.." posi=="..value.pos)
if value.index==2001 then
table.insert(oneTeam,newHero)
elseif value.index==2002 then
table.insert(twoTeam,newHero)
elseif value.index==2003 then
table.insert(threeTeam,newHero)
end
end
table.insert(allTeam,oneTeam)
table.insert(allTeam,twoTeam)
table.insert(allTeam,threeTeam)
for i = 1, 3 do
FormationManager.RefreshFormation(i+2000, allTeam[i],
FormationManager.formationList[2001].teamPokemonInfos)
end
PopupTipPanel.ShowTip(Language[10713])
this.root:ClosePanel()
else
--检测三个队伍是否有重复英雄
local len = 0
for key, value in pairs(allHeros) do
local newHero={}
newHero.heroId=value.Id
newHero.position=value.pos
LogError(" id=="..value.Id.." posi=="..value.pos)
if value.index==2001 then
table.insert(oneTeam,newHero)
elseif value.index==2002 then
table.insert(twoTeam,newHero)
elseif value.index==2003 then
table.insert(threeTeam,newHero)
end
len = len + 1
end
if len <= 0 then
PopupTipPanel.ShowTip(string.format(Language[10699], 1))
return
end
table.insert(allTeam,oneTeam)
table.insert(allTeam,twoTeam)
table.insert(allTeam,threeTeam)
for i = 1, 3 do
FormationManager.SaveFormation(i+2000, allTeam[i],
FormationManager.formationList[2001].teamPokemonInfos)
end
PopupTipPanel.ShowTip(Language[10713])
this.root:ClosePanel()
end
-- 获取要显示得英雄列表
function this.GetHeroList()
return HeroManager.GetAllHeroDatas()
end
-- 获取一键上阵所需要的英雄列表
function this.GetOneKeyUpHeroList()
local heros = {}
local allHeros = this.GetHeroList()
--获取其他队伍上阵的英雄id
local ids = this.GetOtherTeamAllHeroIds(this.GetFormationIndex())
for k, v in ipairs(allHeros) do
local isCon = table.indexof(ids,v.dynamicId)
if not isCon then
table.insert(heros, v)
end
end
return heros
end
function this.HeroUpDownCheck(params, checkFail, CheckSuccess)
if params.action == FORMATION_ACTION.UP then
local team = this.GetHeroTeam(params.heroData.dynamicId)
if team then
if team ~= this.GetFormationIndex() then
MsgPanel.ShowTwo("该神将正处于其他队伍,是否要编入当前队伍内",nil, function()
if params.position and params.position ~= 0 then
--改变英雄队伍id改变
this.ChangeHeroTeam(params.heroData.dynamicId, this.GetFormationIndex(), params.position)
end
if CheckSuccess then
CheckSuccess(params)
end
end)
end
else
if CheckSuccess then
if params.position and params.position ~= 0 then
--改变英雄队伍id改变
this.AddHeroToTeam(params.heroData.dynamicId, params.position, this.GetFormationIndex())
end
CheckSuccess(params)
end
end
elseif params.action == FORMATION_ACTION.DOWN then
this.RemoveHero(params.heroData.dynamicId)
if CheckSuccess then
CheckSuccess(params)
end
end
end
function this.GetCurFormation()
return this.GetTeamInfoByIndex(this.GetFormationIndex())
end
return this

View File

@ -37,14 +37,52 @@ end
--- btn1点击回调事件
function this.On_Btn1_Click()
this.root.SetOneKeyGoWithCondition(data.teamRules)
this.root.SetOneKeyGo()
end
-- 获取全部符合条件的神将列表
function this.GetHeroList(propId)
local allHeros = HeroManager.GetAllHeroDatas()
-- 限制属性
if propId and propId ~= ProIdConst.All then
local tempHeros = {}
for k, v in ipairs(allHeros) do
if propId == v.heroConfig.PropertyName then
table.insert(tempHeros, v)
end
end
return tempHeros
end
return allHeros
end
-- 获取一键上阵所需要的英雄列表
function this.GetOneKeyUpHeroList()
local rulesNum = data.teamRules[1][2]
local heros = {}
local tempHeros = this.GetHeroList(data.teamRules[1][1])
--按战力从大到小排序
table.sort(tempHeros,function(a,b)
if a.warPower == b.warPower then
return a.id > b.id
else
return a.warPower > b.warPower
end
end)
-- 限制数量
for k, v in ipairs(tempHeros) do
if #heros < rulesNum then
table.insert(heros, v)
end
end
return heros
end
-- 进入地图
function this.On_Btn2_Click()
if index >= data.teamRules[1][2] then
--保存编队
FormationManager.RefreshFormation(
FormationManager.SaveFormation(
this.root.curFormationIndex,
this.root.choosedList,
FormationManager.formationList[this.root.curFormationIndex].teamPokemonInfos

View File

@ -24,8 +24,8 @@ local type = {
livePos = Vector2(274.5, -408.1),
liveSize = Vector2(1612, 1802),
tipBg = "r_Dungeon_juqingdian",
resetTime = string.format("<color=#BA9AC2>%s</color>",specialConfig[97].Value),
tip = string.format("<color=#BA9AC2>%s</color>",specialConfig[97].Value),
resetTime = string.format("<color=#A5ADD1>%s</color>",specialConfig[127].Value),
tip = string.format("<color=#A5ADD1>%s</color>",specialConfig[127].Value),
redPointType = RedPointType.JumpServer_HightLadder,
tipStr = "",
state = 1
@ -45,7 +45,7 @@ function JumpServerPanel:InitComponent()
self.spLoader = SpriteLoader.New()
-- 屏幕适配修改
self.btnRoot = Util.GetGameObject(self.gameObject, "btnRoot")
self.btnRoot.transform.localScale = Vector3.one * UIManager.adapterScale
-- self.btnRoot.transform.localScale = Vector3.one * UIManager.adapterScale
self.carbons = {}
self.carbonsRedPoint = {}
@ -198,8 +198,28 @@ function JumpServerPanel:SystemState(id,fun)
end
func()
end)
elseif id== JumpServer_Type.HightLadder then
elseif id== JumpServer_Type.YuXuLunDao then
-- 判断功能是否开启
if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.JumpServer_YuXu) then
type[id].state = -1
type[id].tipStr = ActTimeCtrlManager.GetFuncTip( FUNCTION_OPEN_TYPE.JumpServer_YuXu)
func()
return
end
-- 跨服相关判断
JumpServerManager.GetWorldArenaInfoRequest(function()
if not JumpServerManager.GetHightLadderDataIsStart() then
type[id].state = -4
type[id].tipStr = string.format("开服第%s周开放",ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,1).OpenWeek)
elseif not JumpServerManager.GetHightLadderDataIsGroup() then
type[id].state = -5
type[id].tipStr = "未划分跨服分组,无法参与!"
else
type[id].state = 1
type[id].tipStr = ""
end
func()
end)
end
end

View File

@ -84,7 +84,7 @@ function this:BindEvent()
local curFormation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_DREAMLAND)
local choosedList={}
table.insert(choosedList, {heroId = MapTrialManager.selectHeroDid, position=2})
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_DREAMLAND,choosedList,
FormationManager.SaveFormation(FormationTypeDef.FORMATION_DREAMLAND,choosedList,
FormationManager.formationList[FormationTypeDef.FORMATION_DREAMLAND].teamPokemonInfos)
--请求战斗数据

View File

@ -326,7 +326,7 @@ local directFight = function(showType, eventId, showValues, options)
local curFormation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_DREAMLAND)
local choosedList={}
table.insert(choosedList, {heroId = MapTrialManager.selectHeroDid, position=2})
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_DREAMLAND,choosedList,
FormationManager.SaveFormation(FormationTypeDef.FORMATION_DREAMLAND,choosedList,
FormationManager.formationList[FormationTypeDef.FORMATION_DREAMLAND].teamPokemonInfos)
NetManager.QuickFightRequest(function(msg)

View File

@ -69,7 +69,7 @@ local jumpDic = {
-- singleData.position = index
-- table.insert(newFormation, singleData)
-- end
-- FormationManager.RefreshFormation(FormationTypeDef.FORMATION_ARENA_ATTACK,newFormation,formation.teamPokemonInfos)
-- FormationManager.SaveFormation(FormationTypeDef.FORMATION_ARENA_ATTACK,newFormation,formation.teamPokemonInfos)
-- end
if #arenaDefend.teamHeroInfos == 0 then
-- LogColor("red","竞技防守编队为空")
@ -82,7 +82,7 @@ local jumpDic = {
singleData.position = index
table.insert(newFormation, singleData)
end
FormationManager.RefreshFormation(FormationTypeDef.FORMATION_ARENA_DEFEND,newFormation,formation.teamPokemonInfos)
FormationManager.SaveFormation(FormationTypeDef.FORMATION_ARENA_DEFEND,newFormation,formation.teamPokemonInfos)
-- UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.ARENA_DEFEND)
-- PopupTipPanel.ShowTip("请先设置防守阵容")
--this.isOpen = false

View File

@ -80,7 +80,7 @@ function DiffmonsterEditPopup:BindEvent()
table.insert(pokemonList,{selectPokemonIdList[i][1],selectPokemonIdList[i][2]})
table.insert(selectPokemonIdListData,singleData)
end
FormationManager.RefreshFormation(curFormationIndex, FormationManager.formationList[curFormationIndex].teamHeroInfos,selectPokemonIdListData,true)
FormationManager.SaveFormation(curFormationIndex, FormationManager.formationList[curFormationIndex].teamHeroInfos,selectPokemonIdListData,true)
openPanel.UpdataYiYaoData(pokemonList)
self:ClosePanel()
end)

View File

@ -70,7 +70,7 @@ function this:OnShow(_parent,...)
local heroDatas={}
for k, v in ConfigPairs(equipConfig) do
if v.Position==5 and v.Quality==6 then
if BattleUtil.ChecklistIsContainValue(this.currHeroIds,v.Id) then
if table.indexof(this.currHeroIds,v.Id) then
table.insert(heroDatas,1,itemConfig[v.Id])
else
table.insert(heroDatas,itemConfig[v.Id])
@ -113,7 +113,7 @@ function this.SingleHeroDataShow(go,_heroData)
local selectObj=Util.GetGameObject(_go.transform, "choosed"):GetComponent("Image")
selectObj.sprite=this.spLoader:LoadSprite("r_chouka_yixuanding")
local isHave=BattleUtil.ChecklistIsContainValue(this.currHeroIds,heroData.Id)
local isHave = table.indexof(this.currHeroIds,heroData.Id)
selectObj.gameObject:SetActive(isHave)
Util.AddOnceClick(btn, function()
if #this.currHeroIds==3 and not isHave then

View File

@ -1,43 +1,53 @@
require("Base/BasePanel")
local WorldArenaMyTeamPanel = Inherit(BasePanel)
local function OnBeginDrag(self, Pointgo, data)
local function OnBeginDrag(self, Pointgo, data, index)
self.chooseIndex = index
self.oldGrid = Pointgo.transform.parent.parent
self.tempInfo.transform.localPosition = Pointgo.transform.parent.parent.localPosition
Pointgo.transform.parent:SetParent(self.tempInfo.transform)
Pointgo.transform.parent.localPosition = Vector3.zero
end
local function OnDrag(self, Pointgo, data)
local function OnDrag(self, Pointgo, data, index)
local pos = self.tempInfo.transform.localPosition
local y = pos.y + data.delta.y >= -300 and pos.y + data.delta.y or -300
y = y <= 500 and y or 500
self.tempInfo.transform.localPosition = Vector2.New(pos.x , y)
end
local function OnEndDrag(self, Pointgo, data)
local function OnEndDrag(self, Pointgo, data, index)
Pointgo.transform.parent.localPosition = Vector3.zero
local num = 99999
local obj = nil
local finalIndex = nil
for i = 1, 3 do
local dis = math.abs( self.tempInfo.transform.localPosition.y - self.gridList[i].transform.localPosition.y )
if dis <= num then
num = dis
obj = self.gridList[i]
finalIndex = i
end
end
if obj.transform.childCount > 0 then
local targetInfo = obj.transform:GetChild(0)
targetInfo:SetParent(self.oldGrid.transform)
targetInfo.localPosition = Vector3.zero
else
obj = self.oldGrid
end
obj = self.oldGrid
local curInfo = self.tempInfo.transform:GetChild(0)
curInfo:SetParent(obj.transform)
curInfo.localPosition = Vector3.zero
for i = 1, 3 do
self.InfoList[i] = Util.GetGameObject(self.Content, "Grid ("..i..")/Info")
-- WorldArenaMyTeamPanel:Refresh()
if self.chooseIndex ~= finalIndex then
-- 交换编队数据
local tempFormation = self.curFormation[2000 + self.chooseIndex]
self.curFormation[2000 + self.chooseIndex] = self.curFormation[2000 + finalIndex]
self.curFormation[2000 + finalIndex] = tempFormation
-- 保存
for i = 1, 3 do
local heros = {}
for _, hero in ipairs(self.curFormation[i+2000].teamHeroInfos) do
table.insert(heros, {heroId = hero.heroId, position = hero.position})
end
FormationManager.SaveFormation(i+2000, heros,
FormationManager.formationList[2001].teamPokemonInfos)
end
-- 刷新显示
WorldArenaMyTeamPanel:Refresh(false)
end
end
@ -46,9 +56,9 @@ function WorldArenaMyTeamPanel:InitComponent()
self.btnBack = Util.GetGameObject(self.gameObject, "Frame/BackBtn")
self.mask = Util.GetGameObject(self.gameObject, "mask")
self.Content = Util.GetGameObject(self.gameObject, "Frame/Content")
self.OnBeginDrag = function(p,d) OnBeginDrag(self,p,d) end
self.OnDrag= function(p,d) OnDrag(self,p,d) end
self.OnEndDrag= function(p,d) OnEndDrag(self,p,d) end
-- self.OnBeginDrag = function(p,d) OnBeginDrag(self,p,d) end
-- self.OnDrag= function(p,d) OnDrag(self,p,d) end
-- self.OnEndDrag= function(p,d) OnEndDrag(self,p,d) end
self.tempInfo = Util.GetGameObject(self.Content, "tempInfo")
self.InfoList = {}
@ -61,9 +71,9 @@ function WorldArenaMyTeamPanel:InitComponent()
self.dragViewList[i] = SubUIManager.Open(SubUIConfig.DragView, self.InfoList[i].transform)
self.dragViewList[i].transform:SetSiblingIndex(1)
self.triggerList[i]=Util.GetEventTriggerListener(self.dragViewList[i].gameObject)
self.triggerList[i].onBeginDrag = self.triggerList[i].onBeginDrag + self.OnBeginDrag
self.triggerList[i].onDrag = self.triggerList[i].onDrag + self.OnDrag
self.triggerList[i].onEndDrag = self.triggerList[i].onEndDrag + self.OnEndDrag
self.triggerList[i].onBeginDrag = self.triggerList[i].onBeginDrag + function(p,d) OnBeginDrag(self, p, d, i) end
self.triggerList[i].onDrag = self.triggerList[i].onDrag + function(p,d) OnDrag(self, p, d, i) end
self.triggerList[i].onEndDrag = self.triggerList[i].onEndDrag + function(p,d) OnEndDrag(self, p, d, i) end
end
self.Heros = {}
for i = 1, 3 do
@ -99,19 +109,31 @@ end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function WorldArenaMyTeamPanel:OnShow()
WorldArenaMyTeamPanel:Refresh()
WorldArenaMyTeamPanel:Refresh(true)
end
function WorldArenaMyTeamPanel:Refresh()
function WorldArenaMyTeamPanel:Refresh(isReGet)
-- NetManager.GetPlayerCrossYxldOneTeamInfoRequest(PlayerManager.uid,0,function(msg)
-- for i = 1, 3 do
-- WorldArenaMyTeamPanel:SetSingleFormation(self.InfoList[i],msg.teamInfo.crossTeam[1],i)
-- end
-- end)
for i = 1, 3 do
local team=FormationManager.GetFormationByID(i+2000)
WorldArenaMyTeamPanel:SetSingleFormation(self.InfoList[i],team.teamHeroInfos,i)
end
-- end
if isReGet then
self.curFormation = {}
for i = 1, 3 do
local team=FormationManager.GetFormationByID(i+2000)
local cTeam = FormationManager.MakeAEmptyTeam(i+2000)
for j = 1, #team.teamHeroInfos do
table.insert(cTeam.teamHeroInfos, team.teamHeroInfos[j])
end
self.curFormation[i+2000] = cTeam
WorldArenaMyTeamPanel:SetSingleFormation(self.InfoList[i],cTeam.teamHeroInfos,i)
end
else
for i = 1, 3 do
WorldArenaMyTeamPanel:SetSingleFormation(self.InfoList[i], self.curFormation[2000+i].teamHeroInfos, i)
end
end
end
function WorldArenaMyTeamPanel:SetSingleFormation(go,data,index)