| | |
| | | static NSString* sUserName; |
| | | static NSThread* _thread; |
| | | |
| | | static int initedState=0; //初始化状态,0初始化中,1成功,2失败 |
| | | //初始化状态,0初始化中,1成功 |
| | | static int initedState=0; |
| | | |
| | | static NSString * const kClientID = @"468442318367-ocoqrm0kei0gpkrnnq1ql628v4g4dbqd.apps.googleusercontent.com"; |
| | | |
| | |
| | | [Soha sohaInitWithGameDelegate:self |
| | | application:[UIApplication sharedApplication] |
| | | launchOptions:launchOptions |
| | | loginManually:NO |
| | | loginManually:YES |
| | | andSetLanguageTo:SohaSDKLanguageVietnam]; |
| | | [Soha showInAppPopupTracking]; |
| | | |
| | |
| | | [Soha showInAppPopupTracking]; |
| | | } |
| | | |
| | | - (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window |
| | | { |
| | | // return UIInterfaceOrientationMaskAll; |
| | | // return UIInterfaceOrientationMaskPortrait; |
| | | return UIInterfaceOrientationMaskLandscape; |
| | | } |
| | | |
| | | - (BOOL)application:(UIApplication *)app |
| | | openURL:(NSURL *)url |
| | | options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{ |
| | | return [Soha application:app |
| | | openURL:url |
| | | options:options]; |
| | | } |
| | | |
| | | - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler{ |
| | | return [Soha application:application |
| | | continueUserActivity:userActivity |
| | | restorationHandler:restorationHandler]; |
| | | } |
| | | |
| | | - (void)applicationDidEnterBackground:(UIApplication *)application |
| | | { |
| | | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. |
| | | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. |
| | | [Soha sohaHandleDidEnterBackground]; |
| | | } |
| | | |
| | | - (void)applicationWillEnterForeground:(UIApplication *)application |
| | | { |
| | | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. |
| | | [Soha sohaHandleDidEnterForeground]; |
| | | } |
| | | |
| | | - (void)applicationDidBecomeActive:(UIApplication *)application |
| | | { |
| | | /* |
| | | Need for facebook |
| | | */ |
| | | [Soha sohaHandleDidBecomeActive]; |
| | | } |
| | | |
| | | - (void)applicationWillTerminate:(UIApplication *)application |
| | | { |
| | | /* |
| | | Need for facebook |
| | | */ |
| | | [Soha sohaHandleWillTerminate]; |
| | | } |
| | | |
| | | |
| | | - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { |
| | | [Soha sohaPostDeviceToken:deviceToken]; |
| | | } |
| | | |
| | | - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{ |
| | | [Soha userNotificationCenter:center didReceiveNotificationResponse:response]; |
| | | } |
| | | |
| | | - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{ |
| | | [Soha userNotificationCenter:center willPresentNotification:notification]; |
| | | } |
| | | |
| | | |
| | | - (void)sohaDeleteAccountDelegate:(SohaUser *)user |
| | | { |
| | | NSLog(@"删除角色 callback"); |
| | | if(user) |
| | | { |
| | | NSLog(@"删除角色 ok"); |
| | | NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys: |
| | | [NSNumber numberWithInt:S2U_DelAccount], @"code", nil]; |
| | | [self SendMessageToUnity:_dict]; |
| | | } |
| | | } |
| | | |
| | | - (void)PlatformInitFinished{ |
| | |
| | | case U2S_FreePlatformLogin: |
| | | [self PlatformLogin]; |
| | | break; |
| | | case U2S_ShowAccountView: |
| | | case U2S_GoToAppStore: |
| | | { |
| | | |
| | | [[UIApplication sharedApplication] openURL:[NSURL URLWithString:_dict[@"url"]] options:@{} completionHandler:nil]; |
| | | } |
| | | break; |
| | | case U2S_FreePlatformLogout: |
| | |
| | | NSString *orderInfos = [strArray componentsJoinedByString:@"|"]; |
| | | |
| | | NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys: |
| | | [NSNumber numberWithInt:OrderInfoCallBack], @"code", orderInfos, @"orderInfos", nil]; |
| | | [NSNumber numberWithInt:S2U_OrderInfoCallBack], @"code", orderInfos, @"orderInfos", nil]; |
| | | |
| | | [self SendMessageToUnity:_dict]; |
| | | }]; |
| | |
| | | break; |
| | | case U2S_BatteryListenStop: |
| | | break; |
| | | case U2S_DelAccount: |
| | | [Soha deleteAccount]; |
| | | break; |
| | | case U2S_GoToReview: |
| | | { |
| | | [Soha requestReviewApp]; |
| | | break; |
| | | } |
| | | case U2S_CloseVote: |
| | | { |
| | | break; |
| | | } |
| | | case U2S_OpenDashboard: |
| | | { |
| | | [Soha sohaDashboard]; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |