PluginBridge.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using UnityEngine;
  4. using TapTap.Common;
  5. namespace Plugins.AntiAddictionUIKit
  6. {
  7. [Serializable]
  8. public class CheckPayResult
  9. {
  10. public int status;
  11. public string title;
  12. public string description;
  13. }
  14. [Serializable]
  15. public class AntiAddictionCallbackOriginData
  16. {
  17. public int code;
  18. public string extras;
  19. }
  20. [Serializable]
  21. public class AntiAddictionCallbackData
  22. {
  23. public int code;
  24. public MsgExtraParams extras;
  25. }
  26. [Serializable]
  27. public class IdetntifyState
  28. {
  29. public int authState;
  30. public string antiAddictionToken;
  31. public int ageLimit;
  32. }
  33. [Serializable]
  34. public class IdentifyResult
  35. {
  36. public int identifyState;
  37. }
  38. [Serializable]
  39. public class MsgExtraParams
  40. {
  41. public int userType = -1;
  42. public string limit_tip_type = "";
  43. public string strict_type = "";
  44. public string description = "";
  45. public string title = "";
  46. }
  47. [Serializable]
  48. public class CheckPayResultParams
  49. {
  50. public int status;
  51. public string title;
  52. public string description;
  53. }
  54. [Serializable]
  55. public class SubmitPayResultParams
  56. {
  57. }
  58. public static class AntiAddictionUIKit
  59. {
  60. // Game object is created to receive async messages
  61. private const string UNITY_SDK_VERSION = "3.13.0";
  62. private const string GAME_OBJECT_NAME = "PluginBridge";
  63. private static GameObject gameObject;
  64. // Android only variables
  65. private const string JAVA_OBJECT_NAME = "com.tapsdk.antiaddictionui.NativeAntiAddictionUIKitPlugin";
  66. private static AndroidJavaObject androidJavaNativeAntiAddiction;
  67. private static Action<AntiAddictionCallbackData> handleAsyncAntiAddictionMsg;
  68. private static Action<string> handleAsyncAntiAddictionMsgException;
  69. private static Action<string> handleAsyncAuthIdentityManualException;
  70. private static Action<CheckPayResult> handleCheckPayLimit;
  71. private static Action<string> handleCheckPayLimitException;
  72. private static Action handleSubmitPayResult;
  73. private static Action<string> handleSubmitPayResultException;
  74. // iOS only variables
  75. #if UNITY_IOS
  76. [DllImport("__Internal")]
  77. #endif
  78. private static extern void initSDK(string gameIdentifier
  79. , bool useTimeLimit
  80. , bool usePaymentLimit
  81. , bool showSwitchAccount);
  82. #if UNITY_IOS
  83. [DllImport("__Internal")]
  84. #endif
  85. private static extern void startup(string userIdentifier, bool useTapLogin);
  86. #if UNITY_IOS
  87. [DllImport("__Internal")]
  88. #endif
  89. private static extern void logout();
  90. #if UNITY_IOS
  91. [DllImport("__Internal")]
  92. #endif
  93. private static extern void enterGame();
  94. #if UNITY_IOS
  95. [DllImport("__Internal")]
  96. #endif
  97. private static extern void leaveGame();
  98. #if UNITY_IOS
  99. [DllImport("__Internal")]
  100. #endif
  101. private static extern void checkPayLimit(long amount);
  102. #if UNITY_IOS
  103. [DllImport("__Internal")]
  104. #endif
  105. private static extern void submitPayResult(long amount);
  106. #if UNITY_IOS
  107. [DllImport("__Internal")]
  108. #endif
  109. private static extern int getCurrentUserRemainTime();
  110. #if UNITY_IOS
  111. [DllImport("__Internal")]
  112. #endif
  113. private static extern int getCurrentUserAgeLimit();
  114. #if UNITY_IOS
  115. [DllImport("__Internal")]
  116. #endif
  117. private static extern string getCurrentAntiToken();
  118. #if UNITY_IOS
  119. [DllImport("__Internal")]
  120. #endif
  121. private static extern bool standalone();
  122. #if UNITY_IOS
  123. [DllImport("__Internal")]
  124. #endif
  125. private static extern void setUnityVersion(string version);
  126. private class PlatformNotSupportedException : Exception
  127. {
  128. public PlatformNotSupportedException() : base()
  129. {
  130. }
  131. }
  132. static AntiAddictionUIKit()
  133. {
  134. gameObject = new GameObject();
  135. gameObject.name = GAME_OBJECT_NAME;
  136. // attach this class to allow for handling of callbacks from Java or Objective c
  137. gameObject.AddComponent<NativeAntiAddictionUICallbackHandler>();
  138. gameObject.AddComponent<NativeCheckPayLimitHandler>();
  139. gameObject.AddComponent<NativeSubmitPayResultHandler>();
  140. // Do not destroy when loading a new scene
  141. UnityEngine.Object.DontDestroyOnLoad(gameObject);
  142. switch (Application.platform)
  143. {
  144. case RuntimePlatform.Android:
  145. // Initialize native Java object
  146. androidJavaNativeAntiAddiction = new AndroidJavaObject(JAVA_OBJECT_NAME);
  147. break;
  148. case RuntimePlatform.IPhonePlayer:
  149. break;
  150. default:
  151. throw new PlatformNotSupportedException();
  152. }
  153. }
  154. private class NativeAntiAddictionUICallbackHandler : MonoBehaviour
  155. {
  156. private void HandleException(string exception)
  157. {
  158. handleAsyncAntiAddictionMsgException?.Invoke(exception);
  159. }
  160. private void HandleAntiAddictionCallbackMsg(string antiAddictionCallbackDataJSON)
  161. {
  162. Debug.Log("HandleAntiAddictionCallbackMsg antiAddictionCallbackDataJSON:" + antiAddictionCallbackDataJSON);
  163. var antiAddictionCallbackOriginData = JsonUtility.FromJson<AntiAddictionCallbackOriginData>(antiAddictionCallbackDataJSON);
  164. Debug.Log("HandleAntiAddictionCallbackMsg resultCode:" + antiAddictionCallbackOriginData.code);
  165. var result = new AntiAddictionCallbackData();
  166. result.code = antiAddictionCallbackOriginData.code;
  167. if (antiAddictionCallbackOriginData.extras != null && antiAddictionCallbackOriginData.extras.Length > 0) {
  168. result.extras = JsonUtility.FromJson<MsgExtraParams>(antiAddictionCallbackOriginData.extras);
  169. Debug.Log("result.extras title:" + result.extras.title);
  170. Debug.Log("result.extras description:" + result.extras.description);
  171. }
  172. handleAsyncAntiAddictionMsg?.Invoke(result);
  173. }
  174. }
  175. private class NativeCheckPayLimitHandler : MonoBehaviour
  176. {
  177. private void HandleCheckPayLimitException(string exception)
  178. {
  179. handleCheckPayLimitException?.Invoke(exception);
  180. }
  181. private void HandleCheckPayLimit(string checkPayResultJSON)
  182. {
  183. var result = JsonUtility.FromJson<CheckPayResult>(checkPayResultJSON);
  184. handleCheckPayLimit?.Invoke(result);
  185. }
  186. }
  187. private class NativeSubmitPayResultHandler : MonoBehaviour
  188. {
  189. private void HandleSubmitPayResultException(string exception)
  190. {
  191. handleSubmitPayResultException?.Invoke(exception);
  192. }
  193. private void HandleSubmitPayResult()
  194. {
  195. handleSubmitPayResult?.Invoke();
  196. }
  197. }
  198. /*
  199. * ------------------
  200. * Interface Metthods
  201. * ------------------
  202. */
  203. public static void Init(string gameIdentifier
  204. , bool useTimeLimit
  205. , bool usePaymentLimit
  206. , Action<AntiAddictionCallbackData> handleAsyncAntiAddictionMsg
  207. , Action<string> handleAsyncAntiAddictionMsgException)
  208. {
  209. AntiAddictionUIKit.handleAsyncAntiAddictionMsg = handleAsyncAntiAddictionMsg;
  210. AntiAddictionUIKit.handleAsyncAntiAddictionMsgException = handleAsyncAntiAddictionMsgException;
  211. switch (Application.platform)
  212. {
  213. case RuntimePlatform.Android:
  214. PerformAndroidInit(gameIdentifier, useTimeLimit, usePaymentLimit);
  215. break;
  216. case RuntimePlatform.IPhonePlayer:
  217. PerformiOSInit(gameIdentifier, useTimeLimit, usePaymentLimit);
  218. break;
  219. default:
  220. throw new PlatformNotSupportedException();
  221. }
  222. SetUnitySDKVersion(UNITY_SDK_VERSION);
  223. }
  224. public static void Init(string gameIdentifier
  225. , bool useTimeLimit
  226. , bool usePaymentLimit
  227. , bool showSwitchAccount
  228. , Action<AntiAddictionCallbackData> handleAsyncAntiAddictionMsg
  229. , Action<string> handleAsyncAntiAddictionMsgException)
  230. {
  231. AntiAddictionUIKit.handleAsyncAntiAddictionMsg = handleAsyncAntiAddictionMsg;
  232. AntiAddictionUIKit.handleAsyncAntiAddictionMsgException = handleAsyncAntiAddictionMsgException;
  233. switch (Application.platform)
  234. {
  235. case RuntimePlatform.Android:
  236. PerformAndroidInit(gameIdentifier, useTimeLimit, usePaymentLimit, showSwitchAccount);
  237. break;
  238. case RuntimePlatform.IPhonePlayer:
  239. PerformiOSInit(gameIdentifier, useTimeLimit, usePaymentLimit, showSwitchAccount);
  240. break;
  241. default:
  242. throw new PlatformNotSupportedException();
  243. }
  244. SetUnitySDKVersion(UNITY_SDK_VERSION);
  245. }
  246. public static void Startup(bool useTapLogin, string userIdentifier) {
  247. switch (Application.platform)
  248. {
  249. case RuntimePlatform.Android:
  250. PerformAndroidStartup(useTapLogin, userIdentifier);
  251. break;
  252. case RuntimePlatform.IPhonePlayer:
  253. PerformiOSStartup(useTapLogin, userIdentifier);
  254. break;
  255. default:
  256. throw new PlatformNotSupportedException();
  257. }
  258. }
  259. public static void EnterGame()
  260. {
  261. switch (Application.platform)
  262. {
  263. case RuntimePlatform.Android:
  264. PerformAndroidEnterGame();
  265. break;
  266. case RuntimePlatform.IPhonePlayer:
  267. PerformiOSEnterGame();
  268. break;
  269. default:
  270. throw new PlatformNotSupportedException();
  271. }
  272. }
  273. public static void LeaveGame()
  274. {
  275. switch (Application.platform)
  276. {
  277. case RuntimePlatform.Android:
  278. PerformAndroidLeaveGame();
  279. break;
  280. case RuntimePlatform.IPhonePlayer:
  281. PerformiOSLeaveGame();
  282. break;
  283. default:
  284. throw new PlatformNotSupportedException();
  285. }
  286. }
  287. public static string CurrentToken()
  288. {
  289. switch (Application.platform)
  290. {
  291. case RuntimePlatform.Android:
  292. return PerformAndroidGetCurrentToken();
  293. case RuntimePlatform.IPhonePlayer:
  294. return PerformiOSGetCurrentToken();
  295. default:
  296. throw new PlatformNotSupportedException();
  297. }
  298. }
  299. public static int CurrentUserAgeLimit()
  300. {
  301. switch (Application.platform)
  302. {
  303. case RuntimePlatform.Android:
  304. return PerformAndroidGetCurrentUserAgeLimit();
  305. case RuntimePlatform.IPhonePlayer:
  306. return PerformiOSGetCurrentUserAgeLimit();
  307. default:
  308. throw new PlatformNotSupportedException();
  309. }
  310. }
  311. public static int CurrentUserRemainTime()
  312. {
  313. switch (Application.platform)
  314. {
  315. case RuntimePlatform.Android:
  316. return PerformAndroidGetCurrentUserRemainTime();
  317. case RuntimePlatform.IPhonePlayer:
  318. return PerformiOSGetCurrentUserRemainTime();
  319. default:
  320. throw new PlatformNotSupportedException();
  321. }
  322. }
  323. public static void Logout()
  324. {
  325. switch (Application.platform)
  326. {
  327. case RuntimePlatform.Android:
  328. PerformAndroidLogout();
  329. break;
  330. case RuntimePlatform.IPhonePlayer:
  331. PerformiOSLogout();
  332. break;
  333. default:
  334. throw new PlatformNotSupportedException();
  335. }
  336. }
  337. public static void CheckPayLimit(long amount
  338. , Action<CheckPayResult> handleCheckPayLimit
  339. , Action<string> handleCheckPayLimitException)
  340. {
  341. AntiAddictionUIKit.handleCheckPayLimit = handleCheckPayLimit;
  342. AntiAddictionUIKit.handleCheckPayLimitException = handleCheckPayLimitException;
  343. switch (Application.platform)
  344. {
  345. case RuntimePlatform.Android:
  346. PerformAndroidCheckPayLimit(amount);
  347. break;
  348. case RuntimePlatform.IPhonePlayer:
  349. PerformiOSCheckPayLimit(amount);
  350. break;
  351. default:
  352. throw new PlatformNotSupportedException();
  353. }
  354. }
  355. public static void SubmitPayResult(long amount
  356. , Action handleSubmitPayResult
  357. , Action<string> handleSubmitPayResultException
  358. )
  359. {
  360. AntiAddictionUIKit.handleSubmitPayResult = handleSubmitPayResult;
  361. AntiAddictionUIKit.handleSubmitPayResultException = handleSubmitPayResultException;
  362. switch (Application.platform)
  363. {
  364. case RuntimePlatform.Android:
  365. PerformAndroidSubmitPayResult(amount);
  366. break;
  367. case RuntimePlatform.IPhonePlayer:
  368. PerformiOSSubmitPayResult(amount);
  369. break;
  370. default:
  371. throw new PlatformNotSupportedException();
  372. }
  373. }
  374. public static void SetUnitySDKVersion(string version)
  375. {
  376. switch (Application.platform)
  377. {
  378. case RuntimePlatform.Android:
  379. PerformAndroidSetUnityVersion(version);
  380. break;
  381. case RuntimePlatform.IPhonePlayer:
  382. PerformiOSSetUnityVersion(version);
  383. break;
  384. default:
  385. throw new PlatformNotSupportedException();
  386. }
  387. }
  388. public static bool isStandalone() {
  389. switch (Application.platform)
  390. {
  391. case RuntimePlatform.Android:
  392. return (PerformAndroidIsStandalone() == 1) ? true : false;
  393. case RuntimePlatform.IPhonePlayer:
  394. return PerformiOSIsStandalone();
  395. default:
  396. throw new PlatformNotSupportedException();
  397. }
  398. }
  399. public static void SetTestMode(bool testMode)
  400. {
  401. switch (Application.platform)
  402. {
  403. case RuntimePlatform.Android:
  404. setTestMode(testMode);
  405. break;
  406. case RuntimePlatform.IPhonePlayer:
  407. setTestMode(testMode);
  408. break;
  409. }
  410. }
  411. /*
  412. * ------------------
  413. * Internal Metthods(Android)
  414. * ------------------
  415. */
  416. private static void PerformAndroidInit(
  417. string gameIdentifier
  418. , bool useTimeLimit
  419. , bool usePaymentLimit
  420. )
  421. {
  422. Debug.Log("Android Init calling:" + gameIdentifier);
  423. AndroidJavaClass unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  424. AndroidJavaObject unityActivity = unityClass.GetStatic<AndroidJavaObject>("currentActivity");
  425. androidJavaNativeAntiAddiction.Call("initSDK"
  426. , unityActivity
  427. , gameIdentifier
  428. , useTimeLimit
  429. , usePaymentLimit
  430. );
  431. }
  432. private static void PerformAndroidInit(
  433. string gameIdentifier
  434. , bool useTimeLimit
  435. , bool usePaymentLimit
  436. , bool showSwitchAccount
  437. )
  438. {
  439. Debug.Log("Android Init calling:" + gameIdentifier);
  440. AndroidJavaClass unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  441. AndroidJavaObject unityActivity = unityClass.GetStatic<AndroidJavaObject>("currentActivity");
  442. androidJavaNativeAntiAddiction.Call("initSDK"
  443. , unityActivity
  444. , gameIdentifier
  445. , useTimeLimit
  446. , usePaymentLimit
  447. , showSwitchAccount
  448. );
  449. }
  450. private static void PerformAndroidStartup(bool useTapLogin, string userIdentifier)
  451. {
  452. Debug.Log("Android startup calling");
  453. AndroidJavaClass unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  454. AndroidJavaObject unityActivity = unityClass.GetStatic<AndroidJavaObject>("currentActivity");
  455. androidJavaNativeAntiAddiction.Call("startup", unityActivity, useTapLogin, userIdentifier);
  456. }
  457. private static string PerformAndroidGetCurrentToken()
  458. {
  459. Debug.Log("Android getCurrrentToken calling");
  460. return androidJavaNativeAntiAddiction.Call<string>("getCurrentToken");
  461. }
  462. private static int PerformAndroidGetCurrentUserAgeLimit()
  463. {
  464. Debug.Log("Android getCurrrentUserAgeLimit calling");
  465. return androidJavaNativeAntiAddiction.Call<int>("getCurrentUserAgeLimit");
  466. }
  467. private static int PerformAndroidGetCurrentUserRemainTime()
  468. {
  469. Debug.Log("Android getCurrrentRemainTime calling");
  470. return androidJavaNativeAntiAddiction.Call<int>("getCurrentUserRemainTime");
  471. }
  472. private static void PerformAndroidLogout()
  473. {
  474. Debug.Log("Android logout calling");
  475. androidJavaNativeAntiAddiction.Call("logout");
  476. }
  477. private static void PerformAndroidCheckPayLimit(long amount)
  478. {
  479. Debug.Log("Android checkPayLimit calling");
  480. AndroidJavaClass unityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
  481. AndroidJavaObject unityActivity = unityClass.GetStatic<AndroidJavaObject>("currentActivity");
  482. androidJavaNativeAntiAddiction.Call("checkPayLimit", unityActivity, amount);
  483. }
  484. private static void PerformAndroidSubmitPayResult(long amount)
  485. {
  486. Debug.Log("Android submitPayResult calling");
  487. androidJavaNativeAntiAddiction.Call("submitPayResult", amount);
  488. }
  489. private static void PerformAndroidEnterGame()
  490. {
  491. Debug.Log("Android enterGame calling");
  492. androidJavaNativeAntiAddiction.Call("enterGame");
  493. }
  494. private static void PerformAndroidLeaveGame()
  495. {
  496. Debug.Log("Android leaveGame calling");
  497. androidJavaNativeAntiAddiction.Call("leaveGame");
  498. }
  499. private static void PerformAndroidSetUnityVersion(string version)
  500. {
  501. Debug.Log("Android setUnityVersion calling");
  502. androidJavaNativeAntiAddiction.Call("setUnityVersion", version);
  503. }
  504. private static int PerformAndroidIsStandalone()
  505. {
  506. int result = androidJavaNativeAntiAddiction.Call<int>("isStandalone");
  507. Debug.Log("Android PerformAndroidIsStandalone calling" + result.ToString());
  508. return result;
  509. }
  510. /*
  511. * ------------------
  512. * Internal Method(iOS)
  513. * ------------------
  514. */
  515. private static void PerformiOSInit(string gameIdentifier
  516. , bool useTimeLimit
  517. , bool usePaymentLimit
  518. )
  519. {
  520. Debug.Log("PerformiOSInit:" + gameIdentifier);
  521. initSDK(gameIdentifier, useTimeLimit, usePaymentLimit, true);
  522. }
  523. private static void PerformiOSInit(string gameIdentifier
  524. , bool useTimeLimit
  525. , bool usePaymentLimit
  526. , bool showSwitchAccount
  527. )
  528. {
  529. Debug.Log("PerformiOSInit:" + gameIdentifier);
  530. initSDK(gameIdentifier, useTimeLimit, usePaymentLimit, showSwitchAccount);
  531. }
  532. private static void PerformiOSStartup(
  533. bool useTapLogin
  534. , string userIdentifier
  535. )
  536. {
  537. Debug.Log("PerformiOSStartup:" + userIdentifier);
  538. startup(userIdentifier, useTapLogin);
  539. }
  540. private static string PerformiOSGetCurrentToken()
  541. {
  542. // to implement
  543. Debug.Log("PerformiOSGetCurrentToken");
  544. return getCurrentAntiToken();
  545. }
  546. private static int PerformiOSGetCurrentUserAgeLimit()
  547. {
  548. // to implement
  549. return getCurrentUserAgeLimit();
  550. }
  551. private static int PerformiOSGetCurrentUserRemainTime()
  552. {
  553. // to implement
  554. return getCurrentUserRemainTime();
  555. }
  556. private static void PerformiOSEnterGame()
  557. {
  558. enterGame();
  559. }
  560. private static void PerformiOSLeaveGame()
  561. {
  562. leaveGame();
  563. }
  564. private static void PerformiOSLogout()
  565. {
  566. logout();
  567. }
  568. private static void PerformiOSCheckPayLimit(long amount)
  569. {
  570. checkPayLimit(amount);
  571. }
  572. private static void PerformiOSSubmitPayResult(long amount)
  573. {
  574. submitPayResult(amount);
  575. }
  576. private static void PerformiOSSetUnityVersion(string version)
  577. {
  578. setUnityVersion(version);
  579. }
  580. private static Boolean PerformiOSIsStandalone() {
  581. return standalone();
  582. }
  583. private static void setTestMode(bool testMode) {
  584. if (testMode)
  585. {
  586. var command = new Command.Builder()
  587. .Service("TDSCommonService")
  588. .Method("addReplacedHostPair")
  589. .Args("hostToBeReplaced", "https://www.taptap.com")
  590. .Args("replacedHost", "https://www.xdrnd.com").CommandBuilder();
  591. EngineBridge.GetInstance().CallHandler(command);
  592. command = new Command.Builder()
  593. .Service("TDSCommonService")
  594. .Method("shareInstance")
  595. .Method("addReplacedHostPair")
  596. .Args("hostToBeReplaced", "https://tds-tapsdk.cn.tapapis.com")
  597. .Args("replacedHost", "https://tds-api.xdrnd.com").CommandBuilder();
  598. EngineBridge.GetInstance().CallHandler(command);
  599. command = new Command.Builder()
  600. .Service("TDSCommonService")
  601. .Method("addReplacedHostPair")
  602. .Args("hostToBeReplaced", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1pM6yfulomBTXWKiQT5gK9fY4hq11Kv8D+ewum25oPGReuEn6dez7ogA8bEyQlnYYUoEp5cxYPBbIxJFy7q1qzQhTFphuFzoC1x7DieTvfZbh+b60psEottrCD8M0Pa3h44pzyIp5U5WRpxRcQ9iULolGLHZXJr9nW6bpOsyEIFG5tQ7qCBj8HSFoNBKZH+5Cwh3j5cjmyg55WdJTimg9ysbbwZHYmI+TFPuGo/ckHT6j4TQLCmmxI8Qf5pycn3/qJWFhjx/y8zaxgn2hgxbma8hyyGRCMnhM5tISYQv4zlQF+5RashvKa2zv+FHA5DALzIsGXONeTxk6TSBalX5gQIDAQAB")
  603. .Args("replacedHost", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAks5GmqBvtcVihXvUorEh3KTHBteK36/4G5e3UOnYKbahspU9+FaJx/GaQxdtnFzkVXoGHVlYkhYokY12YO+OVB9INSgzwfxDGd2ttAsqCsUBl0GCVDzBHnS0agf7hk6YVljG8dRN01yW6q50XQCqyS2L3bfXDuWmUT8upgZ6fJSJRRRGh+vt9AJRBwZb3vQ/d/iejWH/64mGnM154CZGr+28SZ8AAXiCJ0BrfyGZqbhoqeWbFUbI7zv3FXiawuqS5EatH5ZU0ll14MlXdcIK7NzcDKCb/tekkr5zPDdTOPkQ5KDrwOx6oMEYs1sLC37nB0Me6mQWQPZY0lYPQ/GmwwIDAQAB").CommandBuilder();
  604. EngineBridge.GetInstance().CallHandler(command);
  605. command = new Command.Builder()
  606. .Service("TDSCommonService")
  607. .Method("addReplacedHostPair")
  608. .Args("hostToBeReplaced", "https://openapi.taptap.com")
  609. .Args("replacedHost", "https://open.api.xdrnd.com").CommandBuilder();
  610. EngineBridge.GetInstance().CallHandler(command);
  611. }
  612. else
  613. {
  614. var command = new Command.Builder()
  615. .Service("TDSCommonService")
  616. .Method("addReplacedHostPair")
  617. .Args("hostToBeReplaced", "https://www.taptap.com")
  618. .Args("replacedHost", "https://www.taptap.com").CommandBuilder();
  619. EngineBridge.GetInstance().CallHandler(command);
  620. command = new Command.Builder()
  621. .Service("TDSCommonService")
  622. .Method("shareInstance")
  623. .Method("addReplacedHostPair")
  624. .Args("hostToBeReplaced", "https://tds-tapsdk.cn.tapapis.com")
  625. .Args("replacedHost", "https://tds-tapsdk.cn.tapapis.com").CommandBuilder();
  626. EngineBridge.GetInstance().CallHandler(command);
  627. command = new Command.Builder()
  628. .Service("TDSCommonService")
  629. .Method("addReplacedHostPair")
  630. .Args("hostToBeReplaced", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1pM6yfulomBTXWKiQT5gK9fY4hq11Kv8D+ewum25oPGReuEn6dez7ogA8bEyQlnYYUoEp5cxYPBbIxJFy7q1qzQhTFphuFzoC1x7DieTvfZbh+b60psEottrCD8M0Pa3h44pzyIp5U5WRpxRcQ9iULolGLHZXJr9nW6bpOsyEIFG5tQ7qCBj8HSFoNBKZH+5Cwh3j5cjmyg55WdJTimg9ysbbwZHYmI+TFPuGo/ckHT6j4TQLCmmxI8Qf5pycn3/qJWFhjx/y8zaxgn2hgxbma8hyyGRCMnhM5tISYQv4zlQF+5RashvKa2zv+FHA5DALzIsGXONeTxk6TSBalX5gQIDAQAB")
  631. .Args("replacedHost", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1pM6yfulomBTXWKiQT5gK9fY4hq11Kv8D+ewum25oPGReuEn6dez7ogA8bEyQlnYYUoEp5cxYPBbIxJFy7q1qzQhTFphuFzoC1x7DieTvfZbh+b60psEottrCD8M0Pa3h44pzyIp5U5WRpxRcQ9iULolGLHZXJr9nW6bpOsyEIFG5tQ7qCBj8HSFoNBKZH+5Cwh3j5cjmyg55WdJTimg9ysbbwZHYmI+TFPuGo/ckHT6j4TQLCmmxI8Qf5pycn3/qJWFhjx/y8zaxgn2hgxbma8hyyGRCMnhM5tISYQv4zlQF+5RashvKa2zv+FHA5DALzIsGXONeTxk6TSBalX5gQIDAQAB").CommandBuilder();
  632. EngineBridge.GetInstance().CallHandler(command);
  633. command = new Command.Builder()
  634. .Service("TDSCommonService")
  635. .Method("addReplacedHostPair")
  636. .Args("hostToBeReplaced", "https://openapi.taptap.com")
  637. .Args("replacedHost", "https://openapi.taptap.com").CommandBuilder();
  638. EngineBridge.GetInstance().CallHandler(command);
  639. }
  640. }
  641. }
  642. }