Beispiel #1
0
        void CopyAnimations(string riderSlot, ErrorListViewModel.ErrorList resultInfo)
        {
            var fragmentEntry = _riderFragment.Fragments.First(x => x.Slot.Value == riderSlot);

            _riderOutputFragment.Fragments.Add(fragmentEntry.Clone());

            resultInfo.Ok(riderSlot, "Animation copied from rider");
        }
Beispiel #2
0
        public void Process(AnimationFragment mountFragment, AnimationFragment riderFragment)
        {
            var resultInfo = new ErrorListViewModel.ErrorList();

            _mountFragment = mountFragment;
            _riderFragment = riderFragment;

            CreateFiles();
            CreateFragmentAndAnimations(resultInfo);
            SaveFiles();

            ErrorListWindow.ShowDialog("Mount creation result", resultInfo, false);
        }
Beispiel #3
0
        void CreateFragmentAndAnimations(ErrorListViewModel.ErrorList resultInfo)
        {
            // Find all slots that can just be copied over
            foreach (var animationSlot in GetAnimationsThatRequireNoChanges())
            {
                CopyAnimations(animationSlot, resultInfo);
            }

            // Process animations that needs matching
            foreach (var animationSlot in GetMatchedAnimations())
            {
                CreateAnimation(animationSlot.Item1, animationSlot.Item2, resultInfo);
            }
        }
Beispiel #4
0
        void CreateAnimation(string riderSlot, string mountSlot, ErrorListViewModel.ErrorList resultInfo)
        {
            // Does the rider have this?
            var riderHasAnimation = _riderFragment.Fragments.FirstOrDefault(x => x.Slot.Value == riderSlot) != null;

            if (riderHasAnimation)
            {
                // Create a copy of the animation fragment entry
                var riderFragment    = _riderFragment.Fragments.First(x => x.Slot.Value == riderSlot);
                var newRiderFragment = riderFragment.Clone();
                var newAnimationName = GenerateNewAnimationName(newRiderFragment.AnimationFile, _animationPrefix);
                newRiderFragment.AnimationFile = newAnimationName;
                _riderOutputFragment.Fragments.Add(newRiderFragment);

                var mountFragment = _mountFragment.Fragments.First(x => x.Slot.Value == mountSlot);

                // Generate new animation
                var riderAnim = LoadAnimation(riderFragment.AnimationFile);
                var mountAnim = LoadAnimation(mountFragment.AnimationFile);


                var newAnimation = _animationGenerator.GenerateMountAnimation(mountAnim, riderAnim);

                // Save the new animation
                var animFile = newAnimation.ConvertToFileFormat(_animationGenerator.GetRiderSkeleton());
                var bytes    = AnimationFile.GetBytes(animFile);
                SaveHelper.Save(_pfs, newAnimationName, null, bytes);

                resultInfo.Ok(mountSlot, "Matching animation found in rider (" + riderSlot + "). New animation created");
            }
            else
            {
                // Add an empty fragment entry
                _riderOutputFragment.Fragments.Add(new AnimationFragmentEntry()
                {
                    Slot     = AnimationSlotTypeHelper.GetfromValue(riderSlot),
                    Skeleton = _riderFragment.Skeletons.Values.First()
                });

                resultInfo.Error(mountSlot, "Expected slot missing in  rider (" + riderSlot + "), this need to be resolved!");
            }
        }