SDKManagerExt.mm 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SDKManagerExt.mm
  2. #import "SDKManager.h"
  3. // Define C-style functions to expose Objective-C methods
  4. extern "C" {
  5. void __ImportInitWithDigitMap(const char *gameId, const char *adId, bool shouldLog) {
  6. NSString *gameIdStr = [NSString stringWithUTF8String:gameId];
  7. NSString *adIdStr = [NSString stringWithUTF8String:adId];
  8. [[SDKManager sharedInstance] InitWithDigitMap:gameIdStr ring:adIdStr shouldLog:shouldLog];
  9. }
  10. void __ImportLogin() {
  11. [[SDKManager sharedInstance] Login];
  12. }
  13. void __ImportLogout() {
  14. [[SDKManager sharedInstance] Logout];
  15. }
  16. void __ImportPaymentWithJson(const char *cpOrderId, const char *productPrice, const char *productId, const char *productName,
  17. const char *productDesc, const char *productCount, const char *exchangeRate, const char *currencyName, const char *serverId,
  18. const char *serverName, const char *roleId, const char *roleName, const char *roleLevel, const char *roleVip, const char *partyName,
  19. const char *roleBalence, const char *ext) {
  20. NSDictionary *bayInfo = @{
  21. @"product_id": productId ?: @"",
  22. @"product_price" :productPrice ?: @"",
  23. @"product_name" :productName ?: @"",
  24. @"role_id" : roleId ?: @"",
  25. @"role_name" : roleName ?: @"",
  26. @"role_level" : roleLevel ?: @"",
  27. @"server_id" : serverId ?: @"",
  28. @"server_name": serverName ?: @"",
  29. @"role_vip" : roleVip ?: @"",
  30. @"party_name" : partyName ?: @"",
  31. @"role_balence" : roleBalence ?: @"",
  32. @"cp_order_id" : cpOrderId ?: @"",
  33. @"product_count" : productCount ?: @"",
  34. @"product_desc" : productDesc ?: @"",
  35. @"exchange_rate" : exchangeRate ?: @"",
  36. @"currency_name" : currencyName ?: @"",
  37. @"ext" : ext ?: @"",
  38. };
  39. [[SDKManager sharedInstance] PaymentWithJson:bayInfo];
  40. }
  41. void __ImportRoleInfoWithJson(const char *type, const char *serverId, const char *serverName, const char *roleId, const char *roleName,
  42. const char *roleLevel, const char *roleVip, const char *partyName, const char *roleBalence) {
  43. NSDictionary *roleInfo = @{
  44. @"type" : type ?: @"",
  45. @"server_id" : serverId ?: @"",
  46. @"server_name" :serverName ?: @"",
  47. @"role_id" : roleId ?: @"",
  48. @"role_name" : roleName ?: @"",
  49. @"role_level" : roleLevel ?: @"",
  50. @"role_vip" : roleVip ?: @"",
  51. @"party_name" :partyName ?: @"",
  52. @"role_balence" : roleBalence ?: @""
  53. };
  54. [[SDKManager sharedInstance] RoleInfoWithJson:roleInfo];
  55. }
  56. }