C2M_ReloadHandler.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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 async void Run(Session session, C2M_Reload message, Action<M2C_Reload> reply)
  9. {
  10. M2C_Reload response = new M2C_Reload();
  11. if (message.Account != "panda" && message.Password != "panda")
  12. {
  13. Log.Error($"error reload account and password: {MongoHelper.ToJson(message)}");
  14. return;
  15. }
  16. try
  17. {
  18. StartConfigComponent startConfigComponent = Game.Scene.GetComponent<StartConfigComponent>();
  19. NetInnerComponent netInnerComponent = Game.Scene.GetComponent<NetInnerComponent>();
  20. foreach (StartConfig startConfig in startConfigComponent.GetAll())
  21. {
  22. InnerConfig innerConfig = startConfig.GetComponent<InnerConfig>();
  23. Session serverSession = netInnerComponent.Get(innerConfig.IPEndPoint);
  24. await serverSession.Call(new M2A_Reload());
  25. }
  26. reply(response);
  27. }
  28. catch (Exception e)
  29. {
  30. ReplyError(response, e, reply);
  31. }
  32. }
  33. }
  34. }