| | |
| | | static NSString* sUserName;
|
| | | static NSThread* _thread;
|
| | | static NSString* channel;
|
| | | static bool isOPSdkInitOK = false; //渠道sdk是否初始化成功
|
| | | static bool isGameInitOK = false; //游戏的代码模块是否加载,sdk在热更部分,未加载会导致初始化失败
|
| | |
|
| | |
|
| | |
|
| | | -(id)init
|
| | | {
|
| | |
| | |
|
| | | -(void) Init
|
| | | {
|
| | | |
| | | isGameInitOK = true;
|
| | | if (isOPSdkInitOK)
|
| | | {
|
| | | [self SendToGameSdkInitOK];
|
| | | }
|
| | | UIDevice *_device = [UIDevice currentDevice];
|
| | | _device.batteryMonitoringEnabled = true;
|
| | |
|
| | |
| | | // ------------------------------------------------------
|
| | | }
|
| | |
|
| | | - (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;
|
| | |
| | | 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:
|