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