public void AddEventListener(Event e, EventHandler handler) { if (!EventDictionary.ContainsKey(e)) { EventDictionary.Add(e, handler); } }
public Equipment() { EquipmentList = new EventDictionary<EquipmentSlot, Armor>(); foreach (EquipmentSlot slot in EnumUtils.GetValues<EquipmentSlot>()) { EquipmentList.Add(slot, null); } }
internal void Register(FlowEvent e) { if (_eventsByKey.ContainsKey(e.EventType.Key)) { throw new Exception(Text.Of("Event {0} is already registered", e.EventType.Key)); } _eventsByKey.Add(e.EventType.Key, e); _eventsByDeclaredType.Add(e.EventType.DeclaredType, e); }
public StateInstance this[StateIdentifier identifier] { get { if (Stats == null) { return(null); } if (!States.TryGetValue(identifier, out var instance)) { var template = traitContext.States[identifier]; instance = template.CreateInstance(identifier); States.Add(identifier, instance); } return(instance); } }
public void Subscribe(string eventName, OnEventFired onEventFired) { AmeisenBotLogger.Instance.Log($"[{WowActionExecutor.ProcessId.ToString("X", CultureInfo.InvariantCulture.NumberFormat)}]\tSubscribed to \"{eventName}\""); WowActionExecutor.LuaDoString($"abFrame:RegisterEvent(\"{eventName}\");"); EventDictionary.Add(eventName, onEventFired); }
/// <summary> /// Subscribe to an event /// </summary> /// <param name="eventName">event name</param> /// <param name="onEventFired">method to fire when the event appered in WoW</param> public void Subscribe(string eventName, OnEventFired onEventFired) { AmeisenCore.LuaDoString($"abFrame:RegisterEvent(\"{eventName}\");"); EventDictionary.Add(eventName, onEventFired); }