示例#1
0
    // Token: 0x060017CB RID: 6091 RVA: 0x00080FE8 File Offset: 0x0007F1E8
    private void Update()
    {
        if (!Application.isPlaying)
        {
            return;
        }
        if (this.State == UIRemoteTexture.DownloadState.Downloading)
        {
            if (this.loadingSpinning != null && this.loadingSpinning.enabled)
            {
                this.loadingSpinning.transform.localRotation = Quaternion.Euler(0f, 0f, -Time.time * this.rotationSpeed + Time.time * this.rotationSpeed % 30f);
            }
            TextureLoader.Holder holder = AutoMonoBehaviour <TextureLoader> .Instance.Load(this.url, null);

            if (holder.State != TextureLoader.State.Downloading)
            {
                if (holder.State == TextureLoader.State.Ok)
                {
                    this.uiTexture.mainTexture = holder.Texture;
                    this.State = UIRemoteTexture.DownloadState.Downloaded;
                }
                else
                {
                    this.State = UIRemoteTexture.DownloadState.Error;
                }
            }
        }
    }
 // Token: 0x06001DA1 RID: 7585 RVA: 0x00093198 File Offset: 0x00091398
 public TextureLoader.Holder Load(string url, Texture2D placeholder = null)
 {
     if (string.IsNullOrEmpty(url))
     {
         return(this.nullHolder);
     }
     TextureLoader.Holder holder = null;
     if (this.cache.TryGetValue(url, out holder))
     {
         return(holder);
     }
     holder = new TextureLoader.Holder
     {
         Url     = url,
         Texture = ((!(placeholder == null)) ? (UnityEngine.Object.Instantiate(placeholder) as Texture2D) : new Texture2D(1, 1, TextureFormat.RGB24, false))
     };
     this.cache[url] = holder;
     this.pending.Add(holder);
     return(holder);
 }
 // Token: 0x06001D9F RID: 7583 RVA: 0x0009317C File Offset: 0x0009137C
 private IEnumerator WorkerCrt()
 {
     for (;;)
     {
         while (this.pending.Count == 0)
         {
             yield return(0);
         }
         TextureLoader.Holder item = this.pending[0];
         this.pending.RemoveAt(0);
         WWW   www   = new WWW(item.Url);
         float start = Time.time;
         while (!www.isDone && Time.time - start <= this.TIMEOUT)
         {
             yield return(0);
         }
         if (www.isDone)
         {
             if (string.IsNullOrEmpty(www.error))
             {
                 www.LoadImageIntoTexture(item.Texture);
                 item.State = TextureLoader.State.Ok;
             }
             else
             {
                 item.State = TextureLoader.State.Error;
                 Debug.Log("Failed to download texture " + item.Url + ". " + www.error);
             }
         }
         else
         {
             item.State = TextureLoader.State.Timeout;
             Debug.Log("Failed to download texture " + item.Url + ". Timeout.");
             www.Dispose();
         }
     }
     yield break;
 }