public void AddList(InstructionList list) { KeyframeSave keyframe = new KeyframeSave(); foreach (Instruction instruction in list) { if (instruction is GenericInstruction) { GenericInstruction asGenericInstruction = instruction as GenericInstruction; InstructionSave instructionSave = InstructionSave.FromInstruction(asGenericInstruction); keyframe.InstructionSaves.Add(instructionSave); } else { throw new NotImplementedException("This list contains a type of instruction that cannot be saved."); } } keyframe.Name = list.Name; SceneKeyframes.Add(keyframe); }
private static void AddSetToSave(InstructionSet instructionSet, InstructionSetSaveList instructionSetSaveList, string targetName) { // This following members be used as a buffer for holding the lists that will be saved. // In the following loop the code will only copy over instructions that set properties // which are included in EditorData.SavedMembers List <InstructionList> temporaryListList = new List <InstructionList>(); InstructionList temporaryList = new InstructionList(); InstructionSetSave instructionSetSave = new InstructionSetSave(); foreach (KeyframeList keyframeList in instructionSet) { temporaryListList = new List <InstructionList>(); foreach (InstructionList instructionList in keyframeList) { temporaryList = new InstructionList(); temporaryList.Name = instructionList.Name; foreach (Instruction instruction in instructionList) { // Assume that all instructions are GenericInstructions GenericInstruction asGenericInstruction = instruction as GenericInstruction; bool toAdd = false; if (asGenericInstruction.Target is PositionedModel) { toAdd = EditorData.CurrentPositionedModelMembersWatching.Contains(asGenericInstruction.Member); } else if (asGenericInstruction.Target is Sprite) { toAdd = EditorData.CurrentSpriteMembersWatching.Contains(asGenericInstruction.Member); } else if (asGenericInstruction.Target is SpriteFrame) { toAdd = EditorData.CurrentSpriteFrameMembersWatching.Contains(asGenericInstruction.Member); } else if (asGenericInstruction.Target is Text) { toAdd = EditorData.CurrentTextMembersWatching.Contains(asGenericInstruction.Member); } if (toAdd) { // this instruction is one we want to save temporaryList.Add(instruction); } } if (temporaryList.Count != 0) { temporaryListList.Add(temporaryList); } } if (temporaryListList.Count != 0) { instructionSetSave.AddInstructions(temporaryListList, keyframeList.Name); } } if (instructionSetSave.Instructions.Count != 0) { instructionSetSave.Target = targetName; instructionSetSaveList.InstructionSetSaves.Add(instructionSetSave); } }
private unsafe void AddInstruction(GenericInstruction instruction) { Instructions[NumberOfInstructions] = instruction; NumberOfInstructions++; }
public RemoveExistingPlayList(GenericInstruction gi) { this.Id = gi.Id; this.PlaylistId = gi.PlaylistId; }
public static void EndOfFrameActivity() { UpdateListDisplayWindow(); #region Perform Undos if pushed Control+Z if (InputManager.Keyboard.ControlZPushed() && mInstructions.Count != 0) { InstructionList instructionList = mInstructions[mInstructions.Count - 1]; for (int i = 0; i < instructionList.Count; i++) { Instruction instruction = instructionList[i]; // See if the instruction is one that has an associated delegate if (instruction is GenericInstruction) { GenericInstruction asGenericInstruction = instruction as GenericInstruction; Type targetType = asGenericInstruction.Target.GetType(); PropertyComparer propertyComparerForType = null; if (mPropertyComparers.ContainsKey(targetType)) { // There is a PropertyComparer for this exact type propertyComparerForType = mPropertyComparers[targetType]; } else { // There isn't a PropertyComparer for this exact type, so climb up the inheritance tree foreach (PropertyComparer pc in mPropertyComparers.Values) { if (pc.GenericType.IsAssignableFrom(targetType)) { propertyComparerForType = pc; break; } } } // If there's no PropertyComparer, then the app might be a UI-only app. If that's // the case, we don't want to run afterUpdateDelegates if (propertyComparerForType != null) { AfterUpdateDelegate afterUpdateDelegate = propertyComparerForType.GetAfterUpdateDelegateForMember(asGenericInstruction.Member); if (afterUpdateDelegate != null) { afterUpdateDelegate(asGenericInstruction.Target); } } } instruction.Execute(); } mInstructions.RemoveAt(mInstructions.Count - 1); } #endregion // Vic says that this will break if undos are added through this and through // the property comparers in the same frame. if (mUndosAddedThisFrame.Count != 0) { mInstructions.Add(mUndosAddedThisFrame); mUndosAddedThisFrame = new InstructionList(); } }