Пример #1
0
        private void FocusIndexChanged(int focusIndex)
        {
            SkipWordSelection = false;
            FocusedSection    = (Section)focusIndex;
            RectTransform focusTarget = null;

            switch (FocusedSection)
            {
            case Section.WordSelector:
                focusTarget = Controller.GetWordSelectionPanel();
                break;

            case Section.Keyboard:
                focusTarget = Controller.GetKeyboardSelectionPanel();
                break;

            case Section.Speak:
                focusTarget = Controller.GetInputSelectionPanel();
                break;

            default:
                throw new NotImplementedException(focusIndex + "");
            }
            Controller.SetIndicatorRect(focusTarget);
        }
 private void FocusIndexChanged(int focusIndex)
 {
     SelectedWord = WordSuggestions[focusIndex];
     Controller.SetIndicatorRect(SelectedWord.GetComponent <RectTransform>());
     if (FocusCycler.FocusChangeCount > WordSuggestions.Length + 1)
     {
         Controller.InputStrategyFinished();
     }
 }
 void FocusIndexChanged(int focusIndex)
 {
     FocusedKeyboardKey = KeyRectTransforms[focusIndex].GetComponent <KeyboardKey>();
     Controller.SetIndicatorRect(KeyRectTransforms[focusIndex]);
     if (FocusCycler.FocusChangeCount > KeyRectTransforms.Length + 2)
     {
         Controller.InputStrategyFinished();
     }
 }
Пример #4
0
        void IInputStrategy.Initialize(ITypingController controller)
        {
            Controller       = controller;
            KeyboardSelector = controller.GetKeyboardSelector();
            ClientArea       = Controller
                               .GetKeyboardSelectorClientArea()
                               .GetComponent <RectTransform>();
            this.EnsureAssigned(x => x.ClientArea);
            Rows = Controller
                   .GetKeyboardSelectorClientArea()
                   .GetComponentsInChildren <HorizontalLayoutGroup>()
                   .Select(x => x.GetComponent <RectTransform>())
                   .ToArray();
            RowPositions = RowPositions ?? Rows.Select(x => x.localPosition.y).ToArray();

            FocusIndexChanged(Rows.Length / 2); // Start at index 1, so we can see index 0 scroll into view
            LerpClientAreaPosition(1);

            FocusCycler.Start(Rows.Length);
            Controller.SetIndicatorRect(Controller.GetKeyboardSelectionPanel());
        }