DisConnectedCompnentSystem.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 if(self.SessionState == SessionState.Gate)
  27. {
  28. LoginController.ReqReConnectGate().Coroutine();
  29. }
  30. else
  31. {
  32. LogUtil.LogDev("DisConnectedCompnentDestroy");
  33. }
  34. }
  35. else
  36. {
  37. GameController.QuitToLoginView(false);
  38. }
  39. }
  40. //重置状态
  41. self.ToReconnect = true;
  42. }
  43. }
  44. public static class DisConnectedCompnentSystem
  45. {
  46. public static void CancelAlert(this DisConnectedCompnent self)
  47. {
  48. self.ToReconnect = false;
  49. }
  50. }
  51. }