public static void Init(FacebookUnity.InitDelegate onInitComplete = null, FacebookUnity.HideUnityDelegate onHideUnity = null, string authResponse = null)
 {
     FacebookUnity.FB.Init(() =>
     {
         onInitComplete?.Invoke();
     }, (isUnityShown) =>
     {
         onHideUnity?.Invoke(isUnityShown);
     },
                           authResponse);
 }
示例#2
0
        /// <summary>
        /// This is the preferred way to call FB.Init(). It will take the facebook app id specified in your "Facebook"
        /// => "Edit Settings" menu when it is called.
        /// </summary>
        /// <param name="onInitComplete">
        /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find
        /// out when you can safely call the other methods.
        /// </param>
        /// <param name="onHideUnity">A delegate to invoke when unity is hidden.</param>
        /// <param name="authResponse">Auth response.</param>
//		public static void Init(InitDelegate onInitComplete = null, HideUnityDelegate onHideUnity = null)
//		{
//			Init(
//				onHideUnity,
//				onInitComplete);
//		}


        /// <summary>
        /// If you need a more programmatic way to set the facebook app id and other setting call this function.
        /// Useful for a build pipeline that requires no human input.
        /// </summary>
        /// <param name="appId">App identifier.</param>
        /// <param name="cookie">If set to <c>true</c> cookie.</param>
        /// <param name="logging">If set to <c>true</c> logging.</param>
        /// <param name="status">If set to <c>true</c> status.</param>
        /// <param name="xfbml">If set to <c>true</c> xfbml.</param>
        /// <param name="frictionlessRequests">If set to <c>true</c> frictionless requests.</param>
        /// <param name="authResponse">Auth response.</param>
        /// <param name="onHideUnity">
        /// A delegate to invoke when unity is hidden.
        /// </param>
        /// <param name="onInitComplete">
        /// Delegate is called when FB.Init() finished initializing everything. By passing in a delegate you can find
        /// out when you can safely call the other methods.
        /// </param>
        public static void Init(
            HideUnityDelegate onHideUnity = null,
            InitDelegate onInitComplete   = null,
            KingskyDelegate <IPurchaseResult> onPurchaseCompleteDelegate = null,
            Action <bool> gameCenter           = null,
            Dictionary <string, object> extras = null, Facebook.Unity.InitDelegate onInitCompleteFacebook = null, Facebook.Unity.HideUnityDelegate onHideUnityFacebook = null, string authResponseFacebook = null)
        {
//			if (string.IsNullOrEmpty(appId))
//			{
//				throw new ArgumentException("appId cannot be null or empty!");
//			}
            FB.Init(onInitCompleteFacebook, onHideUnityFacebook, authResponseFacebook);

            SGCross.onInitComplete             = onInitComplete;
            SGCross.onHideUnity                = onHideUnity;
            SGCross.onPurchaseCompleteDelegate = onPurchaseCompleteDelegate;
            SGCross.gameCenter = gameCenter;
            SGCross.extras     = extras;

            if (!isInitCalled)
            {
                                #if UNITY_EDITOR
                ComponentFactory.GetComponent <EditorSupergoodLoader>();
//				#elif UNITY_WEBPLAYER || UNITY_WEBGL
                //				ComponentFactory.GetComponent<CanvasSupergoodLoader>();
                                #elif UNITY_IOS
                ComponentFactory.GetComponent <IOSSupergoodLoader>();
                                #elif UNITY_ANDROID
                ComponentFactory.GetComponent <AndroidSupergoodLoader>();
                                #else
                throw new NotImplementedException("Supergood API does not yet support this platform");
                                #endif
                SGConfig.CreateInstant();
                AnalyticsManager analyticsManager = AnalyticsManager.Instant;
                isInitCalled = true;
                return;
            }

            Debug.LogWarning("KS.Init() has already been called.  You only need to call this once and only once.");

            // Init again if possible just in case something bad actually happened.
            if (SuperGoodImpl != null)
            {
                OnDllLoaded();
            }
        }
 public static void Init(string appId, string clientToken = null, bool cookie = true, bool logging = true, bool status = true, bool xfbml = false, bool frictionlessRequests = true, string authResponse = null, string javascriptSDKLocale = "en_US", FacebookUnity.HideUnityDelegate onHideUnity = null, FacebookUnity.InitDelegate onInitComplete = null)
 {
     FacebookUnity.FB.Init(appId,
                           clientToken,
                           cookie,
                           logging,
                           status,
                           xfbml,
                           frictionlessRequests,
                           authResponse,
                           javascriptSDKLocale,
                           (isUnityShown) =>
     {
         onHideUnity?.Invoke(isUnityShown);
     },
                           () =>
     {
         onInitComplete?.Invoke();
     });
 }