コード例 #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 = AI_BetterHScenes.hFlagCtrl.nowAnimationInfo.nameAnimation;

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

            var motion = AI_BetterHScenes.currentMotion;

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

            AI_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();
        }
コード例 #2
0
 public void AddCharacterPair(MotionList motionList)
 {
     MotionList.Add(motionList);
 }