Esempio n. 1
0
        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 }));
        }
Esempio n. 2
0
        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"));
            }
        }
Esempio n. 3
0
        private void GetAllUsersCallBack(string responce)
        {
            List <User> bdUsers = JsonConvert.DeserializeObject <User[]>(responce).ToList();

            bdUsers.Remove(bdUsers.FirstOrDefault(user => user.UserId == UsersManager.CurrentUser.UserId));
            bdUsers.RemoveAll(x => x.UserName.ToLower() == "deleted ");

            bdUsers.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.WorldTopUsers = bdUsers;

            if (UsersManager.WorldTopUsers.Count > 0)
            {
                StartCoroutine(NetworkImage.TryLoadTexturesToCache(bdUsers.Select(x => x.Avatar).ToArray()));
            }

            if (UsersManager.WorldTopUsers.Count > 0)
            {
                _playersFactory.SetWorldUsers();
            }
        }