예제 #1
0
 void CheckDownloadPicture()
 {
     if (_currDownloadId.Length == 0 && _pictureDownloadIds.Count > 0)
     {
         var fristEnum = _pictureDownloadIds.GetEnumerator();
         fristEnum.MoveNext();
         _currDownloadId = fristEnum.Current;
         FB.API(string.Format("/{0}/picture?height=128&width=128", _currDownloadId), HttpMethod.GET, delegate(IGraphResult result)
         {
             if (debugInfo)
             {
                 FacebookHelperDebug("CheckDownloadPicture");
             }
             if (result == null)
             {
                 if (debugInfo)
                 {
                     FacebookHelperDebug("CheckDownloadPicture Null Response\n");
                 }
                 return;
             }
             else
             {
                 if (!string.IsNullOrEmpty(result.Error))
                 {
                     if (debugInfo)
                     {
                         FacebookHelperDebug("CheckDownloadPicture Error Response:\n" + result.Error);
                     }
                 }
                 else if (result.Cancelled)
                 {
                     if (debugInfo)
                     {
                         FacebookHelperDebug("CheckDownloadPicture Cancelled Response:\n" + result.RawResult);
                     }
                 }
                 else if (!string.IsNullOrEmpty(result.RawResult))
                 {
                     if (debugInfo)
                     {
                         FacebookHelperDebug("CheckDownloadPicture Success Response:\n");
                     }
                     if (_pictureDownloadIds.Contains(_currDownloadId))
                     {
                         Sprite pic = Sprite.Create(result.Texture, new Rect(0, 0, result.Texture.width, result.Texture.height), Vector2.one * 0.5f);
                         if (_pictures.ContainsKey(_currDownloadId))
                         {
                             _pictures[_currDownloadId] = pic;
                         }
                         else
                         {
                             _pictures.Add(_currDownloadId, pic);
                         }
                         _pictureDownloadIds.Remove(_currDownloadId);
                         ModelBinder.OnPropChanged(ModelPropKey.Picture.ToString(), _currDownloadId);
                         _currDownloadId = "";
                         CheckDownloadPicture();
                     }
                 }
                 else
                 {
                     if (debugInfo)
                     {
                         FacebookHelperDebug("CheckDownloadPicture Empty Response\n");
                     }
                 }
             }
         });
     }
 }