/// <summary> /// Clear the currently selected list. /// </summary> private void ClearActions() { // If the user has not selected a list... if (SelectedList == null) { // If they've selected an ability, use the list containing that ability. if (SelectedAbility != null) { SelectedList = FindListContainingAbility(SelectedAbility); } } // If they've selected a list or we've found a list containing an ability... if (SelectedList != null) { // Remove all list items. SelectedList.Actions.Clear(); // Ensure there is atleast one ability. KeepOne(); } }
/// <summary> /// Remove an move from the currently selected list. /// </summary> private void DeleteAction() { // Check if the user has selected an ability, do nothing if not. if (SelectedAbility != null) { // Get the list with the selected ability in it. if (SelectedList == null) { SelectedList = FindListContainingAbility(SelectedAbility); } // Remove the selected item from the list. if (SelectedList != null) { // Removed the selected ability. SelectedList.Actions.Remove(SelectedAbility); // Ensure there is atleast one ability. KeepOne(); } } }
/// <summary> /// Add an move to the currently selected list. /// </summary> private void AddAction() { // Check to see if an ability is selected. If so, find the list with which to add the // new ability under. if (SelectedAbility != null) { SelectedList = FindListContainingAbility(SelectedAbility); } // Now, if the user has either selected an ability or a list, // add the new ability. if (SelectedList != null) { var action = new BattleAbility(); SelectedList.Actions.Add(action); } }