private void OnEditEffect(object parameter) { if (parameter == null || !CanEditEffect(parameter)) { return; } var effect = (EffectWrapper)parameter; var dialog = new EffectEditorDialog { EffectToEdit = (EffectWrapper)(effect).Clone(), EffectsSource = m_effects ?? (m_effects = ObjectDataManager.Instance.EnumerateObjects <EffectRecord>().ToList()) }; if (dialog.ShowDialog() != true) { return; } var index = Item.WrappedEffects.IndexOf(effect); Item.WrappedEffects.Remove(effect); Item.WrappedEffects.Insert(index, dialog.EffectToEdit); }
private void OnAddEffect(object parameter) { var dialog = new EffectEditorDialog { EffectsSource = m_effects ?? (m_effects = ObjectDataManager.Instance.EnumerateObjects <EffectRecord>().ToList()) }; var effect = new EffectDiceWrapper(new EffectInstanceDice() { EffectId = (uint)m_effects.First().Id }); dialog.EffectToEdit = effect; if (dialog.ShowDialog() == true) { Item.WrappedEffects.Add(dialog.EffectToEdit); } }