MessageHelper.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. namespace ET.Server
  2. {
  3. public static class MessageHelper
  4. {
  5. public static void SendToClient(WNPlayer player, IActorMessage message)
  6. {
  7. SendActor(player.GameSessionActorId, message);
  8. }
  9. /// <summary>
  10. /// 发送协议给ActorLocation
  11. /// </summary>
  12. /// <param name="id">注册Actor的Id</param>
  13. /// <param name="message"></param>
  14. public static void SendToLocationActor(long id, IActorLocationMessage message)
  15. {
  16. ActorLocationSenderComponent.Instance.Send(id, message);
  17. }
  18. /// <summary>
  19. /// 发送协议给Actor
  20. /// </summary>
  21. /// <param name="actorId">注册Actor的InstanceId</param>
  22. /// <param name="message"></param>
  23. public static void SendActor(long actorId, IActorMessage message)
  24. {
  25. ActorMessageSenderComponent.Instance.Send(actorId, message);
  26. }
  27. /// <summary>
  28. /// 发送RPC协议给Actor
  29. /// </summary>
  30. /// <param name="actorId">注册Actor的InstanceId</param>
  31. /// <param name="message"></param>
  32. /// <returns></returns>
  33. public static async ETTask<IActorResponse> CallActor(long actorId, IActorRequest message)
  34. {
  35. return await ActorMessageSenderComponent.Instance.Call(actorId, message);
  36. }
  37. /// <summary>
  38. /// 发送RPC协议给ActorLocation
  39. /// </summary>
  40. /// <param name="id">注册Actor的Id</param>
  41. /// <param name="message"></param>
  42. /// <returns></returns>
  43. public static async ETTask<IActorResponse> CallLocationActor(long id, IActorLocationRequest message)
  44. {
  45. return await ActorLocationSenderComponent.Instance.Call(id, message);
  46. }
  47. }
  48. }