示例#1
0
        private IEnumerator <float> IEDownloadAvatar(InvitableFriend _modelFriend)
        {
            yield return(Timing.WaitForSeconds(1f));

            if (_modelFriend.index == this.Index)
            {
                DownloadFacebookAvatar(_modelFriend);
            }
        }
示例#2
0
 private void ResetAvatar(InvitableFriend model)
 {
     if (model.avatar != null)
     {
         spriteAvatar.sprite2D = model.avatar;
     }
     else
     {
         spriteAvatar.sprite2D = defaultAvatar;
         Timing.RunCoroutine(IEDownloadAvatar(model));
     }
 }
示例#3
0
        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;
                    }
                }
            }
        }
示例#4
0
        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;
                }
            });
        }