protected void _LoadSpriteABAsyn(XUITextureConfig.TextureInfo textureInfo, Action <Sprite> OnComplete) { if (string.IsNullOrEmpty(textureInfo.atlasName)) { m_AssetLoader.LoadAssetAsyn <Sprite>(textureInfo.path, sprite => { if (sprite == null) { Debug.LogError($"没有找到sprite {textureInfo.ToLog()}"); } OnComplete?.Invoke(sprite); }); } else { m_AssetLoader.LoadAssetAsyn <SpriteAtlas>(textureInfo.path, spriteAtlas => { //Debug.Log($"LoadAsset SpriteAtlas {textureInfo.path} {spriteAtlas}"); var sprite = spriteAtlas.GetSprite(textureInfo.name); if (sprite == null) { Debug.LogError($"没有找到sprite {textureInfo.ToLog()}"); } OnComplete?.Invoke(sprite); }); } }
protected Sprite _LoadSpriteBI(XUITextureConfig.TextureInfo textureInfo) { Sprite sprite = null; if (string.IsNullOrEmpty(textureInfo.atlasName)) { sprite = Resources.Load <Sprite>(textureInfo.path); } else { var atlas = Resources.Load <SpriteAtlas>(textureInfo.path); if (atlas != null) { sprite = atlas.GetSprite(textureInfo.name); } } if (sprite == null) { Debug.LogError($"没有找到sprite {textureInfo.ToLog()}"); return(null); } return(sprite); }
protected Sprite _LoadSpriteAB(XUITextureConfig.TextureInfo textureInfo) { Sprite sprite = null; if (string.IsNullOrEmpty(textureInfo.atlasName)) { sprite = m_AssetLoader.LoadAsset <Sprite>(textureInfo.path); } else { var atlas = m_AssetLoader.LoadAsset <SpriteAtlas>(textureInfo.path); Debug.Log($"LoadAsset SpriteAtlas {textureInfo.path} {atlas}"); if (atlas != null) { sprite = atlas.GetSprite(textureInfo.name); } } if (sprite == null) { Debug.LogError($"没有找到sprite {textureInfo.ToLog()}"); return(null); } return(sprite); }