помоги с рефакторингом 
 public class UINavigator : IDisposable
    {
        public event Action<NamePopupItem> OnNextScreen;
        public event Action OnPreviousScreen;

        private PopupItem currentPanel = null;
        private int selectedPopupIndex = 0;
        private bool isEmptyScreen = false;
        private int selectedCurrentPopupIndex = 0;

        private KeyInputCheck keyInputCheck;

        public UINavigator(KeyInputCheck keyInputCheck)
        {
            this.keyInputCheck = keyInputCheck;

            keyInputCheck.OnUpArrowKeyPressed += UpArrowKeyPressed;
            keyInputCheck.OnDownArrowKeyPressed += DownArrowKeyPressed;
            keyInputCheck.OnRightArrowKeyPressed += RightArrowKeyPressed;
            keyInputCheck.OnLeftArrowKeyPressed += LeftArrowKeyPressed;
        }

        public void SetCurrentPopup(PopupItem panelItem)
        {
            panelItem.Initialize(currentPanel);
            currentPanel = panelItem;

            if (currentPanel.Popup.Length != 0)
            {
                ResetPopupSelection();
                EventSystem.current.SetSelectedGameObject(currentPanel.Popup[currentPanel.SelectedPopupIndex].gameObject);
                currentPanel.Popup[currentPanel.SelectedPopupIndex].Highlight();
                selectedCurrentPopupIndex = currentPanel.SelectedPopupIndex;
            }
            else
            {
                isEmptyScreen = true;
            }
        }

        private void UpArrowKeyPressed()
        {
            if (!isEmptyScreen)
            {
                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    EventSystem.current.SetSelectedGameObject(currentPanel.Popup[selectedPopupIndex].gameObject);
                }
                selectedPopupIndex = selectedCurrentPopupIndex;
                SelectFocus(-1);
            }
        }

        private void DownArrowKeyPressed()
        {
            if (!isEmptyScreen)
            {
                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    EventSystem.current.SetSelectedGameObject(currentPanel.Popup[selectedPopupIndex].gameObject);
                }
                selectedPopupIndex = selectedCurrentPopupIndex;
                SelectFocus(1);
            }
        }

        private void LeftArrowKeyPressed()
        {
            if (isEmptyScreen)
            {
                OnPreviousScreen?.Invoke();
            }
            else
            {
                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    EventSystem.current.SetSelectedGameObject(currentPanel.Popup[selectedPopupIndex].gameObject);
                }
                OnPreviousScreen?.Invoke();
            }
        }

        private void RightArrowKeyPressed()
        {
            if (isEmptyScreen)
            {
                if (currentPanel.NextItemName != NamePopupItem.None)
                {
                    OnNextScreen?.Invoke(currentPanel.NextItemName);
                }
            }
            else
            {
                if (EventSystem.current.currentSelectedGameObject == null)
                {
                    EventSystem.current.SetSelectedGameObject(currentPanel.Popup[selectedPopupIndex].gameObject);
                }

                selectedPopupIndex = selectedCurrentPopupIndex;
                currentPanel.Popup[selectedPopupIndex].Select();
                currentPanel.SelectedPopupIndex = selectedPopupIndex;
                OnNextScreen?.Invoke(currentPanel.Popup[selectedPopupIndex].ScreenItem);
            }
        }

       

        private void SelectFocus(int direction)
        {
            EventSystem.current.SetSelectedGameObject(null);

            ResetPopupSelection();

            selectedPopupIndex = (selectedPopupIndex + direction + currentPanel.Popup.Length) % currentPanel.Popup.Length;
            EventSystem.current.SetSelectedGameObject(currentPanel.Popup[selectedPopupIndex].gameObject);
            currentPanel.Popup[selectedPopupIndex].Highlight();
            selectedCurrentPopupIndex = selectedPopupIndex;
        }

        private void ResetPopupSelection()
        {
            isEmptyScreen = false;

            EventSystem.current.SetSelectedGameObject(null);

            foreach (var item in currentPanel.Popup)
            {
                item.Deselect();
            }
        }

        public void Dispose()
        {
            keyInputCheck.OnUpArrowKeyPressed -= UpArrowKeyPressed;
            keyInputCheck.OnDownArrowKeyPressed -= DownArrowKeyPressed;
            keyInputCheck.OnRightArrowKeyPressed -= RightArrowKeyPressed;
            keyInputCheck.OnLeftArrowKeyPressed -= LeftArrowKeyPressed;
        }