public void Focus(UIInputElement target) { if (!Targets.Contains(target)) { throw new Exception($"{nameof(UIInputElement)} not in group."); } FocusTarget = target; }
public void Add(UIInputElement target) { if (Targets.Contains(target)) { throw new Exception($"{nameof(UIInputElement)} already in group."); } Targets.Add(target); target.Group = this; if (FocusTarget == null) { FocusTarget = target; } }
public void FocusNext(bool reverse = false) { if (Targets.Count == 0) { return; } if (Targets.Count == 1) { FocusTarget = Targets[0]; return; } int targetIndex = (Targets.IndexOf(FocusTarget) + (reverse ? -1 : 1) + Targets.Count) % Targets.Count; FocusTarget = Targets[targetIndex]; Main.PlaySound(SoundID.MenuTick); }
public bool Remove(UIInputElement target) { return(Targets.Remove(target)); }