void UpdateParentValue(int parentId) { List <int> children = null; Redpoint parent = null; if (redpoints.TryGetValue(parentId, out parent) && parentChildren.TryGetValue(parentId, out children)) { var parentState = RedPointState.None; foreach (var item in children) { Redpoint child = null; if (redpoints.TryGetValue(item, out child)) { if (child.state.value > parentState) { parentState = child.state.value; } } if (parentState == RedPointState.Full) { break; } } parent.SetState(parentState); } }
public void Register(int parent, int id) { if (redpoints.ContainsKey(id)) { return; } var redpoint = new Redpoint(id); redpoints[id] = redpoint; if (parent > 0) { List <int> children = null; if (!parentChildren.TryGetValue(parent, out children)) { parentChildren[parent] = children = new List <int>(); } if (!children.Contains(id)) { children.Add(id); } } }
public void Register(int id) { if (redpoints.ContainsKey(id)) { return; } var redpoint = new Redpoint(id); redpoints[id] = redpoint; }
public EnumProperty <RedPointState> GetRedpointState(int id) { Redpoint redpoint = null; if (this.redpoints.TryGetValue(id, out redpoint)) { return(redpoint.state); } else { return(null); } }
public IntProperty GetRedpointCount(int id) { Redpoint redpoint = null; if (this.redpoints.TryGetValue(id, out redpoint)) { return(redpoint.count); } else { return(null); } }