Browse Source

更新iOS douyou sdk交互文件

hexiaojie 1 year ago
parent
commit
6ed8c9855d

+ 5 - 5
GameClient/Assets/Plugins/iOS/StraightPush/SDKManager.h

@@ -13,10 +13,10 @@
 
 @property (nonatomic, assign) BOOL shouldLog;
 
-- (void)__ImportInitWithDigitMap:(NSString *)gameId ring:(NSString *)adId shouldLog:(BOOL)shouldLog;
-- (void)__ImportLogin;
-- (void)__ImportLogout;
-- (void)__ImportPaymentWithJson:(NSString *)paymentJson;
-- (void)__ImportRoleInfoWithJson:(NSString *)roleJson;
+- (void)InitWithDigitMap:(NSString *)gameId ring:(NSString *)adId shouldLog:(BOOL)shouldLog;
+- (void)Login;
+- (void)Logout;
+- (void)PaymentWithJson:(NSString *)paymentJson;
+- (void)RoleInfoWithJson:(NSString *)roleJson;
 
 @end

+ 5 - 30
GameClient/Assets/Plugins/iOS/StraightPush/SDKManager.m

@@ -16,7 +16,7 @@
 }
 
 //实例化sdk
-- (void)iosInitWithDigitMap:(NSString *)gameId ring:(NSString *)adId  shouldLog:(BOOL)shouldLog{
+- (void)InitWithDigitMap:(NSString *)gameId ring:(NSString *)adId  shouldLog:(BOOL)shouldLog{
     if (shouldLog != self.shouldLog) {
         self.shouldLog = shouldLog;
     }
@@ -34,7 +34,7 @@
 }
 
 //调起登陆
-- (void)iosLogin {
+- (void)Login {
     [[PullInter bringInstance] zipBannerBlock:^(NSDictionary *params) {
         if (self.shouldLog) {
             NSLog(@"登录成功:%@", params);
@@ -54,7 +54,7 @@
 }
 
 //退出登陆
-- (void)iosLogout {
+- (void)Logout {
     [[PullInter bringInstance] sortWetTipBlock:^(NSDictionary *params) {
         if (self.shouldLog) {
             NSLog(@"登出成功%@", params);
@@ -69,7 +69,7 @@
 }
 
 // 调起支付
-- (void)iosPaymentWithJson:(NSString *)paymentJson {
+- (void)PaymentWithJson:(NSString *)paymentJson {
     NSData *jsonData = [paymentJson dataUsingEncoding:NSUTF8StringEncoding];
     NSError *jsonError;
     NSDictionary *paymentInfo = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
@@ -94,7 +94,7 @@
 }
 
 // 角色升级上报
-- (void)iosRoleInfoWithJson:(NSString *)roleJson {
+- (void)RoleInfoWithJson:(NSString *)roleJson {
     NSData *jsonData = [roleJson dataUsingEncoding:NSUTF8StringEncoding];
     NSError *jsonError;
     NSDictionary *roleInfo = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
@@ -158,30 +158,5 @@
     
     UnitySendMessage(gameObject, methodName, jsonStringC);
 }
-
-// C-style function declarations
-extern "C" void __ImportInitWithDigitMap(const char *gameId, const char *adId, bool shouldLog) {
-    NSString *gameIdStr = [NSString stringWithUTF8String:gameId];
-    NSString *adIdStr = [NSString stringWithUTF8String:adId];
-    [[SDKManager sharedInstance] iosInitWithDigitMap:gameIdStr ring:adIdStr shouldLog:shouldLog];
-}
-
-extern "C" void __ImportLogin() {
-    [[SDKManager sharedInstance] iosLogin];
-}
-
-extern "C" void __ImportLogout() {
-    [[SDKManager sharedInstance] iosLogout];
-}
-
-extern "C" void __ImportPaymentWithJson(const char *paymentJson) {
-    NSString *paymentJsonStr = [NSString stringWithUTF8String:paymentJson];
-    [[SDKManager sharedInstance] iosPaymentWithJson:paymentJsonStr];
-}
-
-extern "C" void __ImportRoleInfoWithJson(const char *roleJson) {
-    NSString *roleJsonStr = [NSString stringWithUTF8String:roleJson];
-    [[SDKManager sharedInstance] iosRoleInfoWithJson:roleJsonStr];
-}
 @end
 

+ 30 - 0
GameClient/Assets/Plugins/iOS/StraightPush/SDKManagerExt.mm

@@ -0,0 +1,30 @@
+// SDKManagerExt.mm
+#import "SDKManager.h"
+
+// Define C-style functions to expose Objective-C methods
+extern "C" {
+void __ImportInitWithDigitMap(const char *gameId, const char *adId, bool shouldLog) {
+NSString *gameIdStr = [NSString stringWithUTF8String:gameId];
+NSString *adIdStr = [NSString stringWithUTF8String:adId];
+[[SDKManager sharedInstance] InitWithDigitMap:gameIdStr ring:adIdStr shouldLog:shouldLog];
+}
+
+void __ImportLogin() {
+[[SDKManager sharedInstance] Login];
+}
+
+void __ImportLogout() {
+[[SDKManager sharedInstance] Logout];
+}
+
+void __ImportPaymentWithJson(const char *paymentJson) {
+NSString *paymentJsonStr = [NSString stringWithUTF8String:paymentJson];
+[[SDKManager sharedInstance] PaymentWithJson:paymentJsonStr];
+}
+
+void __ImportRoleInfoWithJson(const char *roleJson) {
+NSString *roleJsonStr = [NSString stringWithUTF8String:roleJson];
+[[SDKManager sharedInstance] RoleInfoWithJson:roleJsonStr];
+}
+
+}