Exemplo n.º 1
0
        public static bool UnregisterAttributeChangedHandler(string attributeKey, BnetParty.PartyAttributeChangedHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            if (BnetParty.s_attributeChangedSubscribers == null)
            {
                return(false);
            }
            List <BnetParty.PartyAttributeChangedHandler> list = null;

            return(BnetParty.s_attributeChangedSubscribers.TryGetValue(attributeKey, out list) && list.Remove(handler));
        }
Exemplo n.º 2
0
        public static void RegisterAttributeChangedHandler(string attributeKey, BnetParty.PartyAttributeChangedHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            if (BnetParty.s_attributeChangedSubscribers == null)
            {
                BnetParty.s_attributeChangedSubscribers = new Map <string, List <BnetParty.PartyAttributeChangedHandler> >();
            }
            List <BnetParty.PartyAttributeChangedHandler> list;

            if (!BnetParty.s_attributeChangedSubscribers.TryGetValue(attributeKey, out list))
            {
                list = new List <BnetParty.PartyAttributeChangedHandler>();
                BnetParty.s_attributeChangedSubscribers[attributeKey] = list;
            }
            if (!list.Contains(handler))
            {
                list.Add(handler);
            }
        }