Ejemplo n.º 1
0
    public IEnumerator RejectReceivedFriendRequest(Friendship fromFriend)
    {
        Debug.Log("Rejecting friend request");

        Dictionary <string, string> data = new Dictionary <string, string>();

        data ["fromUser"] = fromFriend.GetOtherUser().GetUserId();

        ServerCall waitFor = new ServerCall(INSTANCE.SendServerInformationRequest(REJECT_FRIEND_REQUEST, data));

        yield return(StartCoroutine(waitFor.call()));

        string infoText = waitFor.Response;

        Debug.Log("Received " + infoText);

        LoggedInUser.GetLoggedInUser().friends.Remove(fromFriend);

        yield return(infoText);
    }
Ejemplo n.º 2
0
    public IEnumerator CancelSentFriendRequest(Friendship toUser)
    {
        Debug.Log("Canceling sent friend request");

        Dictionary <string, string> data = new Dictionary <string, string>();

        data ["toUser"] = toUser.GetOtherUser().GetUserId();

        ServerCall waitFor = new ServerCall(INSTANCE.SendServerInformationRequest(CANCEL_FRIEND_REQUEST, data));

        yield return(StartCoroutine(waitFor.call()));

        string infoText = waitFor.Response;

        Debug.Log("Received " + infoText);

        LoggedInUser.GetLoggedInUser().friends.Remove(toUser);

        yield return(infoText);
    }
Ejemplo n.º 3
0
    public IEnumerator AcceptReceivedFriendRequest(Friendship existingToAccept)
    {
        Debug.Log("Accepting friend request");

        Dictionary <string, string> data = new Dictionary <string, string>();

        data ["fromUser"] = existingToAccept.GetOtherUser().GetUserId();

        ServerCall waitFor = new ServerCall(INSTANCE.SendServerInformationRequest(ACCEPT_FRIEND_REQUEST, data));

        yield return(StartCoroutine(waitFor.call()));

        string infoText = waitFor.Response;

        Debug.Log("Received " + infoText);

        Friendship accepted = JsonUtility.FromJson <Friendship> (infoText);

        LoggedInUser.GetLoggedInUser().friends.Remove(existingToAccept);
        LoggedInUser.GetLoggedInUser().friends.Add(accepted);

        yield return(accepted);
    }
 public void SetFriendship(Friendship friendship)
 {
     friend = friendship;
     avatarImage.SetUser(friend.GetOtherUser());
     usernameText.text = friend.GetOtherUser().GetUserFriendlyName();
 }
 private void OnMenuItemButton()
 {
     userProfile.ShowUser(friend.GetOtherUser());
 }