コード例 #1
0
    private static void OnDllLoaded()
    {
        var versionInfo = FBBuildVersionAttribute.GetVersionAttributeOfType(FacebookImpl.GetType());

        if (versionInfo == null)
        {
            FbDebug.Warn("Finished loading Facebook dll, but could not find version info");
        }
        else
        {
            FbDebug.Log(string.Format("Finished loading Facebook dll. Version {0} Build {1}", versionInfo.SdkVersion, versionInfo.BuildVersion));
        }
        FacebookImpl.Init(
            OnInitComplete,
            appId,
            cookie,
            logging,
            status,
            xfbml,
            FBSettings.ChannelUrl,
            authResponse,
            frictionlessRequests,
            OnHideUnity
            );
    }
コード例 #2
0
 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;
     OnInitComplete          = onInitComplete;
     OnHideUnity             = onHideUnity;
     if (!isInitCalled)
     {
         FBBuildVersionAttribute versionAttributeOfType = FBBuildVersionAttribute.GetVersionAttributeOfType(typeof(IFacebook));
         if (versionAttributeOfType == null)
         {
             FbDebugOverride.Warn("Cannot find Facebook SDK Version");
         }
         else
         {
             FbDebugOverride.Info(string.Format("Using SDK {0}, Build {1}", versionAttributeOfType.SdkVersion, versionAttributeOfType.BuildVersion));
         }
         throw new NotImplementedException("Facebook API does not yet support this platform");
     }
     FbDebugOverride.Warn("FB.Init() has already been called.  You only need to call this once and only once.");
     if (FacebookImpl != null)
     {
         OnDllLoaded();
     }
 }
コード例 #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)
        {
            var versionInfo = FBBuildVersionAttribute.GetVersionAttributeOfType(typeof(IFacebook));

            if (versionInfo == null)
            {
                FbDebug.Warn("Cannot find Facebook SDK Version");
            }
            else
            {
                FbDebug.Info(String.Format("Using SDK {0}, Build {1}", versionInfo.SdkVersion, versionInfo.BuildVersion));
            }

#if UNITY_EDITOR
            FBComponentFactory.GetComponent <EditorFacebookLoader>();
#elif UNITY_WEBPLAYER
            FBComponentFactory.GetComponent <CanvasFacebookLoader>();
#elif UNITY_IOS
            FBComponentFactory.GetComponent <IOSFacebookLoader>();
#elif UNITY_ANDROID
            FBComponentFactory.GetComponent <AndroidFacebookLoader>();
#elif UNITY_WP8
            FBComponentFactory.GetComponent <WindowsPhoneFacebookLoader>();
#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();
        }
    }
コード例 #4
0
    private void AboutGUI()
    {
        var versionAttribute = FBBuildVersionAttribute.GetVersionAttributeOfType(typeof(IFacebook));

        EditorGUILayout.HelpBox("About the Facebook SDK", MessageType.None);
        SelectableLabelField(sdkVersion, versionAttribute.Version);
        SelectableLabelField(buildVersion, versionAttribute.ToString());
        EditorGUILayout.Space();
    }
コード例 #5
0
    private static void OnDllLoaded()
    {
        FBBuildVersionAttribute versionAttributeOfType = FBBuildVersionAttribute.GetVersionAttributeOfType(FacebookImpl.GetType());

        if (versionAttributeOfType != null)
        {
            FbDebugOverride.Log(string.Format("Finished loading Facebook dll. Version {0} Build {1}", versionAttributeOfType.SdkVersion, versionAttributeOfType.BuildVersion));
        }
        FacebookImpl.Init(OnInitComplete, appId, cookie, logging, status, xfbml, FBSettings.ChannelUrl, authResponse, frictionlessRequests, OnHideUnity);
    }
コード例 #6
0
    private void AboutGUI()
    {
        var versionInfo = FBBuildVersionAttribute.GetVersionAttributeOfType(typeof(IFacebook));

        if (versionInfo == null)
        {
            EditorGUILayout.HelpBox("Cannot find version info on the Facebook SDK!", MessageType.Warning);
        }
        else
        {
            EditorGUILayout.HelpBox("About the Facebook SDK", MessageType.None);
            SelectableLabelField(sdkVersion, versionInfo.SdkVersion);
            SelectableLabelField(buildVersion, versionInfo.BuildVersion);
        }
        EditorGUILayout.Space();
    }
コード例 #7
0
ファイル: FB.cs プロジェクト: SteveMobile422/socker
 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
         );
 }
コード例 #8
0
ファイル: FB.cs プロジェクト: SteveMobile422/socker
    /**
     * 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();
        }
    }