/// <summary> /// 注册红点; /// </summary> /// <param name="redDotType"></param> /// <param name="item"></param> public void RegisterRedDot(List <RedDotType> redDotTypes, RedDotItem item) { for (int i = 0; i < redDotTypes.Count; i++) { RegisterRedDot(redDotTypes[i], item); } }
/// <summary> /// 取消注册红点; /// </summary> /// <param name="item"></param> public void UnRegisterRedDot(RedDotItem item) { Dictionary <RedDotType, List <RedDotItem> > .Enumerator itor = RedDotObjDict.GetEnumerator(); while (itor.MoveNext()) { List <RedDotItem> redDotItems = itor.Current.Value; if (redDotItems.Contains(item)) { redDotItems.Remove(item); break; } } }
/// <summary> /// 添加红点界面; /// </summary> /// <param name="redDotType"></param> /// <param name="item"></param> private void RegisterRedDot(RedDotType redDotType, RedDotItem item) { if (RedDotObjDict.ContainsKey(redDotType)) { RedDotObjDict[redDotType].Add(item); } else { List <RedDotItem> items = new List <RedDotItem>(); items.Add(item); RedDotObjDict.Add(redDotType, items); } }
/// <summary> /// 更新该类型的所有红点组件; /// </summary> /// <param name="redDotType"></param> /// <returns></returns> public void NotifyAll(RedDotType redDotType, object[] objs = null) { if (RedDotObjDict.ContainsKey(redDotType)) { for (int i = 0; i < RedDotObjDict[redDotType].Count; i++) { RedDotItem item = RedDotObjDict[redDotType][i]; if (item != null) { List <RedDotType> redDotTypes = item.GetRedDotTypes(); bool bCheck = Check(redDotTypes, objs); item.SetData(bCheck); } } } }