private void btAddNew_Click(object sender, RoutedEventArgs e) { if(_currentStoryData.AuthorGoals.Count == 0) { Utilities.MakeErrorDialog("There must be at least one Author Goal in this story for you to make a new Interactive Action.", this); return; } interactionsDataGrid.EndEdit(); string newName = Utilities.MakeTextDialog("Please enter a title for this new Interactive Action:", this); if (newName != null) { List<string> goalChoices = new List<string>(); //Get author goal to activate foreach (AuthorGoal goal in _currentStoryData.AuthorGoals) { goalChoices.Add(goal.Description); } int result = Utilities.MakeListChoiceDialog("Choose the Author Goal you would like to activate for this Interactive Action.", goalChoices, this); if (result < 0) { return; } AuthorGoal authorGoalSelection = _currentStoryData.AuthorGoals[result]; ActionSubgoal newSubGoal = new ActionSubgoal(0, authorGoalSelection.Id, _currentStoryData); Interaction newInteraction = new Interaction(newName, newSubGoal, _currentStoryData); _currentStoryData.Interactions.Add(newInteraction); dataBind(); WindowActionSubgoalEditor newWin = new WindowActionSubgoalEditor(true, null, newSubGoal, _currentStoryData); newWin.Owner = this; newWin.ShowDialog(); } }
public void checkAndUpdateDependencesAsInteraction(Interaction parentInteraction, List<Trait> previouslyBoundVars, StoryData world) { AuthorGoal goalToPursue = world.findAuthorGoalById(_subGoalId); if (goalToPursue == null) { //clear out parameter list _parametersToPass.Clear(); throw new Exception("Interaction \"" + parentInteraction.Title + "\" refers to an Author Goal which does not exist."); } if (goalToPursue.PlotFragments.Count == 0) { throw new Exception("Interaction \"" + parentInteraction.Title + "\" refers to an Author Goal which has no child plot fragments that fulfill it." + "\nAll Interactions must have at least one Plot Fragment associated with the goal they pursue before generation can begin."); } bool dataUpdated = syncParametersWithSubgoal(); if (dataUpdated) { throw new Exception("Interaction \"" + parentInteraction.Title + "\" refers to an Author Goal that has had its parameters changed.\n" + "Wide Ruled has corrected the changes, but you should look at the Interaction to make sure the newly updated parameters have the correct value."); } }