Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1.  private void InitCallback()
  2.     {
  3.         if (FB.IsInitialized)
  4.         {
  5.             FB.ActivateApp();
  6.             CheckGameServer();
  7.         }
  8.         else
  9.         {
  10.             Debug.Log("Failed to Initialize the Facebook SDK");
  11.         }
  12.     }
  13.  
  14.     private void OnHideUnity(bool isGameShown)
  15.     {
  16.         Time.timeScale = isGameShown ? 1 : 0;
  17.     }
  18.  
  19.     private void Awake()
  20.     {
  21.         OneSignal.StartInit(OneSignalKey)
  22.             .HandleNotificationOpened(HandleNotificationOpened)
  23.             .EndInit();
  24.  
  25.         OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification;
  26.  
  27.         if (!FB.IsInitialized)
  28.         {
  29.             FB.Init(InitCallback, OnHideUnity);
  30.         }
  31.         else
  32.         {
  33.             FB.ActivateApp();
  34.             CheckGameServer();
  35.         }
  36.     }
  37.  
  38.     private void DeepLinkCallback(IAppLinkResult appLinkResult)
  39.     {
  40.         Debug.Log($"DeepLinkCallback {appLinkResult}");
  41.         RunGameCore(appLinkResult.Url);
  42.     }
  43.  
  44.     private void CheckGameServer()
  45.     {
  46.         FB.Mobile.FetchDeferredAppLinkData(DeepLinkCallback);
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement