/// <summary> /// Adds the observer. /// </summary> /// <param name="observer">Observer.</param> /// <param name="sel">selector.</param> /// <param name="name">nitification Name.</param> public void addObserver(object observer, MGNotificationSelector sel, string name) { if (observer == null || sel == null || name == null) { return; } List <MGNotificationSelector> selList = MGFoundtion.GetValue <string, List <MGNotificationSelector> >(this.nameHastable, name, null); if (selList == null) { selList = new List <MGNotificationSelector>(); } if (selList.Contains(sel)) { return; } selList.Add(sel); //Debug.Log("after add sel:"+selList.Count); MGFoundtion.AddOrPeplace <string, List <MGNotificationSelector> >(this.nameHastable, name, selList); Dictionary <string, List <MGNotificationSelector> > nameListDic = MGFoundtion.GetValue <object, Dictionary <string, List <MGNotificationSelector> > >(this.objcNamesSel, observer, null); if (nameListDic == null) { nameListDic = new Dictionary <string, List <MGNotificationSelector> >(); } List <MGNotificationSelector> obj_name_selList = MGFoundtion.GetValue <string, List <MGNotificationSelector> >(nameListDic, name, null); if (obj_name_selList == null) { obj_name_selList = new List <MGNotificationSelector>(); } obj_name_selList.Add(sel); MGFoundtion.AddOrPeplace <string, List <MGNotificationSelector> >(nameListDic, name, obj_name_selList); MGFoundtion.AddOrPeplace <object, Dictionary <string, List <MGNotificationSelector> > >(this.objcNamesSel, observer, nameListDic); //Debug.Log("objcNamesSel count:" + this.objcNamesSel.Count); }
/// <summary> /// Adds the observer. /// </summary> /// <param name="observer">Observer.</param> /// <param name="sel">selector.</param> /// <param name="name">nitification Name.</param> public void addObserver(object observer, MGNotificationSelector sel, string name) { }