Exemplo n.º 1
0
        public void Focus(UIInputElement target)
        {
            if (!Targets.Contains(target))
            {
                throw new Exception($"{nameof(UIInputElement)} not in group.");
            }

            FocusTarget = target;
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public bool Remove(UIInputElement target)
 {
     return(Targets.Remove(target));
 }