override public void checkAndUpdateDependences(List <Trait> previouslyBoundVars, StoryData world) { PlotFragment parentFrag = world.findPlotFragmentById(_parentPlotFragmentId); if (parentFrag == null) { throw new Exception("Delete Object Action not have parent Plot Fragment"); } //check for variables bound to object references List <string> names = null; if (_entityTypeId == world.CharTypeId) { names = parentFrag.getPreviouslyBoundCharacterVarNames(this); } else if (_entityTypeId == world.EnvTypeId) { names = parentFrag.getPreviouslyBoundEnvironmentVarNames(this); } else { PlotPointType currType = world.findPlotPointTypeById(_entityTypeId); if (currType != null) { names = parentFrag.getPreviouslyBoundPlotPointTypeVarNames(currType, this); } } if (!(names.Contains(_varNameForDeletion))) { throw new Exception("Delete Object Action in Plot Fragment \"" + parentFrag.Name + "\" refers to variable \"" + _varNameForDeletion + "\", \nwhich has a different type or does not exist in any previous Author Goal parameters, precondition statements, or actions ."); } //check for any previous deletions of this variable - that would be BAD because another //deletion would cause this to fail in ABL foreach (Action act in parentFrag.Actions) { if (act is ActionDeleteEntity) { if ((act != this) && (((ActionDeleteEntity)act).VariableName == _varNameForDeletion) ) { throw new Exception("The Plot Fragment \"" + parentFrag.Name + "\" deletes the object saved in the variable \"" + _varNameForDeletion + "\" more than once, which is not allowed. ."); } } } return; }
private void btNewAction_Click(object sender, RoutedEventArgs e) { List <string> editChoices = new List <string>(); editChoices.Add("Output Text"); editChoices.Add("Pursue a Subgoal"); editChoices.Add("Make a Calculation"); editChoices.Add("Create a new Character/Environment/Plot Point"); editChoices.Add("Edit a saved Character/Environment/Plot Point"); editChoices.Add("Delete a saved Character/Environment/Plot Point"); int result = -1; result = Utilities.MakeListChoiceDialog("What type of Action would you like to create?", editChoices, this); if (result < 0) { return; } else if (result == 0) //Output Text { ActionTextOutput newTextOutputAction = new ActionTextOutput(_currentEntity.Id, "", _currentStoryData); _currentEntity.Actions.Add(newTextOutputAction); Window newWin = new WindowActionTextOutput(_currentEntity, newTextOutputAction); newWin.Owner = this; newWin.ShowDialog(); } else if (result == 1) //Pursue Subgoal { List <string> choiceList = new List <string>(); foreach (AuthorGoal goal in _currentStoryData.AuthorGoals) { choiceList.Add(goal.Description); } result = Utilities.MakeListChoiceDialog("Select an Author Goal to pursue", choiceList, this); if (result > -1) { AuthorGoal goalToPursue = _currentStoryData.AuthorGoals[result]; ActionSubgoal newAction = new ActionSubgoal(_currentEntity.Id, goalToPursue.Id, _currentStoryData); _currentEntity.Actions.Add(newAction); if (goalToPursue.Parameters.Count > 0) { Window newWin = new WindowActionSubgoalEditor(false, _currentEntity, newAction, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } } } else if (result == 2) //Make a calculation { Action nullAction = null; List <string> existingVarNames = _currentEntity.getAllPreviouslyBoundVariableNames(nullAction, true); string varName = Utilities.MakeConstrainedTextDialog( "Please enter a name for the variable that will store the data in this calculation:", "That variable name has already been used.", existingVarNames, this); if (varName != null) { ActionCalculation newCalc = new ActionCalculation(_currentEntity.Id, varName, _currentStoryData); _currentEntity.Actions.Add(newCalc); Window newWin = new WindowActionCalculationEditor(_currentEntity, newCalc, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } } else if (result == 3) //Create a new object { List <string> newObjectChoices = new List <string>(); newObjectChoices.Add("Character"); newObjectChoices.Add("Environment"); foreach (PlotPointType pp in _currentStoryData.PlotPointTypes) { newObjectChoices.Add(pp.Description); } int resultCreateObject = Utilities.MakeListChoiceDialog("What type of object would you like to create?", newObjectChoices, this); if (resultCreateObject < 0) { return; } Action nullAction = null; List <string> existingVarNames = _currentEntity.getAllPreviouslyBoundVariableNames(nullAction, true); string varName = Utilities.MakeConstrainedTextDialog( "Please enter a name for the variable that will store your new Object", "That variable name has already been used.", existingVarNames, this); if (varName == null) { return; } if (resultCreateObject == 0) { string entityName = Utilities.MakeTextDialog("Please enter a name for the new Character:", this); if (entityName == null) { return; } ActionCreateCharacter newCreateEntityAction = new ActionCreateCharacter(_currentEntity.Id, entityName, varName, _currentStoryData); _currentEntity.Actions.Add(newCreateEntityAction); //Synchronize all traits and relationships if (_currentStoryData.Characters.Count > 1) { Utilities.SynchronizeTwoCharacters(_currentStoryData.Characters[0], newCreateEntityAction.NewCharacter, _currentStoryData); } clearDataBindings(); dataBind(); Window newWin = new WindowCharacterEditor(newCreateEntityAction.NewCharacter, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } else if (resultCreateObject == 1) { string entityName = Utilities.MakeTextDialog("Please enter a name for the new Environment:", this); if (entityName == null) { return; } ActionCreateEnvironment newCreateEntityAction = new ActionCreateEnvironment(_currentEntity.Id, entityName, varName, _currentStoryData); _currentEntity.Actions.Add(newCreateEntityAction); //Synchronize all traits and relationships if (_currentStoryData.Environments.Count > 1) { Utilities.SynchronizeTwoEnvironments(_currentStoryData.Environments[0], newCreateEntityAction.NewEnvironment, _currentStoryData); } clearDataBindings(); dataBind(); Window newWin = new WindowEnvironmentEditor(newCreateEntityAction.NewEnvironment, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } else { int plotPointIndex = resultCreateObject - 2; PlotPointType currType = _currentStoryData.PlotPointTypes[plotPointIndex]; ActionCreatePlotPoint newCreateEntityAction = new ActionCreatePlotPoint(_currentEntity.Id, currType, varName, _currentStoryData); _currentEntity.Actions.Add(newCreateEntityAction); clearDataBindings(); dataBind(); Window newWin = new WindowPlotPointEditor(newCreateEntityAction.NewPlotPoint, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } } else if (result == 4) //Edit a saved object { List <string> editObjectChoices = new List <string>(); editObjectChoices.Add("Character"); editObjectChoices.Add("Environment"); foreach (PlotPointType pp in _currentStoryData.PlotPointTypes) { editObjectChoices.Add(pp.Description); } int resultEditObject = Utilities.MakeListChoiceDialog("What type of object would you like to edit?", editObjectChoices, this); if (resultEditObject < 0) { return; } else if (resultEditObject == 0) //Edit character { List <string> editObjVarChoices = _currentEntity.getPreviouslyBoundCharacterVarNames(null); if (editObjVarChoices.Count == 0) { Utilities.MakeErrorDialog("There are no saved Character variables to edit", this); return; } int resultChooseEditTarget = Utilities.MakeListChoiceDialog( "What saved Character would you like to edit?", editObjVarChoices, this); if (resultChooseEditTarget < 0) { return; } ActionEditObject newEditObj = new ActionEditObject( _currentEntity.Id, editObjVarChoices[resultChooseEditTarget], _currentStoryData.CharTypeId, ObjectEditingMode.Trait, _currentStoryData); _currentEntity.Actions.Add(newEditObj); clearDataBindings(); dataBind(); Window newWin = new WindowActionEditEntity(_currentEntity, newEditObj, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } else if (resultEditObject == 1) //Edit Environment { List <string> editObjVarChoices = _currentEntity.getPreviouslyBoundEnvironmentVarNames(null); if (editObjVarChoices.Count == 0) { Utilities.MakeErrorDialog("There are no saved Environment variables to edit", this); return; } int resultChooseEditTarget = Utilities.MakeListChoiceDialog( "What saved Environment would you like to edit?", editObjVarChoices, this); if (resultChooseEditTarget < 0) { return; } ActionEditObject newEditObj = new ActionEditObject( _currentEntity.Id, editObjVarChoices[resultChooseEditTarget], _currentStoryData.EnvTypeId, ObjectEditingMode.Trait, _currentStoryData); _currentEntity.Actions.Add(newEditObj); clearDataBindings(); dataBind(); Window newWin = new WindowActionEditEntity(_currentEntity, newEditObj, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } else if (resultEditObject > 1) //Edit a Plot Point { int plotPointIndex = resultEditObject - 2; PlotPointType currType = _currentStoryData.PlotPointTypes[plotPointIndex]; if (currType.Traits.Count == 0) { Utilities.MakeErrorDialog("The " + currType.Description + " type has no traits to edit.", this); return; } List <string> editObjVarChoices = _currentEntity.getPreviouslyBoundPlotPointTypeVarNames(currType, null); if (editObjVarChoices.Count == 0) { Utilities.MakeErrorDialog("There are no saved " + currType.Description + " variables to edit", this); return; } int resultChooseEditTarget = Utilities.MakeListChoiceDialog( "What saved " + currType.Description + " would you like to edit?", editObjVarChoices, this); if (resultChooseEditTarget < 0) { return; } ActionEditObject newEditObj = new ActionEditObject( _currentEntity.Id, editObjVarChoices[resultChooseEditTarget], currType.Id, ObjectEditingMode.Trait, _currentStoryData); _currentEntity.Actions.Add(newEditObj); clearDataBindings(); dataBind(); Window newWin = new WindowActionEditEntity(_currentEntity, newEditObj, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } } else if (result == 5) //Delete a saved object { List <string> editObjectChoices = new List <string>(); editObjectChoices.Add("Character"); editObjectChoices.Add("Environment"); foreach (PlotPointType pp in _currentStoryData.PlotPointTypes) { editObjectChoices.Add("Plot Point: " + pp.Name); } int resultDelObject = Utilities.MakeListChoiceDialog("What type of object would you like to delete?", editObjectChoices, this); if (resultDelObject < 0) { return; } else if (resultDelObject == 0) //Delete character { List <string> deleteObjectChoices = _currentEntity.getPreviouslyBoundCharacterVarNames(null); if (deleteObjectChoices.Count == 0) { Utilities.MakeErrorDialog("There are no saved Character variables to delete", this); return; } int resultChooseDeletionTarget = Utilities.MakeListChoiceDialog( "What saved Character would you like to delete?", deleteObjectChoices, this); if (resultChooseDeletionTarget < 0) { return; } ActionDeleteEntity newDelEntity = new ActionDeleteEntity( _currentEntity.Id, deleteObjectChoices[resultChooseDeletionTarget], _currentStoryData.CharTypeId, _currentStoryData); _currentEntity.Actions.Add(newDelEntity); } else if (resultDelObject == 1) //Delete Environment { List <string> deleteObjectChoices = _currentEntity.getPreviouslyBoundEnvironmentVarNames(null); if (deleteObjectChoices.Count == 0) { Utilities.MakeErrorDialog("There are no saved Environment variables to delete", this); return; } int resultChooseDeletionTarget = Utilities.MakeListChoiceDialog( "What saved Environment would you like to delete?", deleteObjectChoices, this); if (resultChooseDeletionTarget < 0) { return; } ActionDeleteEntity newDelEntity = new ActionDeleteEntity( _currentEntity.Id, deleteObjectChoices[resultChooseDeletionTarget], _currentStoryData.EnvTypeId, _currentStoryData); _currentEntity.Actions.Add(newDelEntity); } else if (resultDelObject > 1) //Delete a Plot Point { int plotPointIndex = resultDelObject - 2; PlotPointType currType = _currentStoryData.PlotPointTypes[plotPointIndex]; List <string> deleteObjectChoices = _currentEntity.getPreviouslyBoundPlotPointTypeVarNames(currType, null); if (deleteObjectChoices.Count == 0) { Utilities.MakeErrorDialog("There are no saved " + currType.Description + " variables to delete", this); return; } int resultChooseDeletionTarget = Utilities.MakeListChoiceDialog( "What saved " + currType.Description + " would you like to delete?", deleteObjectChoices, this); if (resultChooseDeletionTarget < 0) { return; } ActionDeleteEntity newDelEntity = new ActionDeleteEntity( _currentEntity.Id, deleteObjectChoices[resultChooseDeletionTarget], currType.Id, _currentStoryData); _currentEntity.Actions.Add(newDelEntity); } } clearDataBindings(); dataBind(); }
private void dataBind() { _currentlyDataBinding = true; switch (_editingMode) { case 0: titleTextBlock.Text = "Edit Character: " + _currentEntity.VariableObjectName; break; case 1: titleTextBlock.Text = "Edit Environment: " + _currentEntity.VariableObjectName; break; case 2: titleTextBlock.Text = "Edit " + _ppType.Description + ": " + _currentEntity.VariableObjectName; break; } //Top combobox List <string> attributeOptions = new List <string>(); attributeOptions.Add("Edit Trait"); //Only add relationship editors if there relationships that can be edited if ((_editingMode == 0) && (Utilities.getGlobalCharacterList(_currentStoryData)[0].Relationships.Count > 0)) { attributeOptions.Add("Edit Relationship Target"); attributeOptions.Add("Edit Relationship Strength"); } else if ((_editingMode == 1) && (Utilities.getGlobalEnvironmentList(_currentStoryData)[0].Relationships.Count > 0)) { attributeOptions.Add("Edit Relationship Target"); attributeOptions.Add("Edit Relationship Strength"); } comboBoxTraitRelationship.ClearValue(ComboBox.ItemsSourceProperty); comboBoxTraitRelationship.Items.Clear(); comboBoxTraitRelationship.ItemsSource = attributeOptions; switch (_currentEntity.Mode) { case ObjectEditingMode.Trait: comboBoxTraitRelationship.SelectedIndex = 0; break; case ObjectEditingMode.RelationshipTarget: comboBoxTraitRelationship.SelectedIndex = 1; break; case ObjectEditingMode.RelationshipStrength: comboBoxTraitRelationship.SelectedIndex = 2; break; } //Left combobox if (_currentEntity.Mode == ObjectEditingMode.Trait) { if (_editingMode == 0) { comboBoxSelectTraitRel.ItemsSource = Utilities.getGlobalCharacterList(_currentStoryData)[0].Traits; } else if (_editingMode == 1) { comboBoxSelectTraitRel.ItemsSource = Utilities.getGlobalEnvironmentList(_currentStoryData)[0].Traits; } else if (_editingMode == 2) { comboBoxSelectTraitRel.ItemsSource = _ppType.Traits; } } else if (_currentEntity.Mode == ObjectEditingMode.RelationshipTarget) { if (_editingMode == 0) { // Using get GLOBAL list (includes not just static characters, but ones //created within plot fragments. This way the user doesn't need to //have created any static character lists to make plot fragment actions //that edit dynamically generated objects comboBoxSelectTraitRel.ItemsSource = Utilities.getGlobalCharacterList(_currentStoryData)[0].Relationships; } else if (_editingMode == 1) { comboBoxSelectTraitRel.ItemsSource = Utilities.getGlobalEnvironmentList(_currentStoryData)[0].Relationships; } } else if (_currentEntity.Mode == ObjectEditingMode.RelationshipStrength) { if (_editingMode == 0) { comboBoxSelectTraitRel.ItemsSource = Utilities.getGlobalCharacterList(_currentStoryData)[0].Relationships; } else if (_editingMode == 1) { comboBoxSelectTraitRel.ItemsSource = Utilities.getGlobalEnvironmentList(_currentStoryData)[0].Relationships; } } //checkbox if (_currentEntity.Mode == ObjectEditingMode.Trait) { checkBoxUseVariable.IsChecked = _currentEntity.NewValue.ValueIsBoundToVariable; } else if (_currentEntity.Mode == ObjectEditingMode.RelationshipTarget) { checkBoxUseVariable.IsChecked = _currentEntity.NewTarget.ValueIsBoundToVariable; } else if (_currentEntity.Mode == ObjectEditingMode.RelationshipStrength) { checkBoxUseVariable.IsChecked = _currentEntity.NewValue.ValueIsBoundToVariable; } //Value boxes if (_currentEntity.Mode == ObjectEditingMode.Trait) { if (_currentEntity.NewValue.ValueIsBoundToVariable) { textBoxTextInput.Visibility = Visibility.Hidden; txtBoxNumberInput.Visibility = Visibility.Hidden; comboBoxTrueFalse.Visibility = Visibility.Hidden; comboChoiceVariables.Visibility = Visibility.Visible; checkBoxUseVariable.Visibility = Visibility.Visible; //Data bind variable list comboChoiceVariables.ItemsSource = _parentPlotFragment.getPreviouslyBoundPrimitiveVariables(_currentEntity.NewValue.Type, false, _currentEntity); comboChoiceVariables.ItemTemplate = this.FindResource("comboBoxDataTemplate") as DataTemplate; } else { TraitDataType type = _currentEntity.NewValue.Type; if (type == TraitDataType.Number) { textBoxTextInput.Visibility = Visibility.Hidden; txtBoxNumberInput.Visibility = Visibility.Visible; comboBoxTrueFalse.Visibility = Visibility.Hidden; comboChoiceVariables.Visibility = Visibility.Hidden; //Only show checkbox if there are actual variables to select List <Trait> varList = _parentPlotFragment.getPreviouslyBoundPrimitiveVariables(_currentEntity.NewValue.Type, false, _currentEntity); if (varList.Count > 0) { checkBoxUseVariable.Visibility = Visibility.Visible; } else { checkBoxUseVariable.Visibility = Visibility.Hidden; } //Data bind Number txtBoxNumberInput.Value = (double)_currentEntity.NewValue.LiteralValueOrBoundVarName; } else if (type == TraitDataType.Text) { textBoxTextInput.Visibility = Visibility.Visible; txtBoxNumberInput.Visibility = Visibility.Hidden; comboBoxTrueFalse.Visibility = Visibility.Hidden; comboChoiceVariables.Visibility = Visibility.Hidden; //Only show checkbox if there are actual variables to select List <Trait> varList = _parentPlotFragment.getPreviouslyBoundPrimitiveVariables(_currentEntity.NewValue.Type, false, _currentEntity); if (varList.Count > 0) { checkBoxUseVariable.Visibility = Visibility.Visible; } else { checkBoxUseVariable.Visibility = Visibility.Hidden; } //Data bind text textBoxTextInput.Text = (string)_currentEntity.NewValue.LiteralValueOrBoundVarName; } else if (type == TraitDataType.TrueFalse) { textBoxTextInput.Visibility = Visibility.Hidden; txtBoxNumberInput.Visibility = Visibility.Hidden; comboBoxTrueFalse.Visibility = Visibility.Visible; comboChoiceVariables.Visibility = Visibility.Hidden; //Only show checkbox if there are actual variables to select List <Trait> varList = _parentPlotFragment.getPreviouslyBoundPrimitiveVariables(_currentEntity.NewValue.Type, false, _currentEntity); if (varList.Count > 0) { checkBoxUseVariable.Visibility = Visibility.Visible; } else { checkBoxUseVariable.Visibility = Visibility.Hidden; } //Data bind true/false comboBoxTrueFalse.SelectedIndex = ((bool)_currentEntity.NewValue.LiteralValueOrBoundVarName) ? 0 : 1; } } } else if (_currentEntity.Mode == ObjectEditingMode.RelationshipTarget) { textBoxTextInput.Visibility = Visibility.Hidden; txtBoxNumberInput.Visibility = Visibility.Hidden; comboBoxTrueFalse.Visibility = Visibility.Hidden; comboChoiceVariables.Visibility = Visibility.Visible; checkBoxUseVariable.Visibility = Visibility.Hidden; //Data bind variable list if (_editingMode == 0) { comboChoiceVariables.ItemsSource = _parentPlotFragment.getPreviouslyBoundCharacterVarNames(_currentEntity); comboChoiceVariables.ItemTemplate = this.FindResource("comboBoxDataTemplateString") as DataTemplate; } else if (_editingMode == 1) { comboChoiceVariables.ItemsSource = _parentPlotFragment.getPreviouslyBoundEnvironmentVarNames(_currentEntity); comboChoiceVariables.ItemTemplate = this.FindResource("comboBoxDataTemplateString") as DataTemplate; } } else if (_currentEntity.Mode == ObjectEditingMode.RelationshipStrength) { if (_currentEntity.NewValue.ValueIsBoundToVariable) { textBoxTextInput.Visibility = Visibility.Hidden; txtBoxNumberInput.Visibility = Visibility.Hidden; comboBoxTrueFalse.Visibility = Visibility.Hidden; comboChoiceVariables.Visibility = Visibility.Visible; checkBoxUseVariable.Visibility = Visibility.Visible; //Data bind variable list comboChoiceVariables.ItemsSource = _parentPlotFragment.getPreviouslyBoundPrimitiveVariables(_currentEntity.NewValue.Type, false, _currentEntity); comboChoiceVariables.ItemTemplate = this.FindResource("comboBoxDataTemplate") as DataTemplate; } else { textBoxTextInput.Visibility = Visibility.Hidden; txtBoxNumberInput.Visibility = Visibility.Visible; comboBoxTrueFalse.Visibility = Visibility.Hidden; comboChoiceVariables.Visibility = Visibility.Hidden; //Only show checkbox if there are actual variables to select List <Trait> varList = _parentPlotFragment.getPreviouslyBoundPrimitiveVariables(_currentEntity.NewValue.Type, false, _currentEntity); if (varList.Count > 0) { checkBoxUseVariable.Visibility = Visibility.Visible; } else { checkBoxUseVariable.Visibility = Visibility.Hidden; } //Data bind Number txtBoxNumberInput.Value = (double)_currentEntity.NewValue.LiteralValueOrBoundVarName; } } syncDataBoundComboBoxes(); _currentlyDataBinding = false; }
override public void checkAndUpdateDependences(List <Trait> previouslyBoundVars, StoryData world) { PlotFragment parentFrag = world.findPlotFragmentById(_parentPlotFragmentId); if (parentFrag == null) { throw new Exception("Delete Object Action not have parent Plot Fragment"); } //check for variables bound to object references List <string> names = null; string objectTypeString = ""; if (_varObjectTypeId == world.CharTypeId) { names = parentFrag.getPreviouslyBoundCharacterVarNames(this); objectTypeString = "Character"; } else if (_varObjectTypeId == world.EnvTypeId) { names = parentFrag.getPreviouslyBoundEnvironmentVarNames(this); objectTypeString = "Environment"; } else { PlotPointType currType = world.findPlotPointTypeById(_varObjectTypeId); if (currType != null) { names = parentFrag.getPreviouslyBoundPlotPointTypeVarNames(currType, this); objectTypeString = currType.Description; } else { throw new Exception("Edit Plot Point Action in Plot Fragment \"" + parentFrag.Name + "\" " + "uses a Plot Point Type which no longer exists."); } } if (!(names.Contains(_varObjectName))) { throw new Exception("Edit Object Action in Plot Fragment \"" + parentFrag.Name + "\" refers to saved " + objectTypeString + " \"" + _varObjectName + "\", \nwhich has a different type or does not exist in any previous Author Goal parameters, precondition statements, or actions ."); } //make sure variable for relationship target edit exists if ((_mode == ObjectEditingMode.RelationshipTarget) && !(names.Contains((string)_newTarget.LiteralValueOrBoundVarName))) { throw new Exception("Edit Object Action in Plot Fragment \"" + parentFrag.Name + "\" refers to saved " + objectTypeString + " \"" + (string)_newTarget.LiteralValueOrBoundVarName + "\", \nwhich has a different type or does not exist in any previous Author Goal parameters, precondition statements, or actions ."); } //Check for bound primitive variables when saving trait or relationship strength if ( ((_mode == ObjectEditingMode.RelationshipStrength) || (_mode == ObjectEditingMode.Trait)) && (_newValue.ValueIsBoundToVariable == true) ) { bool foundIt = false; foreach (Trait traitItem in previouslyBoundVars) { if ( (traitItem.Name == (string)_newValue.LiteralValueOrBoundVarName) && (traitItem.Type == _newValue.Type) ) { foundIt = true; break; } } if (!foundIt) { throw new Exception("Edit Object Action in Plot Fragment \"" + parentFrag.Name + "\" refers to variable \"" + (string)_newValue.LiteralValueOrBoundVarName + "\", \nwhich has a different type or does not exist in any previous Author Goal parameters, precondition statements, or actions ."); } } //Check to make sure all trait or relationships exist on the object to be edited List <Trait> traitListToCompare = new List <Trait>(); List <Relationship> relListToCompare = new List <Relationship>(); if (_varObjectTypeId == world.CharTypeId) { if (world.Characters.Count > 0) { traitListToCompare = world.Characters[0].Traits; relListToCompare = world.Characters[0].Relationships; } } else if (_varObjectTypeId == world.EnvTypeId) { if (world.Environments.Count > 0) { traitListToCompare = world.Environments[0].Traits; relListToCompare = world.Environments[0].Relationships; } } else { PlotPointType currType = world.findPlotPointTypeById(_varObjectTypeId); if (currType != null) { traitListToCompare = currType.Traits; } else { throw new Exception("Edit Object Action in Plot Fragment \"" + parentFrag.Name + "\" refers to a Plot Point type that no longer exists."); } } if (_mode == ObjectEditingMode.Trait) { //look for trait we are editing if (null == Utilities.findTraitByNameAndType(traitListToCompare, _newValue.Name, _newValue.Type)) { throw new Exception("Edit Object Action in Plot Fragment \"" + parentFrag.Name + "\" refers to a trait with name \"" + _newValue.Name + "\" and type \"" + Trait.TraitDataTypeToString(_newValue.Type) + "\" that no longer exists."); } } else { //look for relationship we are editing if (null == Utilities.findRelationshipByName(relListToCompare, _newValue.Name)) { throw new Exception("Edit Object Action in Plot Fragment \"" + parentFrag.Name + "\" refers to a relationship with name \"" + _newValue.Name + " that no longer exists."); } } //No new variables to add to the binding list, so we can just exit after all the error checks }