灵兽提交 上阵提交

zhangqiang 2020-10-21 11:58:16 +08:00
parent 3a6c14f607
commit f8d6c63368
6 changed files with 5702 additions and 5473 deletions

View File

@ -4520,9 +4520,9 @@ end
function this.ReplaceTeamPokemonInfoRequest(_teamPokemonInfos, func)
local data = HeroInfoProto_pb.ReplaceTeamPokemonInfoRequest()
for i = 1, #_teamPokemonInfos do
LogPink("_teamPokemonInfos[i] ".._teamPokemonInfos[i].position)
-- data.teamPokemonInfos:append(_teamPokemonInfos[i])
-- LogPink("_teamPokemonInfos[i] ".._teamPokemonInfos[i].position)
if _teamPokemonInfos[i] and _teamPokemonInfos[i].pokemonId then
-- LogPink(" _teamPokemonInfos[i].pokemonId ".. _teamPokemonInfos[i].pokemonId)
local c = data.teamPokemonInfos:add()
c.position = _teamPokemonInfos[i].position
c.pokemonId =_teamPokemonInfos[i].pokemonId

View File

@ -159,7 +159,7 @@ function PokemonInfoPanel:BindEvent()
end
NetManager.ReplaceTeamPokemonInfoRequest(curFormation, function()
local oldWarPower = 0
PokemonManager.RefreshPokemonFormation(Pokemon_Formation_RefreshType.DownZhen,curPokemonData.dynamicId)
PokemonManager.RefreshPokemonFormation(curFormation)
local newWarPower = 0
--飘战力
PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower)

View File

@ -147,7 +147,7 @@ function this.ShowSinglePokemonList(go,singleData,liveIndex)
end)
elseif state == 3 then
addInfo:SetActive(true)
Util.AddOnceClick( Util.GetGameObject(go, "addInfo/addInfo/addClick"), function()
Util.AddOnceClick( Util.GetGameObject(go, "addInfo/addInfo/addClick"..liveIndex), function()
UIManager.OpenPanel(UIName.PokemonListPanel,Pokemon_Popup_Type.PokemonListPanel_UpWar,nil,liveIndex)
end)
elseif state == 4 then
@ -164,13 +164,18 @@ function this.ShowSinglePokemonList(go,singleData,liveIndex)
end
local curData = PokemonManager.GetSinglePokemonData( singleData.pokemonId)
local LiveName = curData.live
local live2d = poolManager:LoadLive(LiveName, curPokemonLive.transform,Vector3.one * 0.3, Vector3.New(curData.position[1],curData.position[2],0))--curData.scale
local live2d = poolManager:LoadLive(LiveName, curPokemonLive.transform,Vector3.one * 0.2, Vector3.New(curData.position[1],curData.position[2],0))--curData.scale
live2dList[liveIndex] = {name=curData.live, go=live2d}
local starSize = Vector2.New(65,65)
SetHeroStars(Util.GetGameObject(go, "upZhenInfo/starGrid"), curData.star,1,starSize,0,Vector2.New(0.5,0.5))
Util.AddOnceClick( Util.GetGameObject(go, "upZhenInfo/upZhenClick"), function()
UIManager.OpenPanel(UIName.PokemonInfoPanel,curData,PokemonManager.GetPokemonDatas())
end)
-- Util.AddOnceClick( Util.GetGameObject(go, "upZhenInfo/upZhenClick"), function()
-- UIManager.OpenPanel(UIName.PokemonInfoPanel,curData,PokemonManager.GetPokemonDatas())
-- end)
--英雄长按
local heroClick=Util.GetGameObject(PokemonList[liveIndex],"DragView"..liveIndex)
Util.AddLongPressClick(heroClick, function()
UIManager.OpenPanel(UIName.PokemonInfoPanel,curData,PokemonManager.GetPokemonDatas())
end, 0.5)
end
end
@ -239,31 +244,28 @@ function this.OnEndDrag(Pointgo,data)--结束拖动
PokemonDataList[i].pokemonId=curData
end
end
elseif nameIn=="singlePokemon (".._i..")" then --没人
-- Log("没人")
elseif nameIn=="addClick".._i then
local did
for i, v in ipairs(PokemonDataList) do
if _j==v.position then
did=v.pokemonId
table.remove(PokemonDataList,i)
v.pokemonId = nil
end
end
for i, v in ipairs(PokemonDataList) do
if _i==v.position then
v.pokemonId=did
end
end
table.insert(PokemonDataList, {pokemonId = did, position=_i})
elseif nameIn=="addInfo" or nameIn=="lockInfo" 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)
-- dragViewListGo[_j].gameObject:SetActive(false)
-- break
-- end
-- end
-- else
-- PopupTipPanel.ShowTip(Language[12206])
-- end
end
this.line.gameObject:SetActive(false)
NetManager.ReplaceTeamPokemonInfoRequest(PokemonDataList, function()
local oldWarPower = 0
PokemonManager.RefreshPokemonFormation(PokemonDataList)
local newWarPower = 0
--飘战力
PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower)
end)
this.ShowPokemonList()
end
function this.OnDrag(Pointgo,data)--拖动中
@ -275,7 +277,8 @@ function this.OnDrag(Pointgo,data)--拖动中
local _i=tonumber(string.sub(data.pointerEnter.gameObject.name,-1))
if _i==nil then _i=0 end
local nameIn=data.pointerEnter.gameObject.name --进入的UI名
this.line:SetActive(nameIn=="DragView".._i or nameIn=="singlePokemon (".._i..")")
LogPink("进入的UI名nameIn "..nameIn)
this.line:SetActive(nameIn=="DragView".._i or nameIn=="singlePokemon (".._i..")" or nameIn=="addClick".._i)
if nameIn=="DragView".._i then
this.line.transform:SetParent(PokemonList[_i].transform)
this.line:GetComponent("RectTransform").localPosition = Vector3.New(0,45,0)
@ -284,6 +287,10 @@ function this.OnDrag(Pointgo,data)--拖动中
this.line.transform:SetParent(PokemonList[_i].transform)
this.line:GetComponent("RectTransform").localPosition = Vector3.New(0,45,0)
this.line:GetComponent("RectTransform").localScale = Vector3.New(1,1,1)
elseif nameIn=="addClick".._i then
this.line.transform:SetParent(PokemonList[_i].transform)
this.line:GetComponent("RectTransform").localPosition = Vector3.New(0,45,0)
this.line:GetComponent("RectTransform").localScale = Vector3.New(1,1,1)
else
this.line.transform:SetParent(this.roleGrid.transform)
this.line.gameObject:SetActive(false)

View File

@ -231,13 +231,10 @@ end
--刷新本地灵兽编队数据
function this.UpdatePokemonFormationDatas(_msgPokemonFormationList)
for i = 1, #pokemonFormation do
if _msgPokemonFormationList[i] and _msgPokemonFormationList[i].pokemonId then
if i == _msgPokemonFormationList[i].position then
LogPink("_msgPokemonFormationList[i].pokemonId ".._msgPokemonFormationList[i].pokemonId)
pokemonFormation[i].pokemonId = _msgPokemonFormationList[i].pokemonId
end
end
-- LogPink("# _msgPokemonFormationList "..# _msgPokemonFormationList)
for i = 1, #_msgPokemonFormationList do
-- LogPink("_msgPokemonFormationList[i].pokemonId ".._msgPokemonFormationList[i].pokemonId)
pokemonFormation[_msgPokemonFormationList[i].position].pokemonId = _msgPokemonFormationList[i].pokemonId
end
end
--获取变队形信息
@ -276,23 +273,12 @@ function this.GetPokemonFormationAddPro()
return allPro
end
--刷新编队信息 type 1 上阵 2 下阵 3 替换(上阵)
function this.RefreshPokemonFormation(type,did,pos)
function this.RefreshPokemonFormation(_pokemonFormation)
for i = 1, #pokemonFormation do
if pos then
if pokemonFormation[i].position == pos then
if type == Pokemon_Formation_RefreshType.UpZhen then
pokemonFormation[i].pokemonId = did
elseif type == Pokemon_Formation_RefreshType.DownZhen then
pokemonFormation[i].pokemonId = nil
elseif type == Pokemon_Formation_RefreshType.Replace then
pokemonFormation[i].pokemonId = did
end
end
else--只有下阵
if type == Pokemon_Formation_RefreshType.DownZhen then
if pokemonFormation[i].pokemonId == did then
pokemonFormation[i].pokemonId = nil
end
if _pokemonFormation[i] and _pokemonFormation[i].pokemonId then
if i == _pokemonFormation[i].position then
-- LogPink("_msgPokemonFormationList[i].pokemonId ".._pokemonFormation[i].pokemonId)
pokemonFormation[i].pokemonId = _pokemonFormation[i].pokemonId
end
end
end

View File

@ -35,8 +35,9 @@ local sortingOrder = 0
function this:OnSortingOrderChange(_sortingOrder)
sortingOrder = _sortingOrder
end
local parent
function this:OnShow(_parent,_curUpZhenPokemonData,_upZhenIndex)
parent = _parent
curUpZhenPokemonData = _curUpZhenPokemonData
upZhenIndex = _upZhenIndex
polemonList = PokemonManager.GetCanUpZhenPokemonDatas()
@ -87,10 +88,11 @@ function this.SingleItemDataShow(_go,_itemData)
end
end
if pos then
PokemonManager.RefreshPokemonFormation(Pokemon_Formation_RefreshType.UpZhen,_itemData.dynamicId,pos)
PokemonManager.RefreshPokemonFormation(allPokemonFormation)
end
local newWarPower = 0
PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower)
parent:ClosePanel()
else
--上阵 协议
-- NetManager
@ -107,13 +109,13 @@ function this.SingleItemDataShow(_go,_itemData)
local oldWarPower = 0
if upZhenIndex then
PokemonManager.RefreshPokemonFormation(Pokemon_Formation_RefreshType.UpZhen,_itemData.dynamicId,upZhenIndex)
PokemonManager.RefreshPokemonFormation(curFormation)
end
local newWarPower = 0
--飘战力
PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower)
end)
parent:ClosePanel()
end
end)