From 80c949c54d5a881e7d3cb64d412621fd621c83bb Mon Sep 17 00:00:00 2001 From: zhangqiang <657634622@qq.com> Date: Fri, 27 Nov 2020 10:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=81=B5=E5=85=BD=E3=80=91=20?= =?UTF-8?q?=E7=81=B5=E5=85=BD=E6=95=B0=E6=8D=AE=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Message/HeroInfoProto_pb.lua | 20 ++++++++++++++++ .../~Lua/Modules/Login/LoginPanel.lua | 2 +- .../~Lua/Modules/Net/NetManager.lua | 23 ++++++++++++------- .../~Lua/Modules/Pokemon/PokemonManager.lua | 21 ++++++++++------- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Message/HeroInfoProto_pb.lua b/Assets/ManagedResources/~Lua/Message/HeroInfoProto_pb.lua index 517ee3c3dc..c10e3771a9 100644 --- a/Assets/ManagedResources/~Lua/Message/HeroInfoProto_pb.lua +++ b/Assets/ManagedResources/~Lua/Message/HeroInfoProto_pb.lua @@ -79,6 +79,8 @@ GETALLEQUIPREQUEST_TYPE_FIELD = protobuf.FieldDescriptor(); GETALLEQUIPRESPONSE = protobuf.Descriptor(); GETALLEQUIPRESPONSE_EQUIP_FIELD = protobuf.FieldDescriptor(); GETALLEQUIPRESPONSE_ISSENDFINISH_FIELD = protobuf.FieldDescriptor(); +GETALLPOKEMONREQUEST = protobuf.Descriptor(); +GETALLPOKEMONREQUEST_START_FIELD = protobuf.FieldDescriptor(); GETALLPOKEMONRESPONSE = protobuf.Descriptor(); GETALLPOKEMONRESPONSE_POKEMONINFO_FIELD = protobuf.FieldDescriptor(); GETALLPOKEMONRESPONSE_TEAMPOKEMONINFOS_FIELD = protobuf.FieldDescriptor(); @@ -849,6 +851,23 @@ GETALLEQUIPRESPONSE.enum_types = {} GETALLEQUIPRESPONSE.fields = {GETALLEQUIPRESPONSE_EQUIP_FIELD, GETALLEQUIPRESPONSE_ISSENDFINISH_FIELD} GETALLEQUIPRESPONSE.is_extendable = false GETALLEQUIPRESPONSE.extensions = {} +GETALLPOKEMONREQUEST_START_FIELD.name = "start" +GETALLPOKEMONREQUEST_START_FIELD.full_name = ".com.ljsd.jieling.protocols.GetAllPokemonRequest.start" +GETALLPOKEMONREQUEST_START_FIELD.number = 1 +GETALLPOKEMONREQUEST_START_FIELD.index = 0 +GETALLPOKEMONREQUEST_START_FIELD.label = 1 +GETALLPOKEMONREQUEST_START_FIELD.has_default_value = false +GETALLPOKEMONREQUEST_START_FIELD.default_value = 0 +GETALLPOKEMONREQUEST_START_FIELD.type = 5 +GETALLPOKEMONREQUEST_START_FIELD.cpp_type = 1 + +GETALLPOKEMONREQUEST.name = "GetAllPokemonRequest" +GETALLPOKEMONREQUEST.full_name = ".com.ljsd.jieling.protocols.GetAllPokemonRequest" +GETALLPOKEMONREQUEST.nested_types = {} +GETALLPOKEMONREQUEST.enum_types = {} +GETALLPOKEMONREQUEST.fields = {GETALLPOKEMONREQUEST_START_FIELD} +GETALLPOKEMONREQUEST.is_extendable = false +GETALLPOKEMONREQUEST.extensions = {} GETALLPOKEMONRESPONSE_POKEMONINFO_FIELD.name = "pokemonInfo" GETALLPOKEMONRESPONSE_POKEMONINFO_FIELD.full_name = ".com.ljsd.jieling.protocols.GetAllPokemonResponse.pokemonInfo" GETALLPOKEMONRESPONSE_POKEMONINFO_FIELD.number = 1 @@ -1604,6 +1623,7 @@ EspecialEquipBackRequest = protobuf.Message(ESPECIALEQUIPBACKREQUEST) EspecialEquipBackResponse = protobuf.Message(ESPECIALEQUIPBACKRESPONSE) GetAllEquipRequest = protobuf.Message(GETALLEQUIPREQUEST) GetAllEquipResponse = protobuf.Message(GETALLEQUIPRESPONSE) +GetAllPokemonRequest = protobuf.Message(GETALLPOKEMONREQUEST) GetAllPokemonResponse = protobuf.Message(GETALLPOKEMONRESPONSE) GetAllRingFireResponse = protobuf.Message(GETALLRINGFIRERESPONSE) GetAllSkinResponse = protobuf.Message(GETALLSKINRESPONSE) diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua index 7250cffe07..7bb88fd3b1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua @@ -449,7 +449,7 @@ function this.ExecuteLoading() --[[[4] = ]]function() NetManager.AllEquipRequest(0, LoadingPanel.OnStep) end, -- 装备 --[[[5] = ]]function() NetManager.AllEquipTreasureRequest(0, LoadingPanel.OnStep) end, -- --[[[6] = ]]function() NetManager.GetSoulPrintDataRequest(0, LoadingPanel.OnStep) end, -- 魂印 - --[[[7] = ]]function() NetManager.DiffMonsterRequest(LoadingPanel.OnStep) end, -- 异妖 + --[[[7] = ]]function() NetManager.DiffMonsterRequest(0,LoadingPanel.OnStep) end, -- 异妖 --[[[8] = ]]function() NetManager.HeroInfoRequest(0, LoadingPanel.OnStep) end, -- --[[[9] = ]]function() NetManager.TeamInfoRequest(LoadingPanel.OnStep) end, -- 编队 --[[[10] =]] function() NetManager.GetAllMailData(LoadingPanel.OnStep) end, -- 邮件 diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 7dc6ec90cd..6dbcba323f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -904,18 +904,25 @@ function this.MissionOpenRequest(missionId, func) end --请求获取异妖消息 -function this.DiffMonsterRequest(func) - Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_POKEMON_REQUEST, MessageTypeProto_pb.GET_ALL_POKEMON_RESPONSE, nil, function(buffer) +function this.DiffMonsterRequest(_start,func) + local data = HeroInfoProto_pb.GetAllPokemonRequest() + data.start = _start + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.GET_ALL_POKEMON_REQUEST, MessageTypeProto_pb.GET_ALL_POKEMON_RESPONSE, msg, function(buffer) local data = buffer:DataByte() local msg = HeroInfoProto_pb.GetAllPokemonResponse() msg:ParseFromString(data) - PokemonManager.InitPokemonsData(msg.pokemonInfo)--pokemonInfo) - PokemonManager.UpdatePokemonFormationDatas(msg.teamPokemonInfos)--msg.pokemonInfo) - PokemonManager.InitPokemonsFetterData(msg.pokemonBookEnabled) - PokemonManager.InitPokemonsGetrData(msg.pokemonGot) - if func then - func(msg) + if not msg.pokemonInfo or (msg.pokemonInfo and #msg.pokemonInfo < 20) then + PokemonManager.UpdatePokemonFormationDatas(msg.teamPokemonInfos)--msg.pokemonInfo) + PokemonManager.InitPokemonsFetterData(msg.pokemonBookEnabled) + PokemonManager.InitPokemonsGetrData(msg.pokemonGot) + if func then + func(msg) + end + elseif msg.pokemonInfo and #msg.pokemonInfo >= 20 then + _start = _start + #msg.pokemonInfo + this.DiffMonsterRequest(_start, func) end end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua index 9d41cbf50b..dac9397c5c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua @@ -8,6 +8,7 @@ local pokemonFetter = {}--灵兽羁绊 local pokemonFormation = {}--灵兽编队 local pokemonGet = {} --已经获得过的灵兽 function this.Initialize() + pokemons = {} pokemonFormation = {} for i = 1, 6 do local teamInfo = {} @@ -21,10 +22,11 @@ end --初始化灵兽数据 --------------------------------------------- function this.InitPokemonsData(_msgPokemonList) - -- LogPink("初始化灵兽数据" .. #_msgPokemonList) - pokemons = {} - for i = 1, #_msgPokemonList do - this.UpdatePokemonDatas(_msgPokemonList[i]) + if _msgPokemonList then + -- LogPink("初始化灵兽数据" .. #_msgPokemonList) + for i = 1, #_msgPokemonList do + this.UpdatePokemonDatas(_msgPokemonList[i]) + end end end @@ -262,17 +264,20 @@ end --灵兽羁绊 (羁绊属性直接就是团队属性) --------------------------------------------- function this.InitPokemonsGetrData(_msgPokemonGetList) + if not _msgPokemonGetList then + return + end --Log("灵兽羁绊" .. #_msgPokemonFetterList) pokemonGet = {} - LogRed("_msgPokemonGetList[i]:"..#_msgPokemonGetList) + -- LogRed("_msgPokemonGetList[i]:"..#_msgPokemonGetList) for i = 1, #_msgPokemonGetList do - LogRed("_msgPokemonGetList[i]:".._msgPokemonGetList[i]) + -- LogRed("_msgPokemonGetList[i]:".._msgPokemonGetList[i]) pokemonGet[_msgPokemonGetList[i]] = _msgPokemonGetList[i] end end function this.InitPokemonsFetterData(_msgPokemonFetterList) - --Log("灵兽羁绊" .. #_msgPokemonFetterList) + -- Log("灵兽羁绊" .. #_msgPokemonFetterList) pokemonFetter = {} if not _msgPokemonFetterList then return @@ -304,7 +309,7 @@ function this.GetAllPokemonFetterDatas() end table.insert(SpiritAnimalBookList,singPokemonFetterData) end - LogGreen("#SpiritAnimalBookList:"..#SpiritAnimalBookList) + -- LogGreen("#SpiritAnimalBookList:"..#SpiritAnimalBookList) return SpiritAnimalBookList end