Exemple #1
0
 public static Texture2D DownImage(string url)                       //下载图片
 {
     if (string.IsNullOrEmpty(url))
     {
         MyLog.Red("图片Url为空");
         return(null);
     }
     if (urlK_Texture.ContainsKey(url))
     {
         return(urlK_Texture[url]);
     }
     else
     {
         Texture2D texture = null;
         WWW       www     = new WWW(url);
         while (!www.isDone)
         {
             MyCreate.ShowProgressBar("下载图片", www.progress);
         }
         MyCreate.ProgressBarFinish();
         if (www.error != null)
         {
             MyLog.Red("图片加载失败!! —— " + www.error);
             MyLog.Red("URL —— " + url);
             urlK_Texture.Add(url, null);
         }
         else
         {
             texture = www.textureNonReadable;
             urlK_Texture.Add(url, texture);
         }
         www.Dispose();
         return(texture);
     }
 }