public RedDotNode <RedDotData> Register(RedDotCallback <RedDotData> callback, params string[] args) { if (args == null || args.Length <= 0) { return(null); } if (callback == null) { return(null); } var node = GetTreeRoot().Create(args); node.callback += callback; node.callback?.Invoke(node.data); return(node); }
public void Unregister(RedDotCallback <RedDotData> callback, params string[] args) { if (args == null || args.Length <= 0) { return; } if (callback == null) { return; } var node = GetTreeRoot().Find(args); if (node != null) { node.callback -= callback; if (node.children.Count <= 0 && node.callback == null) { node.RemoveFromParent(); } } }