コード例 #1
0
        public void Focus(UIInputElement target)
        {
            if (!Targets.Contains(target))
            {
                throw new Exception($"{nameof(UIInputElement)} not in group.");
            }

            FocusTarget = target;
        }
コード例 #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;
            }
        }
コード例 #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);
        }
コード例 #4
0
 public bool Remove(UIInputElement target)
 {
     return(Targets.Remove(target));
 }