QSDKMgr.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace qsdk
  4. {
  5. public class SDKOrderExtraInfo
  6. {
  7. public int serverId;
  8. public string platform;
  9. public string subPlatform;
  10. public string orderNo;
  11. }
  12. public class QSdkMgr
  13. {
  14. public static QKSDKInitState InitState = QKSDKInitState.None;
  15. public static void SetListener(string listener)
  16. {
  17. #if UNITY_IOS
  18. QSDK_SetListener(listener);
  19. #endif
  20. }
  21. public static void Init()
  22. {
  23. #if UNITY_IOS
  24. QSDK_Init();
  25. #endif
  26. }
  27. public static void Login()
  28. {
  29. #if UNITY_IOS
  30. QSDK_login();
  31. #endif
  32. }
  33. public static void Pay(string productId, string productName, string amount, string orderNo,
  34. string callBackUrl, string extrasParams,
  35. string gameName, string serverName, string productDesc, string serverID, string accountID, string roleID, string roleLv)
  36. {
  37. #if UNITY_IOS
  38. QSDK_Pay( productId, productName, amount, orderNo,
  39. callBackUrl, extrasParams,
  40. gameName, serverName, productDesc,
  41. serverID,accountID,roleID,roleLv);
  42. #endif
  43. }
  44. public static void Logout()
  45. {
  46. #if UNITY_IOS
  47. QSDK_logout();
  48. #endif
  49. }
  50. public static void UpdateRoleInfo(int type,GameRoleInfo roleInfo,string extra)
  51. {
  52. #if UNITY_IOS
  53. QSDK_UpdateRoleInfo(type,roleInfo.roleName,roleInfo.roleId,roleInfo.roleLv.ToString(),roleInfo.serverName,roleInfo.serverId.ToString(),extra);
  54. #endif
  55. }
  56. #if UNITY_IOS
  57. [DllImport("__Internal")]
  58. private static extern void QSDK_SetListener(string callbackGoName);
  59. [DllImport("__Internal")]
  60. private static extern void QSDK_Init();
  61. [DllImport("__Internal")]
  62. private static extern void QSDK_login();
  63. [DllImport("__Internal")]
  64. private static extern void QSDK_Pay(string productId, string productName, string amount, string orderNo,
  65. string callBackUrl, string extrasParams,
  66. string gameName, string serverName, string productDesc,
  67. string serverID, string accountID, string roleID, string roleLv);
  68. [DllImport("__Internal")]
  69. private static extern void QSDK_logout();
  70. [DllImport("__Internal")]
  71. private static extern void QSDK_UpdateRoleInfo(int type,string roleName,string roleId,string roleLv, string serverName,string serverId,string extra);
  72. #endif
  73. }
  74. }