Example #1
0
        public void Remove(ClickUIBranch branch)
        {
            var branches = GetAllBranchesFrom(branch);

            foreach (var b in branches)
            {
                _branches.Remove(b);
                b.Unsubscribe(subscribeAction);
            }
        }
Example #2
0
        public void Add(ClickUIBranch branch)
        {
            var branches = GetAllBranchesFrom(branch);

            foreach (var b in branches)
            {
                _branches.Add(b);
                b.Subscribe(subscribeAction);
            }
            _branches = _branches.OrderBy((b) => b.Priority).Reverse().ToList();
        }
Example #3
0
        private List <ClickUIBranch> GetAllBranchesFrom(ClickUIBranch branch)
        {
            var branches = new List <ClickUIBranch> {
                branch
            };

            foreach (ClickUIBranch subBranch in branch.SubBranches())
            {
                branches.AddRange(GetAllBranchesFrom(subBranch));
            }
            return(branches);
        }
Example #4
0
        public void Remove(ClickUIBranch branch)
        {
            var branches = GetAllBranchesFrom(branch);

            foreach (var b in branches)
            {
                _branches.Remove(b);
                b.Unsubscribe(subscribeAction);
                if (b.IsCurrentElement(_current) && _current.IsHovered)
                {
                    Event.Publish(new ActiveElementChanged(_current));
                    _current.OnExitted();
                    _current.IsHovered = false;
                }
            }
        }
 public void Remove(ClickUIBranch branch)
 {
     _subBranches.Remove(branch);
     subscriberActions.ForEach((a) => a[1](branch));
 }
 public void Add(ClickUIBranch branch)
 {
     branch.ParentLocation = new Vector2(ParentLocation.X + Location.X, ParentLocation.Y + Location.Y);
     _subBranches.Add(branch);
     subscriberActions.ForEach((a) => a[0](branch));
 }
Example #7
0
 public ClickUI(Display display)
 {
     _display        = display;
     _elementLayer   = _branches[0];
     subscribeAction = new Action <ClickUIBranch>[] { (br) => Add(br), (br) => Remove(br) };;
 }
Example #8
0
 public ClickUI()
 {
     _elementLayer   = _branches[0];
     subscribeAction = new Action <ClickUIBranch>[] { Add, Remove };;
 }
 public SmartControl(VisualClickableUIElement element, int priority)
 {
     Branch = new ClickUIBranch("Smart Control", priority);
     Branch.Add(element);
     _visual = element;
 }