public AnimationReference FindAnimationRefFromPackFile(PackFile animation, PackFileService pfs) { var fullPath = pfs.GetFullPath(animation); foreach (var entry in _skeletonNameToAnimationMap.Values) { foreach (var s in entry) { var res = String.Compare(s.AnimationFile, fullPath, StringComparison.InvariantCultureIgnoreCase); if (res == 0) { return(s); } } } var f = pfs.FindFile(fullPath); if (f != null) { var pf = pfs.GetPackFileContainer(animation); return(new AnimationReference(fullPath, pf)); } return(null); }
public void LoadFromPackFileContainer(PackFileService pfs, PackFileContainer packFileContainer) { var allAnimations = pfs.FindAllWithExtentionIncludePaths(".anim", packFileContainer); foreach (var animation in allAnimations) { try { var animationSkeletonName = AnimationFile.GetAnimationHeader(animation.Item2).SkeletonName; if (_skeletonNameToAnimationMap.ContainsKey(animationSkeletonName) == false) { _skeletonNameToAnimationMap.Add(animationSkeletonName, new ObservableCollection <AnimationReference>()); } _skeletonNameToAnimationMap[animationSkeletonName].Add(new AnimationReference(pfs.GetFullPath(animation.Item2, packFileContainer), packFileContainer)); } catch (Exception e) { _logger.Here().Error("Parsing failed for " + pfs.GetFullPath(animation.Item2, packFileContainer) + "\n" + e.ToString()); } } var allNormalSkeletons = allAnimations.Where(x => x.Item1.Contains("animations\\skeletons", StringComparison.InvariantCultureIgnoreCase)); foreach (var item in allNormalSkeletons) { SkeletonFileNames.Add(item.Item1); } var techSkeletons = allAnimations.Where(x => x.Item1.Contains("tech", StringComparison.InvariantCultureIgnoreCase)); foreach (var item in techSkeletons) { SkeletonFileNames.Add(item.Item1); } _logger.Here().Information("Animations found =" + allAnimations.Count()); _logger.Here().Information("Skeletons found =" + SkeletonFileNames.Count()); }