コード例 #1
0
ファイル: Core.cs プロジェクト: YanivP/FriendBubbles
	// Called when logged in to Facebook
	private void OnFBLoggedIn(FBResult p_result)
	{
//		Debug.Log(p_result.Text);
		if(string.IsNullOrEmpty(p_result.Error) && FB.IsLoggedIn)
		{
			this.fbLoginButton.SetActive(false);

			JToken resultJToken = JsonTools.ConvertStringToJToken(p_result.Text);
			if(resultJToken != null)
			{
				this.fbToken = (string)resultJToken["access_token"];
				LeanTween.alpha(
					this.goodFacebookLogo.gameObject,
					1f,
					1f)
					.setEase(LeanTweenType.easeInOutSine);

				BubbleGraph.Create((string)resultJToken["user_id"]);
			}
			else
			{
				Debug.LogError("Problem reading Facebook login result JSON");
			}
		}
		else
		{
			LeanTween.alpha(
				this.goodFacebookLogo.gameObject,
				1f,
				0.2f)
				.setEase(LeanTweenType.easeInOutSine)
				.setLoopPingPong(1);
		}
	}
コード例 #2
0
    private void FBAPICallback(FBResult result)
    {
        if (!String.IsNullOrEmpty(result.Error)) {
            Debug.Log ("FBAPICallback: Error getting user info: + "+ result.Error);
            // Log the user out, the error could be due to an OAuth exception
            ParseFBLogout();
        } else {
            // Got user profile info
            var resultObject = Json.Deserialize(result.Text) as Dictionary<string, object>;
            var userProfile = new Dictionary<string, string>();

            userProfile["facebookId"] = getDataValueForKey(resultObject, "id");
            userProfile["name"] = getDataValueForKey(resultObject, "name");
            object location;
            if (resultObject.TryGetValue("location", out location)) {
                userProfile["location"] = (string)(((Dictionary<string, object>)location)["name"]);
            }
            userProfile["gender"] = getDataValueForKey(resultObject, "gender");
            userProfile["birthday"] = getDataValueForKey(resultObject, "birthday");
            userProfile["relationship"] = getDataValueForKey(resultObject, "relationship_status");
            if (userProfile["facebookId"] != "") {
                userProfile["pictureURL"] = "https://graph.facebook.com/" + userProfile["facebookId"] + "/picture?type=large&return_ssl_resources=1";
            }

            var emptyValueKeys = userProfile
                .Where(pair => String.IsNullOrEmpty(pair.Value))
                    .Select(pair => pair.Key).ToList();
            foreach (var key in emptyValueKeys) {
                userProfile.Remove(key);
            }

            StartCoroutine("saveUserProfile", userProfile);
        }
    }
コード例 #3
0
    private void FBAPICallback(FBResult result)
    {
        if (!String.IsNullOrEmpty(result.Error)) {
            // Handle error
        } else {
            // Got user profile info
            var resultObject = Json.Deserialize(result.Text) as Dictionary<string, object>;
            var userProfile = new Dictionary<string, string>();

            userProfile["facebookId"] = getDataValueForKey(resultObject, "id");
            userProfile["name"] = getDataValueForKey(resultObject, "name");
            object location;
            if (resultObject.TryGetValue("location", out location)) {
                userProfile["location"] = (string)(((Dictionary<string, object>)location)["name"]);
            }
            userProfile["locale"] = getDataValueForKey(resultObject, "locale");
            userProfile["gender"] = getDataValueForKey(resultObject, "gender");
            //userProfile["birthday"] = getDataValueForKey(resultObject, "birthday");
            //userProfile["relationship"] = getDataValueForKey(resultObject, "relationship_status");
            if (userProfile["facebookId"] != "") {
                userProfile["pictureURL"] =
                    "https://graph.facebook.com/" + userProfile["facebookId"] + "/picture?type=large&width=128&height=128&return_ssl_resources=1";
            }
            //userProfile["score"] = "555555";
            StartCoroutine("saveUserData", userProfile);
        }
    }
コード例 #4
0
    void InvitedCallback(FBResult result)
    {
        Debug.Log (result.Text);
        //Screen.orientation = ScreenOrientation.LandscapeLeft;
        if(result.Error != null)
        {
            //Debug.LogError("OnActionShared: Error: " + result.Error);
        }

        if (result == null || result.Error != null)
        {
            //Do something request failed

        }
        else
        {
            var responseObject = Facebook.MiniJSON.Json.Deserialize(result.Text) as System.Collections.Generic.Dictionary<string, object>;
            object obj = 0;
            if (responseObject == null || responseObject.Count <= 0 || responseObject.TryGetValue("cancelled", out obj))
            {
                //Debug.LogWarning("Request cancelled");
                //Do something when user cancelled
            }
            else if (responseObject.TryGetValue("id", out obj) || responseObject.TryGetValue("post_id", out obj))
            {
                //Debug.LogWarning("Request Send");
                //Do something it is succeeded
            }
        }
    }
コード例 #5
0
    // FB.api callback for friends
    void Callback2(FBResult result)
    {
        Debug.Log (result.Text);

        IDictionary data = (IDictionary) Json.Deserialize(result.Text);

        IList friends = (IList) data["data"];

        string name;
        string id;

        foreach (IDictionary friend in friends) {

            name = (string)friend["name"];
            id = (string)friend["id"];
            url = (string)((IDictionary)((IDictionary)friend["picture"])["data"])["url"];

            StartCoroutine(getTextureByURL());

            // fetch only one row
            break;
        }

        Debug.Log ("Finished API call.");
    }
コード例 #6
0
	void OnFacebookLogin(FBResult result)
	{
		if (FB.IsLoggedIn) 
		{
			// It worked
			Debug.Log("Facebook auth success");

			// Now we login using Braincloud
			BrainCloudWrapper.GetBC().AuthenticationService.AuthenticateFacebook(
				FB.UserId, 
				FB.AccessToken, 
				true, 
				OnBraincloudAuthenticateFacebookSuccess, 
				OnBraincloudAuthenticateFacebookFailed);

			// Meanwhile, we will fetch info about our player, to get the profile pic and name
			FB.API("/me?fields=name,picture", Facebook.HttpMethod.GET, OnFacebookMe);
		}
		else
		{
			// It failed
			Debug.LogError("Facebook auth failed");
			m_isConnecting = false;
			spinner.gameObject.SetActive(false); // Hide spinner
		}
	}
コード例 #7
0
ファイル: FacebookLogin.cs プロジェクト: jieverson/PixelRoad
 void LoginCallback(FBResult result)
 {
     if (FB.IsLoggedIn)
     {
         PostScore(PlayerPrefs.GetInt("Last Score"));
     }
 }
コード例 #8
0
 //Check Login
 void LoginCallback(FBResult result)
 {
     if (!FB.IsLoggedIn)
     {
         gamestate.isfacebookclick = false;
         //FB.Login ("public_profile,email,user_friends", LoginCallback);
         //Screen.orientation = ScreenOrientation.LandscapeRight;
         //gamestate.stategame = GameState.StateGame.Reborn;
     }
     else
     {
         //gamestate.stategame = GameState.StateGame.Reborn;
         showNotification();
         StartCoroutine("ParseLogin");
         //Screen.orientation = ScreenOrientation.LandscapeRight;
         /*FB.Feed(
             link: "http://s1.anh.im/2015/05/01/icon17e07.png",
             linkName: "Test thôi mà",
             linkCaption: "Test tí cho vui",
             linkDescription: "Test nào",
             picture: "http://s1.anh.im/2015/05/01/icon17e07.png",
             callback :SharedCallback
             );*/
     }
 }
コード例 #9
0
ファイル: Facebookinit.cs プロジェクト: keang/gimmieunity
 void LoginCallback(FBResult result)
 {
     Debug.Log ("logged in!" + FB.UserId);//use this to sync progress etc
     Debug.Log("login result: " + result.Text);
     FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, APICallback);
     FB.API(Util.GetPictureURL("me", 128, 128), Facebook.HttpMethod.GET, MyPictureCallback);
 }
コード例 #10
0
    void GetProfileCallback(FBResult result)
    {
        if(result.Error != null)
        {
            if (attemptsToLoadProfile < 3)
            {
                //retry the request if an error has occured, probably need to check how many times this fails.
                GetProfile();
                attemptsToLoadProfile++;
            }
            else
            {
                Debug.Log("Failed to GetProfile: " + result.Text);
            }
        }
        else
        {
            try
            {
                var pure = result.Text;

                ProfileData = Util.DeserializeJSONProfile(result.Text);
                var friends = Util.DeserializeJSONFriends(result.Text);

                //Use the Console tab in the Editor to view this data without using breakpoints
                Debug.Log(GetValueFromPofile("first_name") + " " + GetValueFromPofile("last_name"));

            }
            catch(Exception ex)
            {
                //exceptions are never filled with any data when this fails?
                Debug.Log(ex.Message);
            }
        }
    }
コード例 #11
0
	private void OnFBAuth(FBResult result) {

		SPFacebook.Instance.OnAuthCompleteAction -= OnFBAuth;


		if(SPFacebook.Instance.IsLoggedIn) {

			SPFacebook.Instance.OnPostingCompleteAction += HandleOnPostingCompleteAction;
			SPFacebook.instance.Post(_toId,
			                         _link,
			                         _linkName,
			                         _linkCaption,
			                         _linkDescription,
			                         _picture,
			                         _actionName,
			                         _actionLink,
			                         _reference);

		} else {
			FBResult res =  new FBResult("", "Auth failed");
			FBPostResult postResult =  new FBPostResult(res);

			ActionComplete(postResult);
		}



	}
コード例 #12
0
ファイル: FBGet.cs プロジェクト: alusor/TecnoRacing
    private void APICallback(FBResult result)
    {
        
        textoui.text = result.Text;

        Debug.Log(FB.UserId);
    }
コード例 #13
0
ファイル: FB.cs プロジェクト: JeffreyKimani/unityplugins
 public static void API(
     string endpoint,
     HttpMethod method,
     FacebookDelegate callback)
 {
     if (method != HttpMethod.GET) throw new NotImplementedException();
     Task.Run(async () =>
     {
         FacebookClient fb = new FacebookClient(_fbSessionClient.CurrentAccessTokenData.AccessToken);
         FBResult fbResult = null;
         try
         {
             var apiCall = await fb.GetTaskAsync(endpoint, null);
             if (apiCall != null)
             {
                 fbResult = new FBResult();
                 fbResult.Text = apiCall.ToString();
                 fbResult.Json = apiCall as JsonObject;
             }
         }
         catch (Exception ex)
         {
             fbResult = new FBResult();
             fbResult.Error = ex.Message;
         }
         if (callback != null)
         {
             Utils.RunOnUnityAppThread(() => { callback(fbResult); });
         }
     });
 }
コード例 #14
0
ファイル: BtnSocial.cs プロジェクト: coderlazy/kloserbsb
	void FBLoginCallback(FBResult result) {                                                                                          
		FbDebug.Log("LoginCallback");                                                          
		if (FB.IsLoggedIn) {                                                                                      
			Debug.LogWarning("Logged in. ID: " + FB.UserId);
			StartCoroutine(FBTakeScreenshot());
		}                                                                                      
	}
コード例 #15
0
ファイル: MenuBase.cs プロジェクト: dth138/friendsmash-unity
 protected void handleResult(FBResult result)
 {
     lastResponseTexture = null;
     // Some platforms return the empty string instead of null.
     if (!String.IsNullOrEmpty(result.Error))
     {
         status = "Error - Check log for details";
         lastResponse = "Error Response:\n" + result.Error;
         LogView.AddLog(result.Error);
     } else if (!String.IsNullOrEmpty(result.Text))
     {
         status = "Success - Check log for details";
         lastResponse = "Success Response:\n" + result.Text;
         LogView.AddLog(result.Text);
     } else if (result.Texture != null)
     {
         status = "Success - Check log for details";
         lastResponseTexture = result.Texture;
         lastResponse = "Success Response: texture\n";
         LogView.AddLog("Success - Failed to display details since response was a texture");
     } else
     {
         lastResponse = "Empty Response\n";
         LogView.AddLog(lastResponse);
     }
 }
コード例 #16
0
ファイル: FBPostingTask.cs プロジェクト: rocketreal/Blame
    private void OnFBAuthFailed()
    {
        SPFacebook.instance.removeEventListener(FacebookEvents.AUTHENTICATION_FAILED,  	 	OnFBAuthFailed);
        SPFacebook.instance.removeEventListener(FacebookEvents.AUTHENTICATION_SUCCEEDED,  	OnFBAuth);

        FBResult res =  new FBResult("", "Auth failed");
        dispatch(BaseEvent.COMPLETE, res);
    }
コード例 #17
0
 void LoginCallback(FBResult result)
 {
     FbDebug.Log("call login: "******"login result: " + result.Text);
     FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, APICallback);
     FB.API(Util.GetPictureURL("me", 128, 128), Facebook.HttpMethod.GET, MyPictureCallback);
     FB.API("/app/scores?fields=score,user.limit(20)", Facebook.HttpMethod.GET, ScoresCallback);
 }
コード例 #18
0
 void LoginCallback(FBResult result)
 {
     FbDebug.Log("call login: "******"login result: " + result.Text);
     FB.API("/me?fields=id,first_name,friends.limit(100).fields(first_name,id)", Facebook.HttpMethod.GET, APICallback);
     FB.API(Util.GetPictureURL("me", 128, 128), Facebook.HttpMethod.GET, MyPictureCallback);
     FB.API("/app/scores?fields=score,user.limit(20)", Facebook.HttpMethod.GET, ScoresCallback);
 }
コード例 #19
0
 bool WasAppPermissionRemovedByUser(
     FBResult Result
     )
 {
     return((Result != null) &&
            (!Result.Succeeded) &&
            (Result.ErrorInfo.Code == (int)Facebook.ErrorCode.ErrorCodeOauthException));
 }
コード例 #20
0
ファイル: GUIFB.cs プロジェクト: MizzKii/PuruDash2D
	void LoginCallback(FBResult result)
	{
		if (result.Error != null)
			Debug.LogError("Error Response:\n" + result.Error);
		else if (!FB.IsLoggedIn) {
			Debug.Log("Login cancelled by Player");
		}
	}
コード例 #21
0
    private void OnPost(CEvent e)
    {
        FBResult res = e.data as FBResult;

        Debug.Log(res.Text);

        statusMessage = "Posting complete";
    }
コード例 #22
0
ファイル: FBUtil.cs プロジェクト: JochemKlingeler/WordUp
 //If failed to GET picture, Show result in console
 public static void FriendPictureCallback(FBResult result)
 {
     if (result.Error != null)
     {
         Debug.LogError(result.Error);
         return;
     }
 }
コード例 #23
0
ファイル: MainMenu.cs プロジェクト: junian/Octosky
 void LoginCallback(FBResult result)
 {
     FbDebug.Log("Login callback");
     if(FB.IsLoggedIn)
     {
         OnFBLoggedIn();
     }
 }
コード例 #24
0
ファイル: Lobby.cs プロジェクト: ronforbes/BlockParty1
    void OnGetMe(FBResult result)
    {
        var dictionary = Json.Deserialize(result.Text) as Dictionary<string, object>;
        PersonalName.text = dictionary["name"] as string;
        string facebookId = dictionary["id"] as string;

        StartCoroutine("GetProfilePicture", facebookId);
    }
コード例 #25
0
    /// <summary>
    /// Callback used when user's profile info loads.
    /// </summary>
    /// <param name="result"></param>
    void OnProfileInfoLoaded(FBResult result)
    {
        Dictionary <string, object> profileInfo = (Dictionary <string, object>)Json.Deserialize(result.Text);

        facebookName = profileInfo["name"].ToString();

        FB.API("me/picture?width=100&height=100&redirect=false", Facebook.HttpMethod.GET, OnPictureLoaded);
    }
コード例 #26
0
ファイル: GuiScore.cs プロジェクト: Milton761/SRM
	private void FBLoginCallback(FBResult result) {
		if(FB.IsLoggedIn) {
		//	showLoggedIn();
			StartCoroutine("ParseLogin");
		} else {
			Debug.Log ("FBLoginCallback: User canceled login");
		}
	}
コード例 #27
0
 public static void FriendPictureCallback(FBResult result)
 {
     if (result.Error != null)
     {
         Debug.LogError(result.Error);
         return;
     }
 }
コード例 #28
0
    /// <summary>
    /// Callback used when user's profile info loads.
    /// </summary>
    /// <param name="result"></param>
    void OnProfileInfoLoaded(FBResult result)
    {
        Dictionary<string, object> profileInfo = (Dictionary<string, object>)Json.Deserialize(result.Text);

        facebookName = profileInfo["name"].ToString();

        FB.API("me/picture?width=100&height=100&redirect=false", Facebook.HttpMethod.GET, OnPictureLoaded);
    }
コード例 #29
0
ファイル: ShowSummary.cs プロジェクト: mrtnstolk/Jumpy
	void LoginCallback(FBResult result)                                                        
	{                                                                                                                                                
		
		if (FB.IsLoggedIn)                                                                     
		{                                                                                      
			OnLoggedIn();                                                                      
		}                                                                                      
	}                                                                                          
コード例 #30
0
        private async void OnLoginLogout(EventArgs obj)
        {
            if (FBGlobalScope.IsLoggedIn)
            {
                await FBGlobalScope.Session.LogoutAsync();

                FBGlobalScope.IsLoggedIn = false;
                NavigationService.ShellViewModel.PrimaryItems[0].Label = $"Login";
                var loginItem = NavigationService.ShellViewModel.PrimaryItems[0];
                NavigationService.ShellViewModel.PrimaryItems.Clear();
                NavigationService.ShellViewModel.PrimaryItems.Add(loginItem);
            }
            else
            {
                int      count  = 0;
                FBResult result = null;
                do
                {
                    FBGlobalScope.Initialize();
                    result = await FBGlobalScope.Session.LoginAsync(FBGlobalScope.Permissions, SessionLoginBehavior.WebView);

                    if (result.Succeeded)
                    {
                        FBGlobalScope.IsLoggedIn = true;
                        await FBGlobalScope.PopulateUserData();

                        NavigationService.ShellViewModel.PrimaryItems[0].Label = $"Logged in as {FBGlobalScope.User.Name}";

                        foreach (var page in FBGlobalScope.Pages)
                        {
                            string key = $"{typeof(PostViewModel).FullName}{page.Id}";
                            NavigationService.Configure(key, typeof(PostPage));
                            NavigationService.ShellViewModel.PrimaryItems.Add(new ShellNavigationItem(
                                                                                  page.Name,
                                                                                  Symbol.Page2,
                                                                                  typeof(PostViewModel).FullName,
                                                                                  page
                                                                                  ));
                        }
                        if (FBGlobalScope.Pages.Count > 0)
                        {
                            NavigationService.Navigate($"{typeof(PostViewModel).FullName}{FBGlobalScope.Pages[0].Id}", FBGlobalScope.Pages[0]);
                        }
                    }
                    else
                    {
                        await FBGlobalScope.Session.LogoutAsync();

                        FBGlobalScope.IsLoggedIn = false;
                        NavigationService.ShellViewModel.PrimaryItems[0].Label = $"Login";
                        var loginItem = NavigationService.ShellViewModel.PrimaryItems[0];
                        NavigationService.ShellViewModel.PrimaryItems.Clear();
                        NavigationService.ShellViewModel.PrimaryItems.Add(loginItem);
                    }
                    count++;
                }while (!result.Succeeded && count < 3);
            }
        }
コード例 #31
0
    void UserCallBack(FBResult result)
    {
        Debug.Log("UserCallBack");

        if (result.Error != null)
        {
            Debug.Log("UserCallBack - user graph request failed: " + result.Error + " - " + result.Text);

#if PROPELLER_SDK
            PropellerSDK.SdkSocialLoginCompleted(null);
#endif

            if (socialPost != SocialPost.NONE)
            {
#if PROPELLER_SDK
                switch (socialPost)
                {
                case SocialPost.INVITE:
                    PropellerSDK.SdkSocialInviteCompleted();
                    break;

                case SocialPost.SHARE:
                    PropellerSDK.SdkSocialShareCompleted();
                    break;
                }
#endif

                socialPost     = SocialPost.NONE;
                socialPostData = null;
            }

            return;
        }

        string get_data = result.Text;

        var dict = Json.Deserialize(get_data) as IDictionary;
        fbname      = dict ["name"].ToString();
        fbemail     = dict ["email"].ToString();
        fbgender    = dict ["gender"].ToString();
        fbfirstname = dict ["first_name"].ToString();

        PushFBDataToFuel();

        if (socialPost != SocialPost.NONE)
        {
            switch (socialPost)
            {
            case SocialPost.INVITE:
                onSocialInviteClicked(socialPostData);
                break;

            case SocialPost.SHARE:
                onSocialShareClicked(socialPostData);
                break;
            }
        }
    }
コード例 #32
0
 void InviteFriendsCallback(FBResult result)
 {
     PopupManager.Instance.CloseLoadingPopup();
     if (result.Error == null)
     {
         HUDManager.Instance.AddFlyText(Localization.Get("InviteFriend_Success"), Vector3.zero, 40, Color.green, 0, 2f);
     }
     Debug.Log("InviteFriendsCallback " + result.Text);
 }
コード例 #33
0
    void OnLogin(FBResult result)
    {
        if (!NetworkingManager.Connected)
        {
            NetworkingManager.Connect();
        }

        Application.LoadLevel("Lobby");
    }
コード例 #34
0
    /// <summary>
    /// Callback used when user's facebook picture loads.
    /// </summary>
    /// <param name="result"></param>
    void OnPictureLoaded(FBResult result)
    {
        Dictionary <string, object> receivedInfo = (Dictionary <string, object>)Json.Deserialize(result.Text);
        Dictionary <string, object> pictureInfo  = (Dictionary <string, object>)receivedInfo["data"];

        facebookPictureUrl = pictureInfo["url"].ToString();

        this.OnFacebookLoginCompletedCallback(FB.AccessToken, facebookName, facebookPictureUrl);
    }
コード例 #35
0
    void LoginCallback(FBResult result)
    {
        Util.Log("LoginCallback");

        if (FB.IsLoggedIn)
        {
            OnLoggedIn();
        }
    }
コード例 #36
0
    void OnGetMe(FBResult result)
    {
        var dictionary = Json.Deserialize(result.Text) as Dictionary <string, object>;

        PersonalName.text = dictionary["name"] as string;
        string facebookId = dictionary["id"] as string;

        StartCoroutine("GetProfilePicture", facebookId);
    }
コード例 #37
0
ファイル: MainMenu.cs プロジェクト: dth138/friendsmash-unity
 void APICallback(FBResult response)
 {
     profile = FBUtil.DeserializeJSONProfile(response.Text);
     GameStateManager.Username = profile["first_name"];
     StartCoroutine(
         FBUtil.GetPictureTexture(facebookID: FB.UserId, callback: delegate(Texture t) { GameStateManager.UserTexture = t; })
     );
     friends = FBUtil.DeserializeJSONFriends(response.Text);
 }
コード例 #38
0
 private void FacebookLoginCallback(FBResult result)
 {
     GetComponent <CharacterList> ().enabled = true;
     if (FB.IsLoggedIn)
     {
         credentials.AddLogin("graph.facebook.com", FB.AccessToken);
         LoadFromDataset();
     }
 }
コード例 #39
0
ファイル: FBAppRequest.cs プロジェクト: Tetta/Feed-the-Spider
	private void OnDeleteActionFinish(FBResult result) {
	
		if(result.Error != null) {
			State = FBAppRequestState.Deleted;
		}


		OnDeleteRequestFinished(result);
	}
コード例 #40
0
    // Handles the Profile Picture
    void HandleFBPic(FBResult result)
    {
        // Retrieve the Profile Picture
        t2ProfileImage = result.Texture;
        Debug.Log(t2ProfileImage);

        // Set Image Loaded to true
        bImageLoaded = true;
    }
コード例 #41
0
    private void OnAppRequestFailed_AndroidCB(string error)
    {
        FBResult res = new FBResult("", error);

        FBAppRequestResult r = new FBAppRequestResult();

        r.Result = res;
        OnAppRequestCompleteAction(r);
    }
コード例 #42
0
ファイル: LoginPopUp.cs プロジェクト: longstim/juice-blast
 void Callback(FBResult result)
 {
     if (result.Error == null)
     {
         var dict = Json.Deserialize(result.Text) as Dictionary <string, object>;
         Name.text = dict["name"] as string;
         Show();
     }
 }
コード例 #43
0
ファイル: MenuGUI.cs プロジェクト: ronforbes/BlockParty1
    void OnLogin(FBResult result)
    {
        if (!NetworkingManager.Connected)
        {
            NetworkingManager.Connect();
        }

        Application.LoadLevel("Lobby");
    }
コード例 #44
0
ファイル: FBPostingTask.cs プロジェクト: angelolee/ANP
    private void OnFBAuthFailed()
    {
        SPFacebook.instance.removeEventListener(FacebookEvents.AUTHENTICATION_FAILED, OnFBAuthFailed);
        SPFacebook.instance.removeEventListener(FacebookEvents.AUTHENTICATION_SUCCEEDED, OnFBAuth);

        FBResult res = new FBResult("", "Auth failed");

        dispatch(BaseEvent.COMPLETE, res);
    }
コード例 #45
0
    void OnProfilePictureCallback(FBResult pResult)
    {
        if (userProfileImage != null)
        {
            userProfileImage.sprite = Sprite.Create(pResult.Texture, new Rect(0, 0, 128, 128), Vector2.zero);
        }

        FBLoginButton.gameObject.SetActive(false);
    }
コード例 #46
0
    void AppRequestCallback(FBResult result)
    {
        Debug.Log("AppRequestCallback=" + result.Text);

        g.facebookEvent = "";

        StartCoroutine(popupFriendControl.MakeFriendGrid());
        popupFriendControl.fbLoginInfo.SetActive(false);
    }
コード例 #47
0
    static void OnGetMe(FBResult result)
    {
        var dictionary = Json.Deserialize(result.Text) as Dictionary <string, object>;

        Name       = dictionary["name"] as string;
        FacebookId = dictionary["id"] as string;

        Debug.Log(Name + " (" + FacebookId + ")");
    }
コード例 #48
0
 private void GetFriendUsersCallback(FBResult result)
 {
     if (result.Error == null)
     {
         IDictionary   dict  = Facebook.MiniJSON.Json.Deserialize(result.Text) as IDictionary;
         List <object> users = dict["data"] as List <object>;
         OnFriendsLoadedDelegate(users);
     }
 }
コード例 #49
0
ファイル: FaceBook.cs プロジェクト: lmo0317/puzzle-of-dice
    public static void LoginCallback(FBResult result)
    {
        FbDebug.Log("call login: "******"login result: " + result.Text);

        FB.API("/me?fields=id,name,first_name,last_name,gender,locale,currency,friends.limit(1000).fields(first_name,last_name,id)", Facebook.HttpMethod.GET, FaceBook.APICallback);
        FacebookPictureDownloader.EnQueue(FB.UserId);
        FB.API("/app/scores?fields=score,user.limit(1000)", Facebook.HttpMethod.GET, ScoresCallback);
    }
コード例 #50
0
 private void OnFacebookFeed(FBResult result)
 //private void OnFacebookFeed(IShareResult result)
 {
     if (result.Error != null)
     {
         Debug.Log("There was an error logging into Facebook!");
     }
     OnHideUnity(true);
 }
コード例 #51
0
    private void OnPostFailed(CEvent e)
    {
        FBResult res = e.data as FBResult;

        //can be null if user wasn't logged in
        if (res != null)
        {
        }
    }
コード例 #52
0
ファイル: FBHolder.cs プロジェクト: lesterlecong/Assets
 void AuthCallback(FBResult result)
 {
     if (FB.IsLoggedIn){
         OnLoggedIn();
         //StartCoroutine(RegisterToCouchbase());
     }else{
         Debug.Log("Failed Logged in");
     }
 }
コード例 #53
0
    void ScoresCallback(FBResult result)
    {
        Util.Log("ScoresCallback");
        if (result.Error != null)
        {
            Util.LogError(result.Error);
            return;
        }

        scores = new List <object>();
        List <object> scoresList = Util.DeserializeScores(result.Text);

        foreach (object score in scoresList)
        {
            var entry = (Dictionary <string, object>)score;
            var user  = (Dictionary <string, object>)entry["user"];

            string userId = (string)user["id"];

            if (string.Equals(userId, FB.UserId))
            {
                // This entry is the current player
                int playerHighScore = getScoreFromEntry(entry);
                Util.Log("Local players score on server is " + playerHighScore);
                if (playerHighScore < GameStateManager.Score)
                {
                    Util.Log("Locally overriding with just acquired score: " + GameStateManager.Score);
                    playerHighScore = GameStateManager.Score;
                }

                entry["score"]             = playerHighScore.ToString();
                GameStateManager.HighScore = playerHighScore;
            }

            scores.Add(entry);
            if (!friendImages.ContainsKey(userId))
            {
                // We don't have this players image yet, request it now
                LoadPicture(Util.GetPictureURL(userId, 128, 128), pictureTexture =>
                {
                    if (pictureTexture != null)
                    {
                        friendImages.Add(userId, pictureTexture);
                    }
                });
            }
        }

        // Now sort the entries based on score
        scores.Sort(delegate(object firstObj,
                             object secondObj)
        {
            return(-getScoreFromEntry(firstObj).CompareTo(getScoreFromEntry(secondObj)));
        }
                    );
    }
コード例 #54
0
 void PictureCallBack(FBResult result)
 {
     if (result.Error != null)           // If there is an Error because Error value did not return null, instead it returned an error
     {
         Debug.Log("Error getting profile picture.");
         //FB.API(Util.GetPictureURL("me",48,48),Facebook.HttpMethod.GET,PictureCallBack);//Profile Picture - Can Casue infinite loop
         return;
     }
     avatarImage = result.Texture;
 }
コード例 #55
0
ファイル: Util.cs プロジェクト: amisiak7/jewels2
    public static void FriendPictureCallback(FBResult result)
    {
        if (result.Error != null)
        {
            Debug.LogError(result.Error);
            return;
        }

        //GameStateManager.FriendTexture = result.Texture;
    }
コード例 #56
0
ファイル: SPFacebook.cs プロジェクト: makezi/shape-clash
    private void OnAppRequestFailed_AndroidCB(string error)
    {
        FBResult res = new FBResult("", error);

        FBAppRequestResult r = new FBAppRequestResult();

        r.Result = res;
        dispatch(FacebookEvents.APP_REQUEST_COMPLETE, r);
        OnAppRequestCompleteAction(r);
    }
コード例 #57
0
    /// <summary>
    /// Called after getting the user information
    /// </summary>
    /// <param name="result"> The result ofthe callback </param>
    private void APICallback(FBResult result) {
        if (result.Error != null) {
            Debug.LogError(result.Error);
            return;
        }

        var data = JSONNode.Parse(result.Text);
        FacebookUser user = new FacebookUser(data["first_name"] + data["last_name"], data["id"].AsInt, null /*TODO get picture data from lin data["picture"]*/);
        SocialNetworkManager_Persistent.Instance.userInformation.facebook = user;
    }
コード例 #58
0
    private void OnDeleteActionFinish(FBResult result)
    {
        if (result.Error != null)
        {
            State = FBAppRequestState.Deleted;
        }


        OnDeleteRequestFinished(result);
    }
コード例 #59
0
    void OnUpdateRankingCallback(FBResult pResult)
    {
        List <object> scoresList = FacebookUtil.DeserializeScores(pResult.Text);

        foreach (object score in scoresList)
        {
            var entry = (Dictionary <string, object>)score;
            var user  = (Dictionary <string, object>)entry["user"];
        }
    }
コード例 #60
0
    public static void FriendPictureCallback(FBResult result)
    {
        if (result.Error != null)
        {
            Debug.LogError(result.Error);
            return;
        }

        //GameStateManager.FriendTexture = result.Texture;
    }