Пример #1
0
 private void OnLoadTextureComplete(string url)
 {
     //如果是默认图  并且实际上用的图已经加载好
     if (url == defaultUrl && (curTexture != null || string.IsNullOrEmpty(_url)))
     {
         return;
     }
     //不是当前需求要的图
     if (url != defaultUrl && url != _url)
     {
         return;
     }
     isClear = false;
     try {
         curTexture = FuncUtil.GetUIAssetByPath(url) as Texture2D;
     } catch (Exception e) {
         FuncUtil.ShowError("Image加载完毕后获取Texture2D失败:{0}", e.Message);
         return;
     }
     if (curTexture == null)
     {
         Clear();
         FuncUtil.ShowError("Image加载完毕后获取Texture2D失败:{0}", url);
     }
     FuncUtil.NoDispose(_url);
     UpdateBaseTexture();
     if (_imageWidth != 0 && _imageHeight != 0)
     {
         width  = Convert.ToInt32(_imageWidth);
         height = Convert.ToInt32(_imageHeight);
     }
     OnCompleteCallBack();
 }