Sprite LoadSpriteFromSpriteSheet(string path, string sheetPath)
        {
            Dictionary <string, Sprite> sheet;

            if (!AllSheets.TryGetValue(sheetPath, out sheet))
            {
                sheet = new Dictionary <string, Sprite> ();
                AllSheets [sheetPath] = sheet;

                Sprite [] sprites = Resources.LoadAll <Sprite> (LANG + sheetPath);
                foreach (var sprite in sprites)
                {
                    sheet [sprite.name] = sprite;
                }
                UpdateCount();
            }

            var shortPath = BaseUtils.GetFilenameWithoutExtension(path);

            if (sheet.ContainsKey(shortPath))
            {
                return(sheet [shortPath]);
            }

            Debug.LogError(GetType().Name + "::LoadSpriteFromSpriteSheet Cannot load texture at " + path);
            return(null);
        }
        Sprite LoadNewTexture(string path)
        {
            var sprite = Resources.Load <Sprite> (LANG + path);

            if (sprite == null)
            {
                // check in spritesheet json
                foreach (var sheetKey in textureJSON.Keys)
                {
                    var sheetDef = textureJSON [sheetKey];

                    foreach (var spriteKey in sheetDef.Keys)
                    {
                        var spritePath = string.Format("{0}/{1}", sheetKey, BaseUtils.GetFilenameWithoutExtension(spriteKey));
                        if (spritePath == path)
                        {
                            return(LoadSpriteFromSpriteSheet(path, string.Format("{0}/{1}", sheetKey, BaseUtils.GetFilenameWithoutExtension(sheetDef [spriteKey] ["src"]))));
                        }
                    }
                }
            }
            else
            {
                AllSprites [path] = sprite;
                UpdateCount();
                return(sprite);
            }

            Debug.LogError(GetType().Name + "::LoadNewTexture Cannot load texture at " + path);

            return(null);
        }