| | |
| | | } |
| | | } |
| | | |
| | | //额外添加父红点用 |
| | | public void AddParent(int _parentId, int _childId) |
| | | { |
| | | Redpoint child = null; |
| | | if (!redpoints.TryGetValue(_childId, out child)) |
| | | { |
| | | Debug.LogErrorFormat("添加父子关系失败,子节点不存在:id->{0}", _childId); |
| | | return; |
| | | } |
| | | |
| | | child.otherParent = _parentId; |
| | | |
| | | List<int> children = null; |
| | | if (!parentChildren.TryGetValue(_parentId, out children)) |
| | | { |
| | | parentChildren[_parentId] = children = new List<int>(); |
| | | } |
| | | |
| | | if (!children.Contains(_childId)) |
| | | { |
| | | children.Add(_childId); |
| | | } |
| | | } |
| | | |
| | | public void Report(Redpoint _redpoint) |
| | | { |
| | | var parentId = _redpoint.parent; |
| | | |
| | | if (redpointValueChangeEvent != null) |
| | | { |
| | | redpointValueChangeEvent(_redpoint.id); |
| | | } |
| | | |
| | | if (parentId > 0) |
| | | if (_redpoint.parent > 0) |
| | | { |
| | | TestParentValue(_redpoint.parent); |
| | | } |
| | | |
| | | if (_redpoint.otherParent > 0) |
| | | { |
| | | TestParentValue(_redpoint.otherParent); |
| | | } |
| | | } |
| | | |
| | | public void ReportWithoutParent(Redpoint _redpoint) |