Exemple #1
0
        public static Sprite FindSprite(ResLoader loader, string assetName, string spriteName)
        {
            Sprite result = null;

            result = loader.LoadSync(spriteName) as Sprite;
            if (result == null)
            {
                var data = loader.LoadSync(assetName) as SpritesData;
                if (data != null)
                {
                    m_GlobalSprHandler.SetData(new SpritesData[] { data });
                    return(m_GlobalSprHandler.FindSprite(spriteName) as Sprite);
                }
            }
            return(result);
        }
Exemple #2
0
        public Sprite FindSprite(string spriteName, bool global = false)
        {
            Sprite result = null;

            if (m_SpritesData == null || m_SpritesData.Length == 0)
            {
            }
            else
            {
                if (m_SpritesHandler == null)
                {
                    m_SpritesHandler = new SpritesHandler();
                    m_SpritesHandler.SetData(m_SpritesData);
                }

                result = m_SpritesHandler.FindSprite(spriteName);
            }

            if (result == null)
            {
                result = FindSpriteFromParent(spriteName, global);
            }

            if (result == null && global)
            {
                if (m_GlobalResLoader == null)
                {
                    m_GlobalResLoader = ResLoader.Allocate("AbstractPage");
                }

                result = m_GlobalResLoader.LoadSync(spriteName) as Sprite;
            }

            if (result == null)
            {
                Log.w("Not Find Sprite:" + spriteName);
            }

            return(result);
        }