Ejemplo n.º 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);
        }
Ejemplo n.º 2
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());
        }