public void Init(String hint, Action<string> callback = null) { doneCallback = callback; _textField.text = hint; _alphaButtons = _alphaButtonsPanel.GetComponentsInChildren<ControllerButton>(); ChangeMode(KeyboardMode.Uppercase); //_swapButton.GetComponentInChildren<Text>().text = KeyboardMode.Uppercase.ToString().ToUpper(); _currentKeyPos = new KeyPos(0,0); _alphaButtons[_currentKeyPos.y* _columns + _currentKeyPos.x].ShowHighlighted(); }
void SelectButton(KeyPos pos) { Debug.Log(_upperChars [pos.y, pos.x]); _alphaButtons[_currentKeyPos.y* _columns + _currentKeyPos.x].ShowNormal(); _alphaButtons[pos.y* _columns + pos.x].ShowHighlighted(); _currentKeyPos = pos; }
KeyPos NavigateKeys(KeyPos direction) { KeyPos nextPos = _currentKeyPos; nextPos.x += direction.x; nextPos.y += direction.y; if(nextPos.x > _columns -1) nextPos.x = 0; else if(nextPos.x < 0) nextPos.x = _columns -1; if(nextPos.y > _rows -1) nextPos.y = 0; else if(nextPos.y < 0) nextPos.y = _rows -1; return nextPos; }