C2M_ReloadHandler.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using ETModel;
  3. namespace ETHotfix
  4. {
  5. [MessageHandler(AppType.Manager)]
  6. public class C2M_ReloadHandler: AMRpcHandler<C2M_Reload, M2C_Reload>
  7. {
  8. protected override void Run(Session session, C2M_Reload message, Action<M2C_Reload> reply)
  9. {
  10. RunAsync(session, message, reply).NoAwait();
  11. }
  12. private async ETVoid RunAsync(Session session, C2M_Reload message, Action<M2C_Reload> reply)
  13. {
  14. M2C_Reload response = new M2C_Reload();
  15. if (message.Account != "panda" && message.Password != "panda")
  16. {
  17. Log.Error($"error reload account and password: {MongoHelper.ToJson(message)}");
  18. return;
  19. }
  20. try
  21. {
  22. StartConfigComponent startConfigComponent = Game.Scene.GetComponent<StartConfigComponent>();
  23. NetInnerComponent netInnerComponent = Game.Scene.GetComponent<NetInnerComponent>();
  24. foreach (StartConfig startConfig in startConfigComponent.GetAll())
  25. {
  26. InnerConfig innerConfig = startConfig.GetComponent<InnerConfig>();
  27. Session serverSession = netInnerComponent.Get(innerConfig.IPEndPoint);
  28. await serverSession.Call(new M2A_Reload());
  29. }
  30. reply(response);
  31. }
  32. catch (Exception e)
  33. {
  34. ReplyError(response, e, reply);
  35. }
  36. }
  37. }
  38. }