Esempio n. 1
0
        public void AddEvent(long entity_id, int event_id, long handler_id)
        {
            SoulProxy soul;

            if (!_Souls.TryGetValue(entity_id, out soul))
            {
                return;
            }

            EventInfo eventInfo = _Protocol.GetMemberMap().GetEvent(event_id);

            if (eventInfo == null)
            {
                return;
            }
            if (!soul.Is(eventInfo.DeclaringType))
            {
                return;
            }

            Delegate del = _BuildDelegate(eventInfo, soul.Id, handler_id, _InvokeEvent);

            var handler = new SoulProxyEventHandler(soul.ObjectInstance, del, eventInfo, handler_id);

            soul.AddEvent(handler);
        }
Esempio n. 2
0
        internal void RemoveEvent(EventInfo eventInfo, long handler_id)
        {
            lock (_EventHandlers)
            {
                SoulProxyEventHandler eventHandler = _EventHandlers.FirstOrDefault(eh => eh.HandlerId == handler_id && eh.EventInfo == eventInfo);

                _EventHandlers.Remove(eventHandler);

                eventHandler.Release();
            }
        }
Esempio n. 3
0
 internal void AddEvent(SoulProxyEventHandler handler)
 {
     lock (_EventHandlers)
         _EventHandlers.Add(handler);
 }