/// <summary> /// Add a new binding target /// </summary> /// <param name="cp">This(starting) control point</param> /// <param name="other">Target control point</param> void output_ControlPointConnected(BasicControlPoint cp, IControlPoint other) { if (other.Virtual == true) { return; } //set target value: TriggerControl t = other.TagObject as TriggerControl; TriggersTemplateOutputActionBinder outputbinder = mOutputActionCPs[cp]; if (t != null) { string name = cp.ToString(); if (mOutputActionCPs.ContainsKey(cp)) { TriggerBindInfo bindInfo = new TriggerBindInfo(); bindInfo.SetTarget(t.Trigger.ID, other.ToString()); outputbinder.TargetIDs.Add(bindInfo); return; } } TemplateControl templateControl = other.TagObject as TemplateControl; if (templateControl != null) { string name = other.ToString(); foreach (TriggersTemplateInputActionBinder inputBinder in templateControl.TriggerTemplateMapping.TriggerInputs) { if (inputBinder.Name == name) { foreach (TriggerBindInfo b in inputBinder.TargetIDs) { if (b.ID == templateControl.TriggerTemplateMapping.ID && b.LinkName == other.ToString()) { CoreGlobals.getErrorManager().OnSimpleWarning("can't bind. template is already bound to trigger. this is a bug"); return; } } TriggerBindInfo bindInfo = new TriggerBindInfo(); bindInfo.SetTarget(templateControl.TriggerTemplateMapping.ID, other.ToString()); outputbinder.TargetIDs.Add(bindInfo); return; } } } }
void mTriggerOutControlPoint_ControlPointConnected(BasicControlPoint cp, IControlPoint other) { //set target value: TriggerControl t = other.TagObject as TriggerControl; if (t != null) { string effectName = ""; if (other.GetName() == "Activate") { effectName = TriggerSystemMain.mTriggerDefinitions.GetActivateEffectName(); } if (other.GetName() == "Deactivate") { effectName = TriggerSystemMain.mTriggerDefinitions.GetDeactivateEffectName(); } TriggerEffect effect; Dictionary <int, TriggerValue> values; TriggerSystemMain.mTriggerDefinitions.GetTriggerEffect(effectName, out effect, out values); Dictionary <int, TriggerValue> .Enumerator it = values.GetEnumerator(); while (it.MoveNext()) { it.Current.Value.Value = t.Trigger.ID.ToString(); break; } int newID; bool onfalse = (cp.GetName() == "Effect.False")?true:false; ParentTriggerNamespace.InsertEffect(Trigger.ID, effect, values, onfalse, out newID); return;//Finished } //else.. template object TemplateControl templateControl = other.TagObject as TemplateControl; if (templateControl != null) { string name = other.ToString(); foreach (TriggersTemplateInputActionBinder binder in templateControl.TriggerTemplateMapping.TriggerInputs) { if (binder.Name == name) { foreach (TriggerBindInfo b in binder.TargetIDs) { if (b.ID == templateControl.TriggerTemplateMapping.ID && b.LinkName == other.ToString()) { CoreGlobals.getErrorManager().OnSimpleWarning("can't bind. template is already bound to trigger. this is a bug"); return; } } TriggerBindInfo bindInfo = new TriggerBindInfo(); bindInfo.SetTarget(this.Trigger.ID, cp.ToString()); binder.TargetIDs.Add(bindInfo); return; } } } }