public override void OnDelete(SuperListDragButton button) { bool deleteWorked = false; FunctorEditor f = button.Tag as FunctorEditor; if (f != null) { TriggerEffect effect = f.Tag as TriggerEffect; if (f != null) { if (ParentTriggerNamespace.DeleteEffect(Trigger, effect, EffectsOnFalse, true)) { base.OnDelete(button); deleteWorked = true; } } } if (deleteWorked == false) { CoreGlobals.getErrorManager().OnSimpleWarning("Error deleting effect."); } }
void mTriggerOutControlPoint_ControlPointRemoved(BasicControlPoint cp, IControlPoint other) { TriggerControl otherctrl = other.TagObject as TriggerControl; if (otherctrl != null) { bool onfalse = (cp.GetName() == "Effect.False") ? true : false; TriggerEffect toremove = null; if (onfalse == false) { foreach (TriggerEffect effect in Trigger.TriggerEffects.Effects) { if ((effect.Type == TriggerSystemMain.mTriggerDefinitions.GetDeactivateEffectName()) || (effect.Type == TriggerSystemMain.mTriggerDefinitions.GetActivateEffectName())) { TriggerValue val = ParentTriggerNamespace.GetValues()[effect.Parameter[0].ID]; if (val.Value == otherctrl.Trigger.ID.ToString()) { toremove = effect; } } } } if (onfalse == true) { foreach (TriggerEffect effect in Trigger.TriggerEffectsFalse.Effects) { if ((effect.Type == TriggerSystemMain.mTriggerDefinitions.GetDeactivateEffectName()) || (effect.Type == TriggerSystemMain.mTriggerDefinitions.GetActivateEffectName())) { TriggerValue val = ParentTriggerNamespace.GetValues()[effect.Parameter[0].ID]; if (val.Value == otherctrl.Trigger.ID.ToString()) { toremove = effect; } } } } if (toremove != null) { ParentTriggerNamespace.DeleteEffect(Trigger, toremove, onfalse); } } TemplateControl templateControl = other.TagObject as TemplateControl; if (templateControl != null) { string name = other.ToString(); BasicControlPoint othercp = other as BasicControlPoint; TriggersTemplateInputActionBinder targetBinder = templateControl.mInputActionCPs[othercp]; TriggerBindInfo toremove = null; string linkName = cp.Name; int linkID = this.Trigger.ID; foreach (TriggerBindInfo b in targetBinder.TargetIDs) { if ((b.LinkName == linkName) && (b.ID == linkID)) { toremove = b; } } if (toremove != null) { targetBinder.TargetIDs.Remove(toremove); } else { CoreGlobals.getErrorManager().LogErrorToNetwork("mTriggerOutControlPoint_ControlPointRemoved: error deleting template link"); } } }