Example #1
0
 public void AddEventListener(Event e, EventHandler handler)
 {
     if (!EventDictionary.ContainsKey(e))
     {
         EventDictionary.Add(e, handler);
     }
 }
Example #2
0
        public Equipment()
        {
            EquipmentList = new EventDictionary<EquipmentSlot, Armor>();

            foreach (EquipmentSlot slot in EnumUtils.GetValues<EquipmentSlot>())
            {
                EquipmentList.Add(slot, null);
            }
        }
Example #3
0
        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);
        }
Example #4
0
        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);
 }
Example #6
0
 /// <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);
 }