From c1fba96d94b6f080a3b866260b9bb2be3b722400 Mon Sep 17 00:00:00 2001
From: allez <305670599@qq.com>
Date: 星期一, 01 四月 2024 16:43:44 +0800
Subject: [PATCH] 0312 iossdk初始化成功的通知要等待游戏代码加载后
---
Channel/IOS/bthygame/Plugins/The2thWorldSDK/UniversalSDK.mm | 44 ++++++++++++++++++++++++++++++--------------
1 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/Channel/IOS/bthygame/Plugins/The2thWorldSDK/UniversalSDK.mm b/Channel/IOS/bthygame/Plugins/The2thWorldSDK/UniversalSDK.mm
index 6507195..545c79f 100644
--- a/Channel/IOS/bthygame/Plugins/The2thWorldSDK/UniversalSDK.mm
+++ b/Channel/IOS/bthygame/Plugins/The2thWorldSDK/UniversalSDK.mm
@@ -29,6 +29,8 @@
static NSString* sUserName;
static NSThread* _thread;
static NSString* channel;
+static bool isOPSdkInitOK = false; //娓犻亾sdk鏄惁鍒濆鍖栨垚鍔�
+static bool isGameInitOK = false; //娓告垙鐨勪唬鐮佹ā鍧楁槸鍚﹀姞杞斤紝sdk鍦ㄧ儹鏇撮儴鍒嗭紝鏈姞杞戒細瀵艰嚧鍒濆鍖栧け璐�
-(id)init
{
@@ -46,6 +48,11 @@
-(void) Init
{
+ isGameInitOK = true;
+ if (isOPSdkInitOK)
+ {
+ [self SendToGameSdkInitOK];
+ }
UIDevice *_device = [UIDevice currentDevice];
_device.batteryMonitoringEnabled = true;
@@ -219,6 +226,20 @@
// ------------------------------------------------------
}
+- (void) SendToGameSdkInitOK
+{
+ NSLog(@"鍒濆鍖栨垚鍔�");
+
+ NSString *_appid = sAppID;
+ NSLog(@"init _appid:%@",_appid);
+
+ NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithInt:S2U_SdkInitComplete], @"code",
+ @"hygame", @"channelPlatform",
+ _appid, @"yj_appid", _appid, @"yj_spid", nil];
+ [self SendMessageToUnity:_dict];
+}
+
- (void)smpcQpInitResult:(NSNotification *)notify {
NSLog(@"init result:%@",notify);
NSDictionary *userInfo = notify.userInfo;
@@ -226,20 +247,15 @@
switch (errorCode) {
case SMPC_QUICK_SDK_ERROR_NONE:
{
- NSLog(@"鍒濆鍖栨垚鍔�");
-// NSString *_appid = [[SMPCQuickSDK defaultInstance] getConfigValue:@"zfappid"];
-// if (_appid == nil || [_appid isEqualToString:@""])
-// {
-// _appid = sAppID;
-// }
- NSString *_appid = sAppID;
- NSLog(@"init _appid:%@",_appid);
-
- NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:S2U_SdkInitComplete], @"code",
- @"hygame", @"channelPlatform",
- _appid, @"yj_appid", _appid, @"yj_spid", nil];
- [self SendMessageToUnity:_dict];
+ isOPSdkInitOK = true;
+ if (isGameInitOK)
+ {
+ [self SendToGameSdkInitOK];
+ }
+ else
+ {
+ NSLog(@"娓犻亾sdk鍒濆鍖栨垚鍔燂紝绛夊緟娓告垙鍔犺浇鍚庨�氱煡");
+ }
}
break;
case SMPC_QUICK_SDK_ERROR_INIT_FAILED:
--
Gitblit v1.8.0