public void Init(FriendInfo friend)
    {
        _didCustomTagsChange = false;
        ClearAllTagUI();

        DisplayName.text             = string.IsNullOrEmpty(friend.TitleDisplayName) ? friend.Username : friend.TitleDisplayName;
        UserName.text                = string.IsNullOrEmpty(friend.Username) ? "________" : friend.Username;
        PlayFabID.text               = friend.FriendPlayFabId;
        Origin.text                  = friend.FacebookInfo != null ? "Facebook" : "PlayFab";
        RemoveFriendBtn.interactable = friend.FacebookInfo == null;

        activeFriend = friend;
        if (friend.Tags != null)
        {
            for (var z = 0; z < friend.Tags.Count; z++)
            {
                AddTagItemUI(tag, z);
            }
        }

        if (friend.FacebookInfo != null && !string.IsNullOrEmpty(friend.FacebookInfo.FacebookId))
        {
            UnityAction <Texture2D> afterGetPhoto = tx =>
            {
                ProfilePhoto.overrideSprite = Sprite.Create(tx, new Rect(0, 0, 128, 128), new Vector2());
            };

            StartCoroutine(FacebookHelperClass.GetFriendProfilePhoto(friend.FacebookInfo.FacebookId, FetchWebAsset, afterGetPhoto));
        }
        else
        {
            ProfilePhoto.overrideSprite = null;
        }
    }
Exemple #2
0
    public void Init(FriendInfo friend)
    {
        // reset from previous
        this.didCustomTagsChange = false;
        ClearAllTagUI();

        //Update new info
        this.DisplayName.text = friend.TitleDisplayName;
        this.UserName.text    = string.IsNullOrEmpty(friend.Username) ? "________" : friend.Username;
        this.PlayFabID.text   = friend.FriendPlayFabId;
        this.Origin.text      = friend.FacebookInfo != null ? "Facebook" : "PlayFab";

        if (friend.FacebookInfo != null)
        {
            this.RemoveFriendBtn.interactable = false;
        }
        else
        {
            this.RemoveFriendBtn.interactable = true;
        }

        this.activeFriend = friend;
        if (friend.Tags != null)
        {
            for (int z = 0; z < friend.Tags.Count; z++)
            {
                AddTagItemUI(tag, z);
            }
        }

        //friend.FacebookInfo != null
        // get profile pic
        if (friend.FacebookInfo != null && !string.IsNullOrEmpty(friend.FacebookInfo.FacebookId))
        {
            UnityAction <Texture2D> afterGetPhoto = (Texture2D tx) =>
            {
                ProfilePhoto.overrideSprite = Sprite.Create(tx, new Rect(0, 0, 128, 128), new Vector2());
            };

            StartCoroutine(FacebookHelperClass.GetFriendProfilePhoto(friend.FacebookInfo.FacebookId, FetchWebAsset, afterGetPhoto));
        }
        else
        {
            ProfilePhoto.overrideSprite = null;
        }
    }