예제 #1
0
        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);
        }
예제 #2
0
        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();
                }
            }
        }