public void AddListener(TriggerEvent2 trigger) { if (trigger == null) { return; } ETriggerType2 typeID = trigger.TypeID; int eventID = trigger.EventID; if (!this.tMap.ContainsKey(typeID)) { this.tMap.Add(typeID, new Dictionary <int, Dictionary <string, TriggerEvent2> >()); if (!this.tMap.ContainsKey(typeID)) { throw new InsufficientMemoryException(); } } if (!this.tMap[typeID].ContainsKey(eventID)) { this.tMap[typeID].Add(eventID, new Dictionary <string, TriggerEvent2>()); if (!this.tMap[typeID].ContainsKey(eventID)) { throw new InsufficientMemoryException(); } } if (!this.tMap[typeID][eventID].ContainsKey(trigger.TriggerID)) { this.tMap[typeID][eventID].Add(trigger.TriggerID, trigger); } }
public void RemoveListner(TriggerEvent2 trigger) { if (trigger == null) { return; } ETriggerType2 typeID = trigger.TypeID; int eventID = trigger.EventID; string triggerID = trigger.TriggerID; if (this.tMap.ContainsKey(typeID) && this.tMap[typeID].ContainsKey(eventID) && this.tMap[typeID][eventID].ContainsKey(triggerID)) { this.tMap[typeID][eventID].Remove(triggerID); } }
public static TriggerEvent2 CreateTriggerEvent2(ITriggerCreatorParam param) { TriggerEvent2 result = null; try { Type type = Type.GetType("Assets.MobaTools.TriggerPlugin.Scripts." + param.TypeID.ToString()); object obj = Activator.CreateInstance(type, new object[] { param }); if (obj != null) { result = (obj as TriggerEvent2); } } catch (Exception var_3_45) { result = null; } return(result); }