ObjectGetRequestHandler.cs 554 B

1234567891011121314151617181920
  1. using System;
  2. using ETModel;
  3. namespace ETHotfix
  4. {
  5. [MessageHandler(AppType.Location)]
  6. public class ObjectGetRequestHandler : AMRpcHandler<ObjectGetRequest, ObjectGetResponse>
  7. {
  8. protected override async ETTask Run(Session session, ObjectGetRequest request, ObjectGetResponse response, Action reply)
  9. {
  10. long instanceId = await Game.Scene.GetComponent<LocationComponent>().GetAsync(request.Key);
  11. if (instanceId == 0)
  12. {
  13. response.Error = ErrorCode.ERR_ActorLocationNotFound;
  14. }
  15. response.InstanceId = instanceId;
  16. reply();
  17. }
  18. }
  19. }