hexiaojie пре 1 година
родитељ
комит
d2d303ed01

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

@@ -13,11 +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)__ImportInitWithDigitMap:(NSString *)gameId ring:(NSString *)adId shouldLog:(BOOL)shouldLog;
+- (void)__ImportLogin;
+- (void)__ImportLogout;
+- (void)__ImportPaymentWithJson:(NSString *)paymentJson;
+- (void)__ImportRoleInfoWithJson:(NSString *)roleJson;
 
 @end
-

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

@@ -16,7 +16,7 @@
 }
 
 //实例化sdk
-- (void)ImportInitWithDigitMap:(NSString *)gameId ring:(NSString *)adId  shouldLog:(BOOL)shouldLog{
+- (void)iosInitWithDigitMap:(NSString *)gameId ring:(NSString *)adId  shouldLog:(BOOL)shouldLog{
     if (shouldLog != self.shouldLog) {
         self.shouldLog = shouldLog;
     }
@@ -33,9 +33,8 @@
     }];
 }
 
-
 //调起登陆
-- (void)ImportLogin {
+- (void)iosLogin {
     [[PullInter bringInstance] zipBannerBlock:^(NSDictionary *params) {
         if (self.shouldLog) {
             NSLog(@"登录成功:%@", params);
@@ -55,7 +54,7 @@
 }
 
 //退出登陆
-- (void)ImportLogout {
+- (void)iosLogout {
     [[PullInter bringInstance] sortWetTipBlock:^(NSDictionary *params) {
         if (self.shouldLog) {
             NSLog(@"登出成功%@", params);
@@ -70,7 +69,7 @@
 }
 
 // 调起支付
-- (void)ImportPaymentWithJson:(NSString *)paymentJson {
+- (void)iosPaymentWithJson:(NSString *)paymentJson {
     NSData *jsonData = [paymentJson dataUsingEncoding:NSUTF8StringEncoding];
     NSError *jsonError;
     NSDictionary *paymentInfo = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
@@ -95,7 +94,7 @@
 }
 
 // 角色升级上报
-- (void)ImportRoleInfoWithJson:(NSString *)roleJson {
+- (void)iosRoleInfoWithJson:(NSString *)roleJson {
     NSData *jsonData = [roleJson dataUsingEncoding:NSUTF8StringEncoding];
     NSError *jsonError;
     NSDictionary *roleInfo = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
@@ -159,5 +158,30 @@
     
     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
 

+ 15 - 15
GameClient/Assets/ThirdParty/DouYou/AbDouYouSDKIosHandler.cs

@@ -5,53 +5,53 @@ namespace DouYouSdk
 {
     public abstract class AbDouYouSDKIosHandler : MonoBehaviour
     {
-        [DllImport("__Internal")]
-        private static extern void ImportInitWithDigitMap(string gameId, string adId, bool shouldLog);
+        [DllImport("__Internal", EntryPoint="__ImportInitWithDigitMap")]
+        private static extern void __ImportInitWithDigitMap(string gameId, string adId, bool shouldLog);
 
-        [DllImport("__Internal")]
-        private static extern void ImportLogin();
+        [DllImport("__Internal", EntryPoint="__ImportLogin")]
+        private static extern void __ImportLogin();
 
-        [DllImport("__Internal")]
-        private static extern void ImportLogout();
+        [DllImport("__Internal", EntryPoint="__ImportLogout")]
+        private static extern void __ImportLogout();
 
-        [DllImport("__Internal")]
-        private static extern void ImportPaymentWithJson(string paymentJson);
+        [DllImport("__Internal", EntryPoint="__ImportPaymentWithJson")]
+        private static extern void __ImportPaymentWithJson(string paymentJson);
 
-        [DllImport("__Internal")]
-        private static extern void ImportRoleInfoWithJson(string roleJson);
+        [DllImport("__Internal", EntryPoint="__ImportRoleInfoWithJson")]
+        private static extern void __ImportRoleInfoWithJson(string roleJson);
 
         //实例化sdk
         public virtual void SDKInitWithDigitMap(string gameId, string adId, bool shouldLog)
         {
-            ImportInitWithDigitMap(gameId, adId, shouldLog);
+            __ImportInitWithDigitMap(gameId, adId, shouldLog);
             Debug.Log($"SDKInitWithDigitMap:gameId:{gameId} adId:{adId} shouldLog:{shouldLog}");
         }
 
         //调起登陆
         public virtual void SDKLogin()
         {
-            ImportLogin();
+            __ImportLogin();
             Debug.Log($"SDKLogin");
         }
 
         //退出登陆
         public virtual void SDKLogout()
         {
-            ImportLogout();
+            __ImportLogout();
             Debug.Log($"SDKLogout");
         }
 
         //调起支付
         public virtual void SdkPaymentWithJson(string paymentJson)
         {
-            ImportPaymentWithJson(paymentJson);
+            __ImportPaymentWithJson(paymentJson);
             Debug.Log($"SdkPaymentWithJson. paymentJson:{paymentJson}");
         }
 
         //角色升级上报
         public virtual void SDKRoleInfo(string roleJson)
         {
-            ImportRoleInfoWithJson(roleJson);
+            __ImportRoleInfoWithJson(roleJson);
             Debug.Log($"SDKRoleInfo. roleJson:{roleJson}");
         }