Actor_TransferHandler.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Net;
  3. using ETModel;
  4. namespace ETHotfix
  5. {
  6. [ActorMessageHandler]
  7. public class Actor_TransferHandler : AMActorRpcHandler<Unit, Actor_TransferRequest, Actor_TransferResponse>
  8. {
  9. protected override async ETTask Run(Unit unit, Actor_TransferRequest request, Actor_TransferResponse response, Action reply)
  10. {
  11. //long unitId = unit.Id;
  12. //
  13. //// 先在location锁住unit的地址
  14. //await Game.Scene.GetComponent<LocationProxyComponent>().Lock(unitId, unit.InstanceId);
  15. //
  16. //// 删除unit,让其它进程发送过来的消息找不到actor,重发
  17. //Game.EventSystem.Remove(unitId);
  18. //
  19. //long instanceId = unit.InstanceId;
  20. //
  21. //int mapIndex = request.MapIndex;
  22. //
  23. //StartConfigComponent startConfigComponent = StartConfigComponent.Instance;
  24. //
  25. //// 传送到map
  26. //StartConfig mapConfig = startConfigComponent.MapConfigs[mapIndex];
  27. //IPEndPoint address = mapConfig.GetComponent<InnerConfig>().IPEndPoint;
  28. //Session session = Game.Scene.GetComponent<NetInnerComponent>().Get(address);
  29. //
  30. //// 只删除不disponse否则M2M_TrasferUnitRequest无法序列化Unit
  31. //Game.Scene.GetComponent<UnitComponent>().RemoveNoDispose(unitId);
  32. //M2M_TrasferUnitResponse m2m_TrasferUnitResponse = (M2M_TrasferUnitResponse)await session.Call(new M2M_TrasferUnitRequest() { Unit = unit });
  33. //unit.Dispose();
  34. //
  35. //// 解锁unit的地址,并且更新unit的instanceId
  36. //await Game.Scene.GetComponent<LocationProxyComponent>().UnLock(unitId, instanceId, m2m_TrasferUnitResponse.InstanceId);
  37. reply();
  38. }
  39. }
  40. }