public Animation(DirectoryInfo _info)
        {
            info = _info;

            string Jpath = _info.FullName + "\\0.Atlases\\SpriteInfo.json";

            if (File.Exists(Jpath))
            {
                spriteInfo = JsonConvert.DeserializeObject <SpriteInfo>(File.ReadAllText(Jpath));
            }

            clips = FindAllClips(_info, spriteInfo);
        }
Exemple #2
0
 private Sprite GetSprite(FileInfo _info, SpriteInfo _spriteInfo)
 {
     if (_spriteInfo == null)
     {
         return(null);
     }
     for (int i = 0; i < _spriteInfo.Length; i++)
     {
         if (_info.FullName.EndsWith(_spriteInfo[i].path.Replace("/", "\\")))
         {
             return(_spriteInfo[i]);
         }
     }
     return(null);
 }
Exemple #3
0
        private List <Frame> FindAllFrames(DirectoryInfo _info, SpriteInfo _spriteInfo)
        {
            List <Frame> frames = new List <Frame>();

            foreach (var frame in _info.GetFiles())
            {
                if (frame.Name.Contains("-") && frame.Name.Length == 14 && !frame.Name.Contains("position") && !frame.Name.Contains("backup"))
                {
                    try
                    {
                        frames.Add(new Frame(frame, _spriteInfo));
                    }
                    catch (System.Exception)
                    {
                        continue;
                        throw;
                    }
                }
            }
            return(frames);
        }
Exemple #4
0
 public Clip(DirectoryInfo _info, SpriteInfo _spriteInfo)
 {
     info       = _info;
     spriteInfo = _spriteInfo;
     frames     = FindAllFrames(_info, _spriteInfo);
 }