Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void Init(IXUIAssetLoader assetLoader, IXUILocalizationLoader localizationLoader)
        {
            m_AssetLoader        = assetLoader;
            m_LocalizationLoader = localizationLoader;

            var configBI = Resources.Load <XUITextureConfig>(XUITextureConfig.configPathBIRuntime);

            AddConfig(configBI.configData);

            //临时在这里初始化,应该在assetloader初始化完毕时执行
            var configAB = m_AssetLoader.LoadAsset <XUITextureConfig>(XUITextureConfig.configPathAB);

            AddConfig(configAB.configData);

            //SpriteAtlasManager.atlasRequested += _OnAtlasRequested;
        }