Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.IO;
- using System.Net;
- using Facebook.Unity;
- using UnityEngine;
- using WebView;
- public class Core : MonoBehaviour
- {
- private void InitCallback()
- {
- if (FB.IsInitialized)
- {
- FB.ActivateApp();
- CheckGameServer();
- }
- else
- {
- Debug.Log("Failed to Initialize the Facebook SDK");
- }
- }
- private void OnHideUnity(bool isGameShown)
- {
- Time.timeScale = isGameShown ? 1 : 0;
- }
- private void Awake()
- {
- OneSignal.StartInit(OneSignalKey)
- .HandleNotificationOpened(HandleNotificationOpened)
- .EndInit();
- OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification;
- if (!FB.IsInitialized)
- {
- FB.Init(InitCallback, OnHideUnity);
- }
- else
- {
- FB.ActivateApp();
- CheckGameServer();
- }
- }
- private void DeepLinkCallback(IAppLinkResult appLinkResult)
- {
- Debug.Log($"DeepLinkCallback {appLinkResult}");
- RunGameCore(appLinkResult.Url);
- }
- private void CheckGameServer()
- {
- FB.Mobile.FetchDeferredAppLinkData(DeepLinkCallback);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement