QSDKMgr.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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)
  29. {
  30. #if UNITY_IOS
  31. QSDK_Pay( productId, productName, amount, orderNo,
  32. callBackUrl, extrasParams,
  33. gameName, serverName, productDesc);
  34. #endif
  35. }
  36. public static void Logout()
  37. {
  38. #if UNITY_IOS
  39. QSDK_logout();
  40. #endif
  41. }
  42. #if UNITY_IOS
  43. [DllImport("__Internal")]
  44. private static extern void QSDK_SetListener(string callbackGoName);
  45. [DllImport("__Internal")]
  46. private static extern void QSDK_Init();
  47. [DllImport("__Internal")]
  48. private static extern void QSDK_login();
  49. [DllImport("__Internal")]
  50. private static extern void QSDK_Pay(string productId, string productName, string amount, string orderNo,
  51. string callBackUrl, string extrasParams,
  52. string gameName, string serverName, string productDesc);
  53. [DllImport("__Internal")]
  54. private static extern void QSDK_logout();
  55. #endif
  56. }
  57. }