private void OnPlayerDataLoaded(SocialProfile profile) { User user = new User(); user.UserName = profile.Name; user.Avatar = profile.Avatar; user.UserId = profile.Id; UsersManager.CurrentUser = user; ServerRequests.UpdateUserInfo(UsersManager.CurrentUser, null, null); ServerRequests.GetUsersData(new List <User> { UsersManager.CurrentUser }, AddUserView, () => Debug.Log("GetUsersData Fail")); StartCoroutine(NetworkImage.TryLoadTexturesToCache(new[] { profile.Avatar })); }
private void OnUserFriendsLoaded(string data) { List <User> friendsUsers = JsonConvert.DeserializeObject <VkUserData[]>(data).Select(u => u.ConvertToUser()).ToList(); friendsUsers.RemoveAll(x => x.UserName.ToLower() == "deleted "); friendsUsers.Where(x => string.IsNullOrEmpty(x.Avatar) || x.Avatar == "https://vk.com/images/deactivated_200.png" || x.Avatar == "https://vk.com/images/camera_200.png?ava=1").ToList().ForEach(x => x.Avatar = "noAvatar"); UsersManager.FriendsUsers = friendsUsers; if (UsersManager.FriendsUsers.Count > 0) { StartCoroutine(NetworkImage.TryLoadTexturesToCache(friendsUsers.Select(x => x.Avatar).ToArray())); ServerRequests.GetUsersData(friendsUsers, UpdateUsersData, () => Debug.Log("GetUsersData Fail")); } }