Example #1
0
 public static void CreateInstant(OnCompleteDelegate onCompleteDelegate = null)
 {
     if (Instant == null)
     {
         Instant = new SGConfig(onCompleteDelegate);
     }
 }
Example #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();
            }
        }