QSDKMgr.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. using System;
  2. using System.Runtime.InteropServices;
  3. namespace qsdk
  4. {
  5. public class QSdkMgr
  6. {
  7. public static QKSDKInitState InitState = QKSDKInitState.None;
  8. public static void SetListener(string listener)
  9. {
  10. #if UNITY_IOS
  11. QSDK_SetListener(listener);
  12. #endif
  13. }
  14. public static void Init()
  15. {
  16. #if UNITY_IOS
  17. QSDK_Init();
  18. #endif
  19. }
  20. public static void Login()
  21. {
  22. #if UNITY_IOS
  23. QSDK_login();
  24. #endif
  25. }
  26. public static void Pay(string productId, string productName, string amount, string orderNo,
  27. string callBackUrl, string extrasParams,
  28. string gameName, string serverName, string productDesc, string serverID, string accountID, string roleID, string roleLv)
  29. {
  30. #if UNITY_IOS
  31. QSDK_Pay( productId, productName, amount, orderNo,
  32. callBackUrl, extrasParams,
  33. gameName, serverName, productDesc,
  34. serverID,accountID,roleID,roleLv);
  35. #endif
  36. }
  37. public static void Logout()
  38. {
  39. #if UNITY_IOS
  40. QSDK_logout();
  41. #endif
  42. }
  43. #if UNITY_IOS
  44. [DllImport("__Internal")]
  45. private static extern void QSDK_SetListener(string callbackGoName);
  46. [DllImport("__Internal")]
  47. private static extern void QSDK_Init();
  48. [DllImport("__Internal")]
  49. private static extern void QSDK_login();
  50. [DllImport("__Internal")]
  51. private static extern void QSDK_Pay(string productId, string productName, string amount, string orderNo,
  52. string callBackUrl, string extrasParams,
  53. string gameName, string serverName, string productDesc,
  54. string serverID, string accountID, string roleID, string roleLv);
  55. [DllImport("__Internal")]
  56. private static extern void QSDK_logout();
  57. #endif
  58. }
  59. }