SDKManagerExt.mm 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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": [NSString stringWithUTF8String:productId],
  22. @"product_price" :[NSString stringWithUTF8String:productPrice],
  23. @"product_name" :[NSString stringWithUTF8String:productName],
  24. @"role_id" : [NSString stringWithUTF8String:roleId],
  25. @"role_name" : [NSString stringWithUTF8String:roleName],
  26. @"role_level" : [NSString stringWithUTF8String:roleLevel],
  27. @"server_id" : [NSString stringWithUTF8String:serverId],
  28. @"server_name": [NSString stringWithUTF8String:serverName],
  29. @"role_vip" : [NSString stringWithUTF8String:roleVip],
  30. @"party_name" : [NSString stringWithUTF8String:partyName],
  31. @"role_balence" : [NSString stringWithUTF8String:roleBalence],
  32. @"cp_order_id" : [NSString stringWithUTF8String:cpOrderId],
  33. @"product_count" : [NSString stringWithUTF8String:productCount],
  34. @"product_desc" : [NSString stringWithUTF8String:productDesc],
  35. @"exchange_rate" : [NSString stringWithUTF8String:exchangeRate],
  36. @"currency_name" : [NSString stringWithUTF8String:currencyName],
  37. @"ext" : [NSString stringWithUTF8String: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" : [NSString stringWithUTF8String:type],
  45. @"server_id" : [NSString stringWithUTF8String:serverId],
  46. @"server_name" : [NSString stringWithUTF8String:serverName],
  47. @"role_id" : [NSString stringWithUTF8String:roleId],
  48. @"role_name" : [NSString stringWithUTF8String:roleName],
  49. @"role_level" : [NSString stringWithUTF8String:roleLevel],
  50. @"role_vip" : [NSString stringWithUTF8String:roleVip],
  51. @"party_name" : [NSString stringWithUTF8String:partyName],
  52. @"role_balence" : [NSString stringWithUTF8String:roleBalence]
  53. };
  54. [[SDKManager sharedInstance] RoleInfoWithJson:roleInfo];
  55. }
  56. void __ImportSdkJumpUrl() {
  57. [[SDKManager sharedInstance] SdkJumpUrl];
  58. }
  59. }