Beispiel #1
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.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
            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();
        }
    }
Beispiel #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.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
            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();
        }
    }