예제 #1
0
 // Animations where rider and mount needs the same amount of frames
 List <(string, string)> GetMatchedAnimations()
 {
     return(_mountFragment.Fragments
            .Where(x => AnimationSlotTypeHelper.GetMatchingRiderAnimation(x.Slot.Value) != null)
            .Select(x => (AnimationSlotTypeHelper.GetMatchingRiderAnimation(x.Slot.Value).Value, x.Slot.Value))
            .Distinct()
            .ToList());
 }
예제 #2
0
        public AnimationFragmentEntry(ByteChunk data)
        {
            _id   = data.ReadInt32();
            _slot = data.ReadInt32();

            Slot = AnimationSlotTypeHelper.GetFromId(_slot);

            AnimationFile     = data.ReadString();
            MetaDataFile      = data.ReadString();
            SoundMetaDataFile = data.ReadString();
            Skeleton          = data.ReadString();
            Blend             = data.ReadSingle();
            Weight            = data.ReadSingle();
            Unknown0          = data.ReadInt32();
            Unknown1          = data.ReadInt32();
            Unknown3          = data.ReadString();
            Unknown4          = data.ReadBool();
        }
예제 #3
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!");
            }
        }