C2M_ReloadHandler.cs 998 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using Base;
  3. using Model;
  4. namespace Hotfix
  5. {
  6. [MessageHandler(AppType.Manager)]
  7. public class C2M_ReloadHandler: AMRpcHandler<C2M_Reload, M2C_Reload>
  8. {
  9. protected override async void Run(Session session, C2M_Reload message, Action<M2C_Reload> reply)
  10. {
  11. M2C_Reload response = new M2C_Reload();
  12. try
  13. {
  14. StartConfigComponent startConfigComponent = Game.Scene.GetComponent<StartConfigComponent>();
  15. NetInnerComponent netInnerComponent = Game.Scene.GetComponent<NetInnerComponent>();
  16. foreach (StartConfig startConfig in startConfigComponent.GetAll())
  17. {
  18. if (!message.AppType.Is(startConfig.AppType))
  19. {
  20. continue;
  21. }
  22. InnerConfig innerConfig = startConfig.GetComponent<InnerConfig>();
  23. Session serverSession = netInnerComponent.Get(innerConfig.Address);
  24. await serverSession.Call<M2A_Reload, A2M_Reload>(new M2A_Reload());
  25. }
  26. reply(response);
  27. }
  28. catch (Exception e)
  29. {
  30. ReplyError(response, e, reply);
  31. }
  32. }
  33. }
  34. }