ObjectGetRequestHandler.cs 597 B

123456789101112131415161718192021222324
  1. using System;
  2. using Model;
  3. namespace Hotfix
  4. {
  5. [MessageHandler(AppType.Location)]
  6. public class ObjectGetRequestHandler : AMRpcHandler<ObjectGetRequest, ObjectGetResponse>
  7. {
  8. protected override async void Run(Session session, ObjectGetRequest message, Action<ObjectGetResponse> reply)
  9. {
  10. ObjectGetResponse response = new ObjectGetResponse();
  11. try
  12. {
  13. string location = await Game.Scene.GetComponent<LocationComponent>().GetAsync(message.Key);
  14. response.Location = location;
  15. reply(response);
  16. }
  17. catch (Exception e)
  18. {
  19. ReplyError(response, e, reply);
  20. }
  21. }
  22. }
  23. }