Пример #1
0
 public void AddASyncLoadedImage(Image image, string prefabPath, bool needCached, bool unloadBelongedAssetBundleAfterLoaded, bool isShowSpecMatrial = false)
 {
     if (this.m_asyncLoadedImages == null)
     {
         this.m_asyncLoadedImages = new ListView <CUIFormScript.CASyncLoadedImage>();
     }
     if (this.m_loadedSpriteDictionary == null)
     {
         this.m_loadedSpriteDictionary = new Dictionary <string, GameObject>();
     }
     for (int i = 0; i < this.m_asyncLoadedImages.get_Count(); i++)
     {
         if (this.m_asyncLoadedImages.get_Item(i).m_image == image)
         {
             this.m_asyncLoadedImages.get_Item(i).m_prefabPath = prefabPath;
             return;
         }
     }
     CUIFormScript.CASyncLoadedImage cASyncLoadedImage = new CUIFormScript.CASyncLoadedImage(image, prefabPath, needCached, unloadBelongedAssetBundleAfterLoaded, isShowSpecMatrial);
     this.m_asyncLoadedImages.Add(cASyncLoadedImage);
 }
Пример #2
0
        private void UpdateASyncLoadedImage()
        {
            if (this.m_asyncLoadedImages == null)
            {
                return;
            }
            bool flag = false;
            int  i    = 0;

            while (i < this.m_asyncLoadedImages.get_Count())
            {
                CUIFormScript.CASyncLoadedImage cASyncLoadedImage = this.m_asyncLoadedImages.get_Item(i);
                Image image = cASyncLoadedImage.m_image;
                if (image != null)
                {
                    GameObject gameObject = null;
                    string     prefabPath = cASyncLoadedImage.m_prefabPath;
                    if (!this.m_loadedSpriteDictionary.TryGetValue(prefabPath, ref gameObject) && !flag)
                    {
                        gameObject = CUIUtility.GetSpritePrefeb(prefabPath, cASyncLoadedImage.m_needCached, cASyncLoadedImage.m_unloadBelongedAssetBundleAfterLoaded);
                        this.m_loadedSpriteDictionary.Add(prefabPath, gameObject);
                        flag = true;
                    }
                    if (gameObject != null)
                    {
                        image.color = new Color(image.color.r, image.color.g, image.color.b, 1f);
                        image.SetSprite(gameObject, cASyncLoadedImage.m_isShowSpecMatrial);
                        this.m_asyncLoadedImages.RemoveAt(i);
                    }
                    else
                    {
                        i++;
                    }
                }
                else
                {
                    this.m_asyncLoadedImages.RemoveAt(i);
                }
            }
        }