QDDouYouManager.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. // using System;
  2. // using ET;
  3. // using UnityEngine;
  4. // using GFGGame.Launcher;
  5. //
  6. // namespace GFGGame
  7. // {
  8. // public class QDDouYouManager : SingletonBase<QDDouYouManager>
  9. // {
  10. // public bool isLogining;
  11. // public string uid;
  12. // public string token;
  13. //
  14. // public void Init()
  15. // {
  16. // Debug.Log("实例化DouYouSDKListener");
  17. // QDDouYouManagerInit.Instance.douYouSDKListener = new DouYouSDKListener();
  18. // }
  19. //
  20. // public void Login()
  21. // {
  22. // // if (!string.IsNullOrEmpty(uid))
  23. // // {
  24. // // EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_LOGINED, uid);
  25. // // return;
  26. // // }
  27. // // if (isLogining) return;
  28. // // Debug.Log($"quick Login");
  29. // // isLogining = true;
  30. // QDDouYouManagerInit.Instance.ShowLogin();
  31. // }
  32. //
  33. // public void OnCreateRole()
  34. // {
  35. // QDManager.PushRoleAction(DouYouRoleLogReportType.CreateRole);
  36. // }
  37. //
  38. // public void OnEnterGame()
  39. // {
  40. // var zoneScene = GameGlobal.zoneScene;
  41. // if (zoneScene == null) return;
  42. //
  43. // if (zoneScene.GetComponent<RoleInfosComponent>() == null ||
  44. // zoneScene.GetComponent<RoleInfosComponent>().IsDisposed) return;
  45. //
  46. // var roleInfo = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRole();
  47. // if (roleInfo == null) return;
  48. //
  49. // if (GameGlobal.myNumericComponent == null) return;
  50. // int lvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  51. //
  52. // if (zoneScene.GetComponent<ServerInfosComponent>() == null) return;
  53. // if (zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
  54. //
  55. // string serverName = zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo.ServerName;
  56. //
  57. // QDDouYouManagerInit.Instance.ReportRoleLogin(roleInfo.Id.ToString(), lvl.ToString(), roleInfo.Name,
  58. // roleInfo.ServerId.ToString(), serverName);
  59. // QDManager.PushRoleAction(DouYouRoleLogReportType.EnterGame);
  60. // }
  61. //
  62. // public void OnQuitToLoginView()
  63. // {
  64. // Debug.Log($"DouYou OnQuitToLoginView");
  65. // }
  66. //
  67. // public void Logout()
  68. // {
  69. // Debug.Log($"Game.HotUpdate DouYou Logout");
  70. // QDDouYouManagerInit.Instance.ShowLogout();
  71. // }
  72. //
  73. // public void LoginOutBefore()
  74. // {
  75. // QDManager.PushRoleAction(DouYouRoleLogReportType.ExitGame);
  76. // }
  77. //
  78. // public void Pay(int buyID, int count, string orderID, long price)
  79. // {
  80. // ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(buyID);
  81. // if (shopCfg == null)
  82. // {
  83. // Log.Error($"recharge {buyID} config not found!");
  84. // return;
  85. // }
  86. //
  87. // ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
  88. // if (itemCfg == null)
  89. // {
  90. // Log.Error($"recharge {buyID} itemCfgId:{shopCfg.itemId} config not found!");
  91. // return;
  92. // }
  93. //
  94. // var zoneScene = GameGlobal.zoneScene;
  95. // if (zoneScene == null) return;
  96. //
  97. // if (zoneScene.GetComponent<RoleInfosComponent>() == null ||
  98. // zoneScene.GetComponent<RoleInfosComponent>().IsDisposed) return;
  99. //
  100. // var roleInfo = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRole();
  101. // if (roleInfo == null) return;
  102. //
  103. // if (GameGlobal.myNumericComponent == null) return;
  104. // int lvl = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  105. //
  106. // if (zoneScene.GetComponent<ServerInfosComponent>() == null) return;
  107. // if (zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo == null) return;
  108. //
  109. // string serverName = zoneScene.GetComponent<ServerInfosComponent>().recentlyServerInfo.ServerName;
  110. //
  111. // //自定义参数
  112. // string other = orderID + "|gfg|" + roleInfo.Id;
  113. // QDDouYouManagerInit.Instance.ShowSwitchPayment(orderID, price.ToString(), buyID.ToString(),
  114. // shopCfg.itemName, string.Empty,
  115. // roleInfo.ServerId.ToString(), serverName, roleInfo.Id.ToString(), roleInfo.Name, lvl.ToString(), other);
  116. // }
  117. //
  118. // public void Exit()
  119. // {
  120. // QDManager.PushRoleAction(DouYouRoleLogReportType.ExitGame);
  121. // QDDouYouManagerInit.Instance.ExitApp();
  122. // }
  123. // }
  124. //
  125. // /// <summary>
  126. // /// SDK回调
  127. // /// </summary>
  128. // public class DouYouSDKListener : IDouYouSDKListener
  129. // {
  130. // // /// <summary>
  131. // // /// 测试消息
  132. // // /// </summary>
  133. // // /// <param name="message"></param>
  134. // // public void ReceiveMessageAb(string message)
  135. // // {
  136. // // Debug.Log($"Game.HotUpdate ReceiveMessageAb:{message}");
  137. // // }
  138. //
  139. // /// <summary>
  140. // /// SDK实例化成功
  141. // /// </summary>
  142. // /// <param name="message">SDK 实例化成功</param>
  143. // public void InitSuccessAb(string message)
  144. // {
  145. // Debug.Log("Game.HotUpdate InitSuccessAb: " + message);
  146. // }
  147. //
  148. // /// <summary>
  149. // /// 登录成功
  150. // /// </summary>
  151. // /// <param name="message">resUid + "|gfg|" + token</param>
  152. // public void LoginSuccessAb(string message)
  153. // {
  154. // Debug.Log("Game.HotUpdate LoginSuccessAb: " + message);
  155. // string[] result = message.Split(new string[] { "|gfg|" }, StringSplitOptions.None);
  156. //
  157. // QDDouYouManager.Instance.isLogining = false;
  158. // QDDouYouManager.Instance.uid = result[0];
  159. // QDDouYouManager.Instance.token = result[1];
  160. // //登录成功的回调
  161. // EventAgent.DispatchEvent(ConstMessage.ON_PLATFORM_SDK_LOGINED, result[0]);
  162. // }
  163. //
  164. // /// <summary>
  165. // /// 切换账号或退出登录后
  166. // /// </summary>
  167. // /// <param name="message">退出登录成功!</param>
  168. // public void OutLoginSuccessAb(string message)
  169. // {
  170. // Debug.Log("Game.HotUpdate OutLoginSuccessAb: " + message);
  171. // GameController.QuitToLoginView(true);
  172. // EventAgent.DispatchEvent(ConstMessage.OUT_LOGIN);
  173. // }
  174. //
  175. // /// <summary>
  176. // /// 支付失败
  177. // /// </summary>
  178. // /// <param name="message">code + "|gfg|" + params.toString()</param>
  179. // public void PayFailAb(string message)
  180. // {
  181. // Debug.Log("Game.HotUpdate PayFailAb: " + message);
  182. // //改变临时订单状态为失败
  183. // }
  184. //
  185. // /// <summary>
  186. // /// 支付成功
  187. // /// </summary>
  188. // /// <param name="message">code + "|gfg|" + params.toString()</param>
  189. // public void PaySuccessAb(string message)
  190. // {
  191. // Debug.Log("Game.HotUpdate PaySuccessAb" + message);
  192. // //改变临时订单状态为支付成功
  193. // QDManager.PushRoleAction(DouYouRoleLogReportType.Pay);
  194. // }
  195. //
  196. // #region SDK 生命周期函数
  197. //
  198. // public void SdkOnStartAb(string message)
  199. // {
  200. // Debug.Log($"Game.HotUpdate SdkOnStartAb:{message}");
  201. // }
  202. //
  203. // public void SdkOnPauseAb(string message)
  204. // {
  205. // Debug.Log($"Game.HotUpdate SdkOnPauseAb:{message}");
  206. // }
  207. //
  208. // public void SdkOnResumeAb(string message)
  209. // {
  210. // Debug.Log($"Game.HotUpdate SdkOnResumeAb:{message}");
  211. // }
  212. //
  213. // public void SdkOnStopAb(string message)
  214. // {
  215. // Debug.Log($"Game.HotUpdate SdkOnStopAb:{message}");
  216. // }
  217. //
  218. // public void SdkOnDestroyAb(string message)
  219. // {
  220. // Debug.Log($"Game.HotUpdate SdkOnDestroyAb:{message}");
  221. // }
  222. //
  223. // public void SdkOnRestartAb(string message)
  224. // {
  225. // Debug.Log($"Game.HotUpdate SdkOnRestartAb:{message}");
  226. // }
  227. //
  228. // public void SdkOnBackPressedAb(string message)
  229. // {
  230. // Debug.Log($"Game.HotUpdate SdkOnBackPressedAb:{message}");
  231. // }
  232. //
  233. // public void SdkOnNewIntentAb(string message)
  234. // {
  235. // Debug.Log($"Game.HotUpdate SdkOnNewIntentAb:{message}");
  236. // }
  237. //
  238. // public void SdkOnConfigurationChangedAb(string message)
  239. // {
  240. // Debug.Log($"Game.HotUpdate SdkOnConfigurationChangedAb:{message}");
  241. // }
  242. //
  243. // public void SdkOnSaveInstanceStateAb(string message)
  244. // {
  245. // Debug.Log($"Game.HotUpdate SdkOnSaveInstanceStateAb:{message}");
  246. // }
  247. //
  248. // public void SdkOnActivityResultAb(string message)
  249. // {
  250. // Debug.Log($"Game.HotUpdate SdkOnActivityResultAb:{message}");
  251. // }
  252. //
  253. // public void SdkOnRequestPermissionResultAb(string message)
  254. // {
  255. // Debug.Log($"Game.HotUpdate SdkOnRequestPermissionResultAb:{message}");
  256. // }
  257. //
  258. // public void SdkOnWindowFocusChangedAb(string message)
  259. // {
  260. // Debug.Log($"Game.HotUpdate SdkOnWindowFocusChangedAb:{message}");
  261. // }
  262. //
  263. // #endregion
  264. // }
  265. // }