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

            foreach (var b in branches)
            {
                _branches.Remove(b);
                b.Unsubscribe(subscribeAction);
            }
        }
예제 #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();
        }
예제 #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);
        }
예제 #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;
                }
            }
        }
예제 #5
0
 public void Remove(ClickUIBranch branch)
 {
     _subBranches.Remove(branch);
     subscriberActions.ForEach((a) => a[1](branch));
 }
예제 #6
0
 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));
 }
예제 #7
0
 public ClickUI(Display display)
 {
     _display        = display;
     _elementLayer   = _branches[0];
     subscribeAction = new Action <ClickUIBranch>[] { (br) => Add(br), (br) => Remove(br) };;
 }
예제 #8
0
 public ClickUI()
 {
     _elementLayer   = _branches[0];
     subscribeAction = new Action <ClickUIBranch>[] { Add, Remove };;
 }
예제 #9
0
 public SmartControl(VisualClickableUIElement element, int priority)
 {
     Branch = new ClickUIBranch("Smart Control", priority);
     Branch.Add(element);
     _visual = element;
 }