private void InitCallback()
    {
        if (FB.IsInitialized)
        {
            // Signal an app activation App Event
            FB.ActivateApp();
            // Continue with Facebook SDK
            // ...

            var perms = new List <string>()
            {
                "public_profile", "email", "user_friends"
            };
            FB.LogInWithReadPermissions(perms, AuthCallback);
        }
        else
        {
            Debug.Log("Failed to Initialize the Facebook SDK");
        }
    }
Пример #2
0
 void OnApplicationPause(bool pauseStatus)
 {
     // Check the pauseStatus to see if we are in the foreground
     // or background
     if (!pauseStatus)
     {
         //app resume
         if (FB.IsInitialized)
         {
             FB.ActivateApp();
         }
         else
         {
             //Handle FB.Init
             FB.Init(() => {
                 FB.ActivateApp();
             });
         }
     }
 }
Пример #3
0
    /// Called when the FBInit call has completed
    /// either successfully or not. Determines if
    /// we have an existing FB/ChilliConnect login or not
    ///
    private void OnFBInitComplete()
    {
        if (FB.IsInitialized == true)
        {
            Debug.Log("FB initialised");

            FB.ActivateApp();

            //Check if we have an existing FB session and if so attempt to login to Chilli using it
            if (FB.IsLoggedIn == true)
            {
                Debug.Log("FB session already exists");

                //This is the access token required to login to ChilliConnect via FB.
                m_fbAccessToken = Facebook.Unity.AccessToken.CurrentAccessToken.TokenString;
                ChilliConnectFBLogin(m_fbAccessToken);
            }
            else
            {
                Debug.Log("No FB session already exists");

                //Check if we have a stored anonymous ChilliConnect token to login with
                if (PlayerPrefs.HasKey("CCId") == true && PlayerPrefs.HasKey("CCSecret") == true)
                {
                    Debug.Log("ChilliConnect account already exists. Logging in");
                    m_chilliConnect.PlayerAccounts.LogInUsingChilliConnect(PlayerPrefs.GetString("CCId"), PlayerPrefs.GetString("CCSecret"), (loginRequest) => OnChilliConnectAnonLoggedIn(), (loginRequest, error) => Debug.LogError(error.ErrorDescription));
                }
                else
                {
                    Debug.Log("No ChilliConnect account exists. Creating one");
                    //Create a new ChilliConnect account
                    var requestDesc = new CreatePlayerRequestDesc();
                    m_chilliConnect.PlayerAccounts.CreatePlayer(requestDesc, (request, response) => OnChilliConnectAccountCreated(response), (request, createError) => Debug.LogError(createError.ErrorDescription));
                }
            }
        }
        else
        {
            Debug.LogError("Failed to initialise FB SDK");
        }
    }
Пример #4
0
 public void Init(System.Action onComplate)
 {
     _token = null;
     if (!FB.IsInitialized)
     {
         FB.Init(() => {
             if (Facebook.Unity.AccessToken.CurrentAccessToken != null)
             {
                 UnityEngine.Debug.Log("facebook登录成功 token:" + Facebook.Unity.AccessToken.CurrentAccessToken.ToString());
             }
             onComplate();
         }, (isGameShown) => {
             UnityEngine.Debug.Log("pause");
         });
     }
     else
     {
         FB.ActivateApp();
         onComplate();
     }
 }
Пример #5
0
    private void InitCallback()
    {
        if (FB.IsInitialized)
        {
            FB.ActivateApp();

            FB.Mobile.SetAutoLogAppEventsEnabled(true);
            LogIAmWorkingEvent(true);

            /*var perms = new List<string>(){"public_profile", "email"};
             * FB.LogInWithReadPermissions(perms, AuthCallback);*/

            tt.text += "dasf";

            FB.Mobile.FetchDeferredAppLinkData(DeepLinkCallback);
        }
        else
        {
            Debug.Log("Failed to Initialize the Facebook SDK");
        }
    }
        private void OnInitComplete()
        {
            string logMessage = string.Format(
                "[FacebookProvider] OnInitCompleteCalled IsLoggedIn='{0}' IsInitialized='{1}'",
                FB.IsLoggedIn,
                FB.IsInitialized);

            Debug.Log(logMessage);
            if (AccessToken.CurrentAccessToken != null)
            {
                Debug.Log(string.Format("[FacebookProvider] Access token: {0}", AccessToken.CurrentAccessToken.ToString()));
            }
            if (FB.IsInitialized)
            {
                FB.ActivateApp();
            }
            else
            {
                Debug.LogWarning("[FacebookProvider] FB failed to initialize.");
            }
        }
Пример #7
0
    private void OnInitComplete()
    {
        if (FB.IsInitialized)
        {
            debugText.text += "\n isInit " + FB.IsInitialized;
            FB.ActivateApp();
        }

        Debug.Log("FB.Init completed: Is user logged in? " + FB.IsLoggedIn);
        debugText.text += "\n LoggedIn " + FB.IsLoggedIn;
        if (FB.IsLoggedIn)
        {
            UIManager.instance.loginPanel.SetActive(false);
            var token = Facebook.Unity.AccessToken.CurrentAccessToken;
            userId = token.UserId.ToString();
            ConnectionManager.Instance.myID = userId;
            debugText.text += "\n" + userId;
            ConnectionManager.Instance.MakeConnection();
            UIManager.instance.loading.SetActive(true);
        }
    }
Пример #8
0
    private void Awake()
    {
        /* Google Initializations */
        configuration = new GoogleSignInConfiguration {
            WebClientId = webClientId, RequestEmail = true, RequestIdToken = true
        };
        CheckFirebaseDependencies();        // Don't add this when you are running the game in the editor
        /* Facebook Initializations */
        if (!(FB.IsInitialized))
        {
            // Initiliaze the facebook sdk
            FB.Init(InitCallback, OnHideUnity);
        }
        else
        {
            // Already initialized, signal an app activation event
            FB.ActivateApp();
        }

        Debug.Log(FB.Android.KeyHash);
    }
Пример #9
0
 public override void OnApplicationPause(bool paused)
 {
     if (this.isActive == true)
     {
                         #if FACEBOOK_ANALYTICS_API
         if (paused == false)
         {
             if (FB.IsInitialized == true)
             {
                 FB.ActivateApp();
             }
             else
             {
                 FB.Init(() => {
                     FB.ActivateApp();
                 });
             }
         }
                         #endif
     }
 }
    void Start()
    {
        if (!FB.IsInitialized)
        {
            FB.Init(FBInitCompletion);
        }
        else
        {
            FB.ActivateApp();
        }

        infoPanel.SetActive(false);
        newRecord.gameObject.SetActive(false);

        loadRecords();
        displayRecord();
        displayMedalAndComment();
        updateHighScore();
        updateTime();
        configureBackgroundMusic();
    }
Пример #11
0
    void Awake()
    {
        if (Instance != null)
        {
            return;
        }
        Instance = this;

        if (FB.IsInitialized)
        {
            FB.ActivateApp();
        }
        else
        {
            //Handle FB.Init
            FB.Init(() =>
            {
                FB.ActivateApp();
            });
        }
    }
    public void LoginFacebook()
    {
        FB.Init(delegate {
            // FB.ActivateApp()함수로 페이스북 SDK를 통해 유저가 얼마나 접속하는지 로깅합니다. 페이스북 관리자 페이지에서 유저의 접속 빈도를 확인할 수 있습니다.
            FB.ActivateApp();

            // 페이스북 SDK로 로그인을 수행합니다.
            // 유니티 에디터에서는 Access Token을 받아오는 팝업이 뜨지만
            // 모바일에서는 잘 연동됩니다.
            UserSingleton.Instance.FacebookLogin(delegate(bool isSuccess, string response){
                if (isSuccess)
                {
                    StartCoroutine(LoadDataFromFacebook());
                }
                else
                {
                    Debug.Log("Facebook login fail!!");
                }
            });
        }, OnHideUnity, "");
    }
Пример #13
0
    // Awake function from Unity's MonoBehavior

    void Awake()
    {
        Debug.Log("Kauel: Awake Started");

        if (!FB.IsInitialized)
        {
            // Initialize the Facebook SDK

            Debug.Log("Kauel: Calling Init");

            FB.Init(InitCallback, OnHideUnity);
        }
        else
        {
            // Already initialized, signal an app activation App Event

            Debug.Log("Kauel: ActivateApp");

            FB.ActivateApp();
        }
    }
Пример #14
0
 void OnApplicationPause(bool pauseStatus)
 {
     // Check the pauseStatus to see if we are in the foreground
     // or background
     if (!pauseStatus && allowPauseFb)
     {
         Debug.Log("activate in puase");
         //app resume
         if (FB.IsInitialized)
         {
             FB.ActivateApp();
         }
         else
         {
             //Handle FB.Init
             FB.Init(OnInitComplete, OnHideUnity => {
                 FB.ActivateApp();
             });
         }
     }
 }
Пример #15
0
    private void InitCallback()
    {
        if (FB.IsInitialized)
        {
            FB.ActivateApp();
        }
        else
        {
            Debug.Log("Failed to Initialize the Facebook SDK");
        }

        if (FB.IsLoggedIn)
        {
            FB.API("/me?fields=name", HttpMethod.GET, DispName);
            FB.API("me/picture?type=square&height=30&width=30", HttpMethod.GET, GetPicture);
        }
        else
        {
            Debug.Log("Please login to continue");
        }
    }
Пример #16
0
    // Awake function from Unity's MonoBehavior
    void Awake()
    {
        // If the GoatStrikeInviteFriendStatus already exists, read it
        if (PlayerPrefs.HasKey("GoatStrikeInviteFriendStatus"))
        {
            userInviteFriendStatus = PlayerPrefs.GetInt("GoatStrikeInviteFriendStatus");
        }
        // Assign the userInviteFriendStatus to GoatStrikeInviteFriendStatus
        PlayerPrefs.SetInt("GoatStrikeInviteFriendStatus", userInviteFriendStatus);

        if (!FB.IsInitialized)
        {
            // Initialize the Facebook SDK
            FB.Init(InitCallback, OnHideUnity);
        }
        else
        {
            // Already initialized, signal an app activation App Event
            FB.ActivateApp();
        }
    }
Пример #17
0
        //---------------------------------------------------------------------
        // Messages
        //---------------------------------------------------------------------

        private void Awake()
        {
            ConfigureGoogleSignIn();
            _auth = FirebaseAuth.DefaultInstance;

            if (!FB.IsInitialized)
            {
                FB.Init();
            }
            else
            {
                FB.ActivateApp();
            }

            if (_auth.CurrentUser != null && GetSocial.User.IsAnonymous)
            {
                GetSocialSignIn();
            }

            SetGetSocialNameAndAvatar();
        }
    void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        else if (_instance != this)
        {
            Destroy(this.gameObject);
        }

        if (FB.IsInitialized)
        {
            FB.ActivateApp();
        }
        else
        {
            FB.Init(() => { FB.ActivateApp(); });
        }

        DontDestroyOnLoad(this.gameObject);
    }
Пример #19
0
 void Awake()
 {
     if (instance)
     {
         GameObject.Destroy(this);
     }
     else
     {
         instance = this;
     }
     _blink = GetComponent <PB_Blink>();
     if (!FB.IsInitialized)
     {
         // Initialize the Facebook SDK
         FB.Init(InitCallback, OnHideUnity);
     }
     else
     {
         // Already initialized, signal an app activation App Event
         FB.ActivateApp();
     }
 }
Пример #20
0
    public void Init()
    {
        FB.Init(() =>
        {
            Debug.Log("FB Init success");
            FB.Mobile.SetAutoLogAppEventsEnabled(true);
            FB.ActivateApp();
        });

        if (FB.IsInitialized)
        {
            FB.ActivateApp();
        }
        else
        {
            FB.Init(() =>
            {
                FB.Mobile.SetAutoLogAppEventsEnabled(true);
                FB.ActivateApp();
            });
        }
    }
Пример #21
0
    public void FBInit()
    {
        if (!FB.IsInitialized)
        {
            FB.Init(() => {
                if (FB.IsInitialized)
                {
                    FB.ActivateApp();
                }
                else
                {
                    Debug.Log("Couldn't initialize fb!");
                }
            }, isGameShown => {
                if (!isGameShown)
                {
                    Time.timeScale = 0;
                }
                else
                {
                    Time.timeScale = 1;
                }
            });
        }
        else
        {
            FB.ActivateApp();
        }

        if (FB.IsLoggedIn)
        {
            IsLoggedIn = true;
        }

        if (FB.IsLoggedIn && ProfilePic == null)
        {
            GetProfile();
        }
    }
Пример #22
0
    private void InitCallback()
    {
        if (FB.IsInitialized)
        {
            // Signal an app activation App Event
            FB.ActivateApp();
            Debug.Log("Inside Init callback");

            FB.ShareLink(
                new Uri("https://developers.facebook.com/"),
                "Link Share",
                "Look I scored " + GameModel.Instance.Score + "in Line Stop",
                new Uri("http://i.imgur.com/j4M7vCO.jpg"),
                callback: ShareCallback);
            // Continue with Facebook SDK
            // ...
        }
        else
        {
            Debug.Log("Failed to Initialize the Facebook SDK");
        }
    }
 private void InitCallback()
 {
     if (FB.IsInitialized)
     {
         FB.ActivateApp();
     }
     else
     {
         textStatus.text = "failed to initialize the Facebook SDK";
     }
     if (FB.IsLoggedIn)
     {
         FB.API("/me?fields=name", HttpMethod.GET, DispName);
         FB.API("me/picture?type=square&height=128&width=128", HttpMethod.GET, GetPicture);
         fbLogin.SetActive(false); fbLogout.SetActive(true);
     }
     else
     {
         textStatus.text = "Please Login to continue";
         fbLogin.SetActive(true); fbLogout.SetActive(false);
     }
 }
Пример #24
0
 private void InitCallback()
 {
     if (FB.IsInitialized)
     {
         FB.ActivateApp();
         if (FB.IsLoggedIn)
         {
             _class.CallStatic("start", gameObject.name);
             instance.Call("GetFlow");
         }
         else
         {
             LogInSprites.transform.GetChild(1).gameObject.SetActive(true);
             LogInSprites.transform.GetChild(2).gameObject.SetActive(true);
             LogInSprites.transform.GetChild(3).gameObject.SetActive(true);
         }
     }
     else
     {
         Debug.Log("Failed to Initialize the Facebook SDK");
     }
 }
Пример #25
0
    long nextFBShareTimeAllow; //time after which the player would be allowed to share the game on fb

    void Awake()
    {
        if (instance)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }
        if (!FB.IsInitialized)
        {
            // Initialize the Facebook SDK
            FB.Init(InitCallback);
        }
        else
        {
            // Already initialized, signal an app activation App Event
            FB.ActivateApp();
        }
        nextFBShareTimeAllow = long.Parse(PlayerPrefs.GetString("nextFBShareTime", "0"));
    }
Пример #26
0
 // Awake function from Unity's MonoBehavior
 void Awake()
 {
     if (!FB.IsInitialized)
     {
         // Initialize the Facebook SDK
         FB.Init(InitCallback, OnHideUnity);
     }
     else
     {
         // Already initialized, signal an app activation App Event
         FB.ActivateApp();
     }
     if (FB.IsLoggedIn)
     {
         FB.API("me/picture?type=square&height=80&width=80", HttpMethod.GET, GetPicture);
         btnL.SetActive(false);
     }
     else
     {
         btnL.SetActive(true);
     }
 }
Пример #27
0
 private void Awake()
 {
     // Si FB no esta inicializado
     if (!FB.IsInitialized)
     {
         // Lo inicializo
         FB.Init(() =>
         {   // Si ya esta inicializado
             if (FB.IsInitialized)
             {
                 // Lo activo
                 FB.ActivateApp();
             }
             else
             {
                 // No se puede inicializar FB
                 Debug.LogError("Couldn't initialize");
             }
         },
                 // El juego es mostrado ?
                 isGameShown =>
         {
             // Si el juego es mostrado
             if (!isGameShown)
             {
                 Time.timeScale = 0;// Congelamos el juego
             }
             else
             {
                 Time.timeScale = 1;// No congelamos el juego
             }
         });
     }
     else
     {
         // Activamos FB
         FB.ActivateApp();
     }
 }
Пример #28
0
        public override System.Collections.Generic.IEnumerator <byte> Auth(string key, ServiceItem serviceItem)
        {
                        #if FACEBOOK_ANALYTICS_API
            System.Action onInited = () => {
                var rootScreenId = FlowSystem.GetRootWindow();
                var eventName    = "Application Start";
                FB.LogAppEvent(eventName, 1f, new Dictionary <string, object>()
                {
                    { "Root Screen", rootScreenId },
                    { "Platform", Application.platform.ToString() }
                });

                Debug.LogWarning("Facebook Analytics Application Start");
            };

            if (FB.IsInitialized == true)
            {
                FB.ActivateApp();
                onInited.Invoke();
            }
            else
            {
                FB.Init(() => {
                    if (FB.IsInitialized == true)
                    {
                        FB.ActivateApp();
                        onInited.Invoke();
                    }
                    else
                    {
                        Debug.LogError("Failed to Initialize the Facebook SDK");
                    }
                });
            }
                        #endif

            yield return(0);
        }
Пример #29
0
    private void Start()
    {
        Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
            var dependencyStatus = task.Result;
            if (dependencyStatus == Firebase.DependencyStatus.Available)
            {
                Debug.Log("Firebase.DependencyStatus.Available");
                // Create and hold a reference to your FirebaseApp,
                // where app is a Firebase.FirebaseApp property of your application class.
                //app = Firebase.FirebaseApp.DefaultInstance;

                // Set a flag here to indicate whether Firebase is ready to use by your app.

                // 초기화
                auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

                // 유저의 로그인 정보에 어떠한 변경점이 생기면 실행되게 이벤트를 걸어준다.
                auth.StateChanged += AuthStateChanged;
                //AuthStateChanged(this, null);
            }
            else
            {
                UnityEngine.Debug.LogError(System.String.Format(
                                               "Could not resolve all Firebase dependencies: {0}", dependencyStatus));
                // Firebase Unity SDK is not safe to use here.
            }
        });


        if (!FB.IsInitialized)
        {
            FB.Init(InitCallback_Facebook, OnHideUnity);
        }
        else
        {
            FB.ActivateApp();
        }
    }
Пример #30
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        if (!FB.IsInitialized)
        {
            FB.Init(() =>
            {
                if (FB.IsInitialized)
                {
                    FB.ActivateApp();
                }
                else
                {
                    Debug.LogError("Couldn't initialize");
                }
            },
                    isGameShown =>
            {
                if (!isGameShown)
                {
                    Time.timeScale = 0;
                }
                else
                {
                    Time.timeScale = 1;
                }
            });
        }

        else
        {
            FB.ActivateApp();
        }
    }