Ejemplo n.º 1
0
 public static void DownloadPhoto(string photoName, int playerId, PhotoUtil.PhotoType type, Action <string> completeCallback)
 {
     PhotoUtil.DownloadPhoto(photoName, 0, playerId, type, completeCallback);
 }
Ejemplo n.º 2
0
        public static void DownloadPhoto(string photoName, int serverId, int playerId, PhotoUtil.PhotoType type, Action <string> completeCallback)
        {
            if (string.IsNullOrEmpty(photoName))
            {
                return;
            }
            string path = photoName;

            if (type == PhotoUtil.PhotoType.THUMBNAILS)
            {
                path = photoName + "_small";
            }
            string text = Path.Combine(Application.persistentDataPath, "photos");

            if (!Directory.Exists(text))
            {
                Directory.CreateDirectory(text);
            }
            string text2 = Path.Combine(text, path);

            if (File.Exists(text2 + ".png"))
            {
                completeCallback(photoName + ";" + text2 + ".png");
            }
            else if (PhotoUtil.downloadImageDict.ContainsKey(photoName))
            {
                PhotoUtil.downloadImageDict[photoName].Add(completeCallback);
            }
            else
            {
                List <Action <string> > list = new List <Action <string> >();
                list.Add(completeCallback);
                PhotoUtil.downloadImageDict.Add(photoName, list);
                PhotoManager.GetInstance().ExePhotoForDownload(photoName, text2, serverId, playerId, (int)type, delegate(string photo)
                {
                    List <Action <string> > list2 = PhotoUtil.downloadImageDict[photoName];
                    for (int i = 0; i < list2.Count; i++)
                    {
                        list2[i](photo);
                    }
                    PhotoUtil.downloadImageDict.Remove(photoName);
                });
            }
        }