DisConnectedCompnentSystem.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using GFGGame;
  6. using UnityEngine;
  7. namespace ET
  8. {
  9. public class DisConnectedCompnentDestroy : DestroySystem<DisConnectedCompnent>
  10. {
  11. public override void Destroy(DisConnectedCompnent self)
  12. {
  13. if (self.ToReconnect)
  14. {
  15. if(GameGlobal.zoneScene.GetComponent<SessionComponent>().SessionState == SessionState.Gate)
  16. {
  17. if (!Application.isFocused)
  18. {
  19. AlertSystem.Show("连接已断开。")
  20. .SetRightButton(true, "重新连接", (object data) =>
  21. {
  22. LoginController.ReqReConnectGate().Coroutine();
  23. });
  24. return;
  25. }
  26. else
  27. {
  28. LoginController.ReqReConnectGate().Coroutine();
  29. }
  30. }
  31. else
  32. {
  33. GameController.QuitToLoginView(false);
  34. }
  35. }
  36. //重置状态
  37. self.ToReconnect = true;
  38. }
  39. }
  40. public static class DisConnectedCompnentSystem
  41. {
  42. public static void CancelAlert(this DisConnectedCompnent self)
  43. {
  44. self.ToReconnect = false;
  45. }
  46. }
  47. }