编对拖动英雄保存队伍修改

dev_chengFeng
wangzhenxing 2021-09-10 21:34:45 +08:00
parent 16289857a5
commit 489f6f7e37
3 changed files with 35 additions and 4 deletions

View File

@ -559,6 +559,9 @@ end
--设置英雄列表数据
function this.SetRoleList(_roleDatas, isTop,isAni)
this.SortHeroDatas(_roleDatas)
if this.curFormationIndex==2001 or this.curFormationIndex==2002 or this.curFormationIndex==2003 then
this.opView.RemoveTeamByIndex(this.curFormationIndex)
end
-- local curFormation = FormationManager.formationList[this.curFormationIndex]
this.scrollView:SetData(_roleDatas, function(index, go)
this.SingleHeroDataShow(go, _roleDatas[index])
@ -732,6 +735,9 @@ 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
end
if panelType == FORMATION_TYPE.WORLDARENA then

View File

@ -91,6 +91,22 @@ local function OnEndDrag(self, Pointgo, data)
curInfo.transform:SetSiblingIndex(1)
curInfo.localPosition = Vector3.New(0,-67,0)
LogError("起始id=="..currIndex.." 终点id=="..targetIndex)
if currIndex ~= targetIndex then
-- 交换编队数据
local tempFormation = self.curFormation[2000 + currIndex]
self.curFormation[2000 + currIndex] = self.curFormation[2000 + targetIndex]
self.curFormation[2000 + targetIndex] = 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
end
end
--初始化组件(用于子类重写)
function WorldArenaBattleInfoPanel:InitComponent()
@ -377,6 +393,16 @@ function WorldArenaBattleInfoPanel:OnOpen(msg,_type,closeFunc,list)
end
this.ShowInfo(msg)
this.RefreshBattleCastInfo()
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
end
end
function this.ShowInfo(msg)

View File

@ -268,10 +268,9 @@ function this.ShowRewardBoxProgressData()
return
elseif state == 2 then
NetManager.CrossYuXuLunDaoGetDailyRewardRequest(i, function(msg)
allBoxGetState[i]=3
this.ShowRewardBoxProgressData()
allBoxGetState[i]=2
--this.ShowRewardBoxProgressData()
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function ()
CheckRedPointStatus(RedPointType.Arena_Reward)
end)
end)
@ -280,7 +279,7 @@ function this.ShowRewardBoxProgressData()
end
end
this.progressImage.fillAmount = allNums/maxNum
this.progressTipText.text = Language[10102]..allNums..Language[10048]
this.progressTipText.text = "今日挑战"
end