Exemple #1
0
        public void Remove(EventId <EventKeyType> eventId)
        {
            EventCallbackMgr <EventKeyType> cbMgr = null;

            if (m_eventCbMgrs.TryGetValue(eventId.key, out cbMgr))
            {
                cbMgr.RemoveCallback(eventId.idx);
            }
        }
Exemple #2
0
        public void Fire(EventKeyType eventKey, object param)
        {
            EventCallbackMgr <EventKeyType> cbMgr = null;

            if (m_eventCbMgrs.TryGetValue(eventKey, out cbMgr))
            {
                cbMgr.FireCallbacks(param);
            }
        }
Exemple #3
0
        protected EventId <EventKeyType> DoSubscribe(EventKeyType eventKey, EventCallback <EventKeyType> ecb)
        {
            EventCallbackMgr <EventKeyType> cbMgr = null;

            if (!m_eventCbMgrs.TryGetValue(eventKey, out cbMgr))
            {
                cbMgr = new EventCallbackMgr <EventKeyType>(eventKey);
                m_eventCbMgrs.Add(eventKey, cbMgr);
            }
            ulong eid = cbMgr.AddCallback(ecb);
            EventId <EventKeyType> ret = new EventId <EventKeyType>();

            ret.key = eventKey;
            ret.idx = eid;
            ret.mgr = new WeakReference(this);
            return(ret);
        }