private IEnumerator <float> IEDownloadAvatar(InvitableFriend _modelFriend) { yield return(Timing.WaitForSeconds(1f)); if (_modelFriend.index == this.Index) { DownloadFacebookAvatar(_modelFriend); } }
private void ResetAvatar(InvitableFriend model) { if (model.avatar != null) { spriteAvatar.sprite2D = model.avatar; } else { spriteAvatar.sprite2D = defaultAvatar; Timing.RunCoroutine(IEDownloadAvatar(model)); } }
private void OnSelectedOrUnselectedInvateFriend(Message msg) { InvitableFriend friendModel = (InvitableFriend)(msg.data); if (friendModel != null) { for (int i = 0; i < listFriendsID.Count; i++) { if (listFriendsID[i].id == friendModel.id) { listFriendsID[i].isSelected = friendModel.isSelected; } } } }
private void DownloadFacebookAvatar(InvitableFriend modelForGetAvatar) { if (string.IsNullOrEmpty(modelForGetAvatar.picture.data.url)) { return; } string linkAvatar = modelForGetAvatar.picture.data.url; AssetDownloader.Instance.DownloadAndCacheAsset(linkAvatar, 0, null, null, (WWW www) => { Rect rec = new Rect(0, 0, www.texture.width, www.texture.height); Sprite.Create(www.texture, rec, new Vector2(0, 0), 1); Sprite sprite = Sprite.Create(www.texture, rec, new Vector2(0, 0), .01f); //if (pModel != null) // pModel.avatar = spriteAvatar; //avatar.sprite2D = spriteAvatar; modelForGetAvatar.avatar = sprite; if (modelForGetAvatar.index == this.Index) { spriteAvatar.sprite2D = sprite; } }); }