Beispiel #1
0
        //-- Save the character pair of offsets to the xml file, overwriting if necessary --//
        public static void SaveCharacterPairPosition(CharacterPairList characterPair, bool isDefault = false)
        {
            var currentAnimation = HS2_BetterHScenes.hFlagCtrl.nowAnimationInfo.nameAnimation;

            if (currentAnimation == null || characterPair == null || HS2_BetterHScenes.currentMotion == null)
            {
                return;
            }

            var motion = HS2_BetterHScenes.currentMotion;

            if (isDefault)
            {
                motion = "default";
            }

            HS2_BetterHScenes.Logger.LogMessage("Saving Offsets for " + currentAnimation + " Motion " + motion + " for characters " + characterPair);

            var animation = animationOffsets.Animations.Find(x => x.AnimationName == currentAnimation);

            if (animation != null)
            {
                animationOffsets.Animations.Remove(animation);

                var motionList = animation.MotionList.Find(x => x.MotionName == motion);
                if (motionList != null)
                {
                    animation.MotionList.Remove(motionList);

                    var existingCharacterPair = motionList.CharacterPairList.Find(x => x.CharacterPairName == characterPair.CharacterPairName);
                    if (existingCharacterPair != null)
                    {
                        motionList.CharacterPairList.Remove(existingCharacterPair);
                    }

                    motionList.CharacterPairList.Add(characterPair);
                    animation.MotionList.Add(motionList);
                }
                else
                {
                    motionList = new MotionList(motion);
                    motionList.CharacterPairList.Add(characterPair);
                    animation.MotionList.Add(motionList);
                }

                animationOffsets.AddCharacterAnimationsList(animation);
            }
            else
            {
                animation = new AnimationsList(currentAnimation);
                var motionList = new MotionList(motion);
                motionList.CharacterPairList.Add(characterPair);
                animation.MotionList.Add(motionList);
                animationOffsets.AddCharacterAnimationsList(animation);
            }

            SaveOffsetsToFile();
        }
Beispiel #2
0
 public void AddCharacterAnimationsList(AnimationsList characterAnimationList)
 {
     Animations.Add(characterAnimationList);
 }