From 7bb73f1175bedf71affa545af9059e63a2483318 Mon Sep 17 00:00:00 2001 From: yuanshuai <243578945@qq.com> Date: Tue, 21 Feb 2023 11:26:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A5=9E=E5=B0=86=E7=BD=AE=E6=8D=A2=E5=8D=A1bu?= =?UTF-8?q?g=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Net/NetManager.lua | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 7b784e6a0a..094ccc5f90 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -7039,5 +7039,33 @@ function NetManager.SendGmBuyGoodRequest(_id,func) end) end +---神将置换卡使用置换 +function NetManager.SendHeroChangeRequest(_heroDId1,_heroDId2,_itemId,func) + local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) + local data = HeroInfoProto_pb.HeroChangeRequest() + data.heroID1=_heroDId1 + data.heroID2=_heroDId2 + data.itemID=_itemId + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.HERO_CHANGE_REQUEST,MessageTypeProto_pb.HERO_CHANGE_RESPONSE,msg,function(buffer) + local data = buffer:DataByte() + local msg = HeroInfoProto_pb.HeroChangeResponse() + msg:ParseFromString(data) + for i = 1, #msg.heros do + HeroManager.UpdateHeroDatas(msg.heros[i]) + end + HeroPropManager.SetDirtyByType(_heroDId1, Hero_Prop_Type.Base) + HeroPropManager.SetDirtyByType(_heroDId2, Hero_Prop_Type.Base) + NetManager.RequestUserForceChange(FormationTypeDef.FORMATION_NORMAL) + local tempPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) + if oldWarPower ~= tempPower then + UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPower,newValue = tempPower}) + end + if func then + func(msg) + end + end) +end + return this \ No newline at end of file