Esempio n. 1
0
 private static void OnDllLoaded()
 {
     FbDebug.Log("Finished loading Facebook dll. Build " + FBBuildVersionAttribute.GetBuildVersionOfType(FacebookImpl.GetType()));
     FacebookImpl.Init(
         OnInitComplete,
         FBSettings.AppId,
         FBSettings.Cookie,
         FBSettings.Logging,
         FBSettings.Status,
         FBSettings.Xfbml,
         FBSettings.ChannelUrl,
         authResponse,
         FBSettings.FrictionlessRequests,
         OnHideUnity
         );
 }
Esempio n. 2
0
    /**
     * 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.
     */
    public static void Init(Facebook.InitDelegate onInitComplete, Facebook.HideUnityDelegate onHideUnity = null, string authResponse = null)
    {
        if (!isInitCalled)
        {
            FB.authResponse   = authResponse;
            FB.OnInitComplete = onInitComplete;
            FB.OnHideUnity    = onHideUnity;

            FbDebug.Log(String.Format("Using SDK {0}, Build {1}", FBBuildVersionAttribute.SDKVersion, FBBuildVersionAttribute.GetBuildVersionOfType(typeof(IFacebook))));

#if UNITY_EDITOR
            FbDebug.Log("Creating Editor version of Facebook object...");
            FBComponentFactory.GetComponent <EditorFacebookLoader>();
#elif UNITY_WEBPLAYER
            FbDebug.Log("Creating Webplayer version of Facebook object...");
            FBComponentFactory.GetComponent <CanvasFacebookLoader>();
#elif UNITY_IOS
            FbDebug.Log("Creating iOS version of Facebook object...");
            FBComponentFactory.GetComponent <IOSFacebookLoader>();
#elif UNITY_ANDROID
            FbDebug.Log("Creating Android version of Facebook object...");
            FBComponentFactory.GetComponent <AndroidFacebookLoader>();
#else
            throw new NotImplementedException("Facebook API does not yet support this platform");
#endif
            FB.isInitCalled = true;
            return;
        }

        FbDebug.Warn("FB.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 (FacebookImpl != null)
        {
            OnDllLoaded();
        }
    }
Esempio n. 3
0
    /**
     * 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.
     */
    public static void Init(
        InitDelegate onInitComplete,
        string appId,
        bool cookie  = true,
        bool logging = true,
        bool status  = true,
        bool xfbml   = false,
        bool frictionlessRequests     = true,
        HideUnityDelegate onHideUnity = null,
        string authResponse           = null)
    {
        FB.appId   = appId;
        FB.cookie  = cookie;
        FB.logging = logging;
        FB.status  = status;
        FB.xfbml   = xfbml;
        FB.frictionlessRequests = frictionlessRequests;
        FB.authResponse         = authResponse;
        FB.OnInitComplete       = onInitComplete;
        FB.OnHideUnity          = onHideUnity;

        if (!isInitCalled)
        {
            FbDebug.Info(String.Format("Using SDK {0}, Build {1}", FBBuildVersionAttribute.SDKVersion, FBBuildVersionAttribute.GetBuildVersionOfType(typeof(IFacebook))));

#if UNITY_EDITOR
            FBComponentFactory.GetComponent <EditorFacebookLoader>();
#elif UNITY_WEBPLAYER
            FBComponentFactory.GetComponent <CanvasFacebookLoader>();
#elif UNITY_IOS
            FBComponentFactory.GetComponent <IOSFacebookLoader>();
#elif UNITY_ANDROID
            FBComponentFactory.GetComponent <AndroidFacebookLoader>();
#else
            throw new NotImplementedException("Facebook API does not yet support this platform");
#endif
            isInitCalled = true;
            return;
        }

        FbDebug.Warn("FB.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 (FacebookImpl != null)
        {
            OnDllLoaded();
        }
    }