QDManager.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using ET;
  2. using UnityEngine;
  3. namespace GFGGame
  4. {
  5. public class QDManager
  6. {
  7. public bool isLogining;
  8. public string uid;
  9. public static void Init()
  10. {
  11. switch (LauncherConfig.ChannelId)
  12. {
  13. default:
  14. QDDouYouManager.Instance.Init();
  15. QDShareManager.Instance.Init();
  16. break;
  17. }
  18. }
  19. public static void Login()
  20. {
  21. ViewManager.Show<ModalStatusView>("登录中...");
  22. switch (LauncherConfig.ChannelId)
  23. {
  24. case (int)ChannelID.TapTap:
  25. break;
  26. case (int)ChannelID.Test:
  27. bool login = GameController.CheckLoginCache(true);
  28. if (!login)
  29. {
  30. ViewManager.Hide<ModalStatusView>();
  31. ViewManager.Show<LoginInputView>();
  32. }
  33. break;
  34. case (int)ChannelID.DouYouTest:
  35. QDDouYouManager.Instance.Login();
  36. break;
  37. default:
  38. break;
  39. }
  40. }
  41. public static void OnCreateRole()
  42. {
  43. switch (LauncherConfig.ChannelId)
  44. {
  45. case (int)ChannelID.TapTap:
  46. break;
  47. case (int)ChannelID.Test:
  48. break;
  49. case (int)ChannelID.DouYouTest:
  50. QDDouYouManager.Instance.OnCreateRole();
  51. break;
  52. default:
  53. break;
  54. }
  55. }
  56. public static void OnEnterGame()
  57. {
  58. switch (LauncherConfig.ChannelId)
  59. {
  60. case (int)ChannelID.TapTap:
  61. break;
  62. case (int)ChannelID.Test:
  63. break;
  64. case (int)ChannelID.DouYouTest:
  65. QDDouYouManager.Instance.OnEnterGame();
  66. break;
  67. default:
  68. break;
  69. }
  70. }
  71. //回到登录界面,不退出账号
  72. public static void OnQuitToLoginView()
  73. {
  74. switch (LauncherConfig.ChannelId)
  75. {
  76. case (int)ChannelID.TapTap:
  77. break;
  78. case (int)ChannelID.Test:
  79. break;
  80. case (int)ChannelID.DouYouTest:
  81. QDDouYouManager.Instance.OnQuitToLoginView();
  82. break;
  83. default:
  84. break;
  85. }
  86. }
  87. public static void Pay(int buyID, int count, string orderID, long price)
  88. {
  89. switch (LauncherConfig.ChannelId)
  90. {
  91. case (int)ChannelID.TapTap:
  92. break;
  93. case (int)ChannelID.Test:
  94. break;
  95. case (int)ChannelID.DouYouTest:
  96. QDDouYouManager.Instance.Pay(buyID, count, orderID, price);
  97. break;
  98. default:
  99. break;
  100. }
  101. }
  102. public static void Logout()
  103. {
  104. GameGlobal.zoneScene.GetComponent<SessionComponent>()?.Disconnect();
  105. GameGlobal.zoneScene.GetComponent<ServerInfosComponent>()?.ServerInfoList?.Clear();
  106. GameGlobal.zoneScene.GetComponent<AccountInfoComponent>()?.Clear();
  107. if (PlayerPrefs.HasKey(GameConst.PASSWORD_LAST_LOGIN_KEY))
  108. {
  109. PlayerPrefs.DeleteKey(GameConst.PASSWORD_LAST_LOGIN_KEY);
  110. }
  111. switch (LauncherConfig.ChannelId)
  112. {
  113. case (int)ChannelID.TapTap:
  114. break;
  115. case (int)ChannelID.Test:
  116. break;
  117. case (int)ChannelID.DouYouTest:
  118. QDDouYouManager.Instance.Logout();
  119. break;
  120. default:
  121. break;
  122. }
  123. }
  124. public static void Exit()
  125. {
  126. switch (LauncherConfig.ChannelId)
  127. {
  128. case (int)ChannelID.Test:
  129. GameController.ShowExitAlert();
  130. break;
  131. case (int)ChannelID.DouYouTest:
  132. QDDouYouManager.Instance.Exit();
  133. break;
  134. default:
  135. break;
  136. }
  137. }
  138. public static bool IsTaptap
  139. {
  140. get { return LauncherConfig.ChannelId == (int)ChannelID.TapTap; }
  141. }
  142. public static bool IsHYKB
  143. {
  144. get
  145. {
  146. return LauncherConfig.ChannelId == (int)ChannelID.HYKB;
  147. }
  148. }
  149. public static bool IsBiliBili
  150. {
  151. get
  152. {
  153. return LauncherConfig.ChannelId == (int)ChannelID.BiliBili;
  154. }
  155. }
  156. public static bool IsHuaWei
  157. {
  158. get
  159. {
  160. return LauncherConfig.ChannelId == (int)ChannelID.HUAWEI;
  161. }
  162. }
  163. }
  164. }