public bool RemoveModifiers(SpellLineModifiers modifiers) { if (modifiers == null) { throw new ArgumentNullException("modifiers"); } SpellLineModifiers removedModifiers = null; foreach (var modifier in lineModifiers) { if (modifier == modifiers) { removedModifiers = modifier; break; } } var wasRemoved = lineModifiers.Remove(modifiers); if (removedModifiers != null && wasRemoved) { OnModifiersRemoved(removedModifiers); } return(wasRemoved); }
public void AddModifiers(SpellLineModifiers modifiers) { if (modifiers == null) throw new ArgumentNullException("modifiers"); lineModifiers.Add(modifiers); OnModifiersAdded(modifiers); }
public void CopyTo(SpellLineModifiers other) { other.Action = Action; other.Scope = Scope; other.ScopeName = ScopeName; other.Value = Value; other.MinThreshold = MinThreshold; other.MaxThreshold = MaxThreshold; }
public void AddModifiers(SpellLineModifiers modifiers) { if (modifiers == null) { throw new ArgumentNullException("modifiers"); } lineModifiers.Add(modifiers); OnModifiersAdded(modifiers); }
void OnStaffModifiersChanged(StaffMetadata staff, SpellLineModifiers modifiers) { RecalculateAllSpells(staff); var handler = StaffModifiersChanged; if (handler != null) { handler(staff, new SpellLineModifiersEventArgs(modifiers)); } }
public LineModifiersEditorWindow(SpellLineModifiers modifiers, bool isEditMode = true) : this() { actionComboBox.SelectedItem = modifiers.Action; scopeComboBox.SelectedItem = modifiers.Scope; scopeNameTextBox.Text = modifiers.ScopeName; valueUpDown.Value = modifiers.Value; minThresholdUpDown.Value = modifiers.MinThreshold; maxThresholdUpDown.Value = modifiers.MaxThreshold; this.IsEditMode = isEditMode; if (this.IsEditMode) this.Title = "Edit Modifiers"; }
public void ChangeModifiers(SpellLineModifiers target, SpellLineModifiers source) { source.CopyTo(target); OnModifiersChanged(target); }
void OnModifiersRemoved(SpellLineModifiers modifiers) { ModifiersRemoved?.Invoke(this, new SpellLineModifiersEventArgs(modifiers)); }
public SpellLineModifiersEventArgs(SpellLineModifiers modifiers) { this.modifiers = modifiers; }
void OnStaffModifiersChanged(StaffMetadata staff, SpellLineModifiers modifiers) { RecalculateAllSpells(staff); var handler = StaffModifiersChanged; if (handler != null) handler(staff, new SpellLineModifiersEventArgs(modifiers)); }
void EditModifiers(StaffMetadata staff, SpellLineModifiers modifiers) { var modifiersWindow = new LineModifiersEditorWindow(modifiers); modifiersWindow.Owner = this; var result = modifiersWindow.ShowDialog(); if (!result.HasValue || !result.Value) return; staff.ChangeModifiers(modifiers, modifiersWindow.Modifiers); lineModifiersListBox.Items.Refresh(); lineModifiersListBox.SelectedItem = modifiers; lineModifiersListBox.ScrollIntoView(modifiers); }
bool RemoveModifiers(SpellLineModifiers modifiers) { var staff = stavesListBox.SelectedItem as StaffMetadata; if (staff == null) return false; var wasRemoved = staff.RemoveModifiers(modifiers); if (wasRemoved) lineModifiersListBox.Items.Refresh(); return wasRemoved; }
public bool RemoveModifiers(SpellLineModifiers modifiers) { if (modifiers == null) throw new ArgumentNullException("modifiers"); SpellLineModifiers removedModifiers = null; foreach (var modifier in lineModifiers) if (modifier == modifiers) { removedModifiers = modifier; break; } var wasRemoved = lineModifiers.Remove(modifiers); if (removedModifiers != null && wasRemoved) OnModifiersRemoved(removedModifiers); return wasRemoved; }