//-- 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(); }
private static void SavePosition(bool bAsDefault = false) { string characterPairName = null; foreach (var character in AI_BetterHScenes.characters.Where(character => character != null && character.visibleAll)) { if (characterPairName == null) { characterPairName = character.fileParam.fullname; } else { characterPairName += "_" + character.fileParam.fullname; } } if (characterPairName == null) { return; } var characterPair = new CharacterPairList(characterPairName); for (var charIndex = 0; charIndex < AI_BetterHScenes.characters.Count; charIndex++) { if (!AI_BetterHScenes.characters[charIndex].visibleAll) { continue; } var characterName = AI_BetterHScenes.characters[charIndex].fileParam.fullname; var characterOffsetParams = new CharacterOffsets(characterName, characterOffsets[charIndex].offsetVectors); characterPair.AddCharacterOffset(characterOffsetParams); } HSceneOffset.SaveCharacterPairPosition(characterPair, bAsDefault); }
public void AddCharacterPair(CharacterPairList charaterPairList) { CharacterPairList.Add(charaterPairList); }