public void Remove(ClickUIBranch branch) { var branches = GetAllBranchesFrom(branch); foreach (var b in branches) { _branches.Remove(b); b.Unsubscribe(subscribeAction); } }
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(); }
private List <ClickUIBranch> GetAllBranchesFrom(ClickUIBranch branch) { var branches = new List <ClickUIBranch> { branch }; foreach (ClickUIBranch subBranch in branch.SubBranches()) { branches.AddRange(GetAllBranchesFrom(subBranch)); } return(branches); }
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)); }
public ClickUI(Display display) { _display = display; _elementLayer = _branches[0]; subscribeAction = new Action <ClickUIBranch>[] { (br) => Add(br), (br) => Remove(br) };; }
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; }