public static void SetImageSprite(Image image, string prefabPath, CUIFormScript formScript, bool loadSync = true, bool needCached = false, bool unloadBelongedAssetBundleAfterLoaded = false, bool isShowSpecMatrial = false) { if (image == null) { return; } if (loadSync) { CUIUtility.SetImageSprite(image, CUIUtility.GetSpritePrefeb(prefabPath, needCached, unloadBelongedAssetBundleAfterLoaded), isShowSpecMatrial); } else { image.color = new Color(image.color.r, image.color.g, image.color.b, 0f); formScript.AddASyncLoadedImage(image, prefabPath, needCached, unloadBelongedAssetBundleAfterLoaded, isShowSpecMatrial); } }
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); } } }
private void UpdateASyncLoadedImage() { if (this.m_asyncLoadedImages != null) { bool flag = false; int index = 0; while (index < this.m_asyncLoadedImages.Count) { Image image = this.m_asyncLoadedImages[index].m_image; if (image != null) { GameObject obj2 = null; if (!this.m_loadedSpriteDictionary.TryGetValue(this.m_asyncLoadedImages[index].m_prefabPath, out obj2) && !flag) { obj2 = CUIUtility.GetSpritePrefeb(this.m_asyncLoadedImages[index].m_prefabPath, this.m_asyncLoadedImages[index].m_needCached, this.m_asyncLoadedImages[index].m_unloadBelongedAssetBundleAfterLoaded); this.m_loadedSpriteDictionary.Add(this.m_asyncLoadedImages[index].m_prefabPath, obj2); flag = true; } if (obj2 != null) { image.color = new Color(image.color.r, image.color.g, image.color.b, 1f); image.SetSprite(obj2); this.m_asyncLoadedImages.RemoveAt(index); } else { index++; } } else { this.m_asyncLoadedImages.RemoveAt(index); } } } }