예제 #1
0
        private void ButtSlappedHandler(SuggestionButton butt)
        {
            _CommandLocation.text = butt.Text + " ";
            _CommandLocation.Select();
            _CommandLocation.ForceLabelUpdate();

            // because ForceLabelUpdate() doesnt work
            StartCoroutine(MoveCaretToEndRoutine(_CommandLocation));
        }
예제 #2
0
        private void AutoIndentCaret()
        {
            if (CurrentIndent > 0)
            {
                string indent = GetAutoIndentTab(CurrentIndent);

                if (indent.Length > 0)
                {
                    int caretPos = InputField.caretPosition;

                    string indentMinusOne = indent.Substring(0, indent.Length - 1);

                    // get last index of {
                    // chuck it on the next line if its not already
                    string text      = InputField.text;
                    string sub       = InputField.text.Substring(0, InputField.caretPosition);
                    int    lastIndex = sub.LastIndexOf("{");
                    int    offset    = lastIndex - 1;
                    if (offset >= 0 && text[offset] != '\n' && text[offset] != '\t')
                    {
                        string open = "\n" + indentMinusOne;

                        InputField.text = text.Insert(offset + 1, open);

                        caretPos += open.Length;
                    }

                    // check if should add auto-close }
                    int numOpen  = InputField.text.Where(x => x == CSLexerHighlighter.indentOpen).Count();
                    int numClose = InputField.text.Where(x => x == CSLexerHighlighter.indentClose).Count();

                    if (numOpen > numClose)
                    {
                        // add auto-indent closing
                        indentMinusOne  = $"\n{indentMinusOne}}}";
                        InputField.text = InputField.text.Insert(caretPos, indentMinusOne);
                    }

                    // insert the actual auto indent now
                    InputField.text = InputField.text.Insert(caretPos, indent);

                    //InputField.stringPosition = caretPos + indent.Length;
                    InputField.caretPosition = caretPos + indent.Length;
                }
            }

            // Update line column and indent positions
            UpdateIndent(InputField.text);

            InputText.text = InputField.text;
            //inputText.SetText(InputField.text, true);
            InputText.Rebuild(CanvasUpdate.Prelayout);
            InputField.ForceLabelUpdate();
            InputField.Rebuild(CanvasUpdate.Prelayout);

            OnInputChanged(InputText.text, true);
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        public void Switch()
        {
            bool isHidde = inputField.contentType == InputField.ContentType.Password;

            isHidde = !isHidde;
            inputField.contentType = (isHidde) ? InputField.ContentType.Password : InputField.ContentType.Standard;
            inputField.ForceLabelUpdate();
            iconImg.sprite = (isHidde) ? HideIcon : VisibleIcon;
        }
 void LateUpdate()
 {
     //他のinputfieldに変換中の文字が表示されるのを防ぐため選択中のみ
     if (T1.GetComponent <InputField>().isFocused == true)
     {
         //強制的にラベルを即時更新します。キャレットと表示されている文字列の位置を再計算します。
         T1.ForceLabelUpdate();
     }
 }
 private void LateUpdate()
 {
     if (currentInputField != null)
     {
         currentInputField.text          = externTextField.ExternTextFieldData;
         currentInputField.caretPosition = currentInputField.text.Length;
         currentInputField.ForceLabelUpdate();
     }
 }
예제 #6
0
 void Update()
 {
     if (ShowPasswordToggle.isOn)
     {
         if (logIn_Password.contentType != InputField.ContentType.Password)
         {
             logIn_Password.contentType = InputField.ContentType.Password;
             logIn_Password.ForceLabelUpdate();
         }
     }
     else
     {
         if (logIn_Password.contentType != InputField.ContentType.Standard)
         {
             logIn_Password.contentType = InputField.ContentType.Standard;
             logIn_Password.ForceLabelUpdate();
         }
     }
 }
예제 #7
0
 private void Awake()
 {
     showPassword_Toggle.onValueChanged.AddListener((mood) => {
         password_InputField.contentType = mood ? InputField.ContentType.Password : InputField.ContentType.Standard;
         password_InputField.ForceLabelUpdate();
     });
     login_Btn.onClick.AddListener(Login);
     login_InputField.onValueChanged.AddListener(ChangeButtonImage);
     password_InputField.onValueChanged.AddListener(ChangeButtonImage);
 }
예제 #8
0
    private void Start()
    {
        showPasswordToggle.onValueChanged.AddListener((isPasswordHidden) =>
        {
            passwordInputField.contentType =
                isPasswordHidden ? InputField.ContentType.Password : InputField.ContentType.Standard;
            passwordInputField.ForceLabelUpdate();
        });

        TryAuthBy <SavedTokenAuth>(SavedTokenAuthFailed);
    }
예제 #9
0
    public void OnInputText(string text, string selectIndexStr)
    {
        inputField.text = text;

        try
        {
            int selectIndex = int.Parse(selectIndexStr);
            inputField.selectionAnchorPosition = selectIndex;
            inputField.selectionFocusPosition  = selectIndex;
            selectStartIndex = selectIndex;
            selectEndIndex   = selectIndex;
        }
        catch
        {
            inputField.selectionAnchorPosition = inputField.text.Length;
            inputField.selectionFocusPosition  = inputField.text.Length;
        }
        inputField.Select();
        inputField.ForceLabelUpdate();
    }
예제 #10
0
 // Use this for initialization
 void Update()
 {
     if (ispressed)
     {
         password.contentType = InputField.ContentType.Standard;
     }
     else
     {
         password.contentType = InputField.ContentType.Password;
     }
     password.ForceLabelUpdate();
 }
예제 #11
0
 public void HidePassword(bool flag)
 {
     if (flag)
     {
         passwordInput.contentType = InputField.ContentType.Password;
     }
     else
     {
         passwordInput.contentType = InputField.ContentType.Standard;
     }
     passwordInput.ForceLabelUpdate();
 }
예제 #12
0
 public void OnClickShowOrHidePassword()
 {
     if (Password.contentType == InputField.ContentType.Password)
     {
         Password.contentType = InputField.ContentType.Standard;
     }
     else
     {
         Password.contentType = InputField.ContentType.Password;
     }
     Password.ForceLabelUpdate();
 }
 private void ToggleClicked()
 {
     // Cover or show password
     if (coverToggle.isOn)
     {
         loginPasswordField.GetComponent <InputField>().contentType  = InputField.ContentType.Standard;
         signupPasswordField.GetComponent <InputField>().contentType = InputField.ContentType.Standard;
         loginPasswordField.ActivateInputField();
         loginPasswordField.ForceLabelUpdate();
         signupPasswordField.ActivateInputField();
         signupPasswordField.ForceLabelUpdate();
     }
     else
     {
         loginPasswordField.GetComponent <InputField>().contentType  = InputField.ContentType.Password;
         signupPasswordField.GetComponent <InputField>().contentType = InputField.ContentType.Password;
         loginPasswordField.ActivateInputField();
         loginPasswordField.ForceLabelUpdate();
         signupPasswordField.ActivateInputField();
         signupPasswordField.ForceLabelUpdate();
     }
 }
예제 #14
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void SendInputFieldEvent(HoverkeyItemLabels pLabels)
        {
            if (InputField == null)
            {
                return;
            }

            InputField.text          = TextInput;
            InputField.caretPosition = CursorIndex;
            InputField.ForceLabelUpdate();

            /*
             * //TODO: the following seems like the right way to do it, but isn't working as expected
             * //http://docs.unity3d.com/540/Documentation/ScriptReference/UI.InputField.html
             * //https://docs.unity3d.com/ScriptReference/Event.KeyboardEvent.html
             * //https://docs.unity3d.com/Manual/ConventionalGameInput.html
             *
             * string keyName = (pLabels.DefaultKey+"").ToLower();
             *
             * switch ( pLabels.DefaultKey ) {
             *      case KeyCode.Keypad0:
             *      case KeyCode.Keypad1:
             *      case KeyCode.Keypad2:
             *      case KeyCode.Keypad3:
             *      case KeyCode.Keypad4:
             *      case KeyCode.Keypad5:
             *      case KeyCode.Keypad6:
             *      case KeyCode.Keypad7:
             *      case KeyCode.Keypad8:
             *      case KeyCode.Numlock:
             *      case KeyCode.KeypadDivide:
             *      case KeyCode.KeypadMultiply:
             *      case KeyCode.KeypadMinus:
             *      case KeyCode.KeypadPlus:
             *      case KeyCode.KeypadPeriod:
             *      case KeyCode.KeypadEnter:
             *              keyName = "["+keyName+"]";
             *              break;
             * }
             *
             * if ( Hoverkey.IsInShiftMode ) {
             *      keyName = "#"+keyName;
             *      //keyName = keyName.ToUpper();
             * }
             *
             * Debug.Log("KEY: "+keyName);
             * InputField.ActivateInputField();
             * InputField.ProcessEvent(Event.KeyboardEvent(keyName));
             * InputField.ForceLabelUpdate();*/
        }
예제 #15
0
    public void setSaveName()
    {
        Match newName = Regex.Match(gameNameInput.text, "[A-Za-z0-9]+", RegexOptions.Singleline);

        if (newName.Value.Equals(gameNameInput.text))
        {
            saveName = newName.Value;
        }
        else
        {
            gameNameInput.text = "";
            gameNameInput.ForceLabelUpdate();
        }
    }
예제 #16
0
 public void Toggle_RegisterConfirmPasswordPlainText()
 {
     if (RegisterConfirmPasswordField.contentType == InputField.ContentType.Password)
     {
         RegisterConfirmPasswordField.contentType = InputField.ContentType.Standard;
         RegisterConfirmPasswordEye.sprite        = Eye_2;
     }
     else
     {
         RegisterConfirmPasswordField.contentType = InputField.ContentType.Password;
         RegisterConfirmPasswordEye.sprite        = Eye_1;
     }
     RegisterConfirmPasswordField.ForceLabelUpdate();
 }
예제 #17
0
 public void Toggle_SingInPasswordPlainText()
 {
     if (SignInPasswordField.contentType == InputField.ContentType.Password)
     {
         SignInPasswordField.contentType = InputField.ContentType.Standard;
         SignInPasswordEye.sprite        = Eye_2;
     }
     else
     {
         SignInPasswordField.contentType = InputField.ContentType.Password;
         SignInPasswordEye.sprite        = Eye_1;
     }
     SignInPasswordField.ForceLabelUpdate();
 }
예제 #18
0
    void Awake()
    {
        login_InputField.onValueChanged.AddListener(delegate { UpdateButtonState(); });
        password_InputField.onValueChanged.AddListener(delegate { UpdateButtonState(); });
        email_InputField.onValueChanged.AddListener(delegate { UpdateButtonState(); });

        _lastClick = DateTime.MinValue;
        create_Btn.onClick.AddListener(SignUp);

        showPassword_Toggle.onValueChanged.AddListener((mood) =>
        {
            password_InputField.contentType = mood ? InputField.ContentType.Password : InputField.ContentType.Standard;
            password_InputField.ForceLabelUpdate();
        });

        create_Btn.onClick.AddListener(SignUp);
    }
예제 #19
0
        private IEnumerator ReturnCaretPosition(int index)
        {
            yield return(null);

            if (inputField != null)
            {
                inputField.caretPosition           = index;
                inputField.selectionAnchorPosition = index;
                inputField.selectionFocusPosition  = index;
                inputField.ForceLabelUpdate();
            }
            else if (tmpInputField != null)
            {
                tmpInputField.caretPosition           = index;
                tmpInputField.selectionAnchorPosition = index;
                tmpInputField.selectionFocusPosition  = index;
                tmpInputField.ForceLabelUpdate();
            }
        }
예제 #20
0
    public void ToggleSignInPasswordInputType()
    {
        if (signInPasswordInput != null)
        {
            if (signInPasswordInput.contentType == InputField.ContentType.Password)
            {
                signInPasswordInput.contentType = InputField.ContentType.Standard;

                passEyeImageSignIn.sprite = passEyeSpriteFilled;
            }
            else
            {
                signInPasswordInput.contentType = InputField.ContentType.Password;

                passEyeImageSignIn.sprite = passEyeSpriteNormal;
            }
            signInPasswordInput.ForceLabelUpdate();
        }
    }
예제 #21
0
파일: Widgets.cs 프로젝트: via5/Synergy
        public void Focus()
        {
            if (input_ == null)
            {
                return;
            }

            input_.ActivateInputField();

            if (oldCaret_ != -1)
            {
                Synergy.Instance.CreateTimer(Timer.Immediate, () =>
                {
                    input_.caretPosition           = oldCaret_;
                    input_.selectionAnchorPosition = oldAnchor_;
                    input_.selectionFocusPosition  = oldFocus_;
                    input_.ForceLabelUpdate();
                });
            }
        }
예제 #22
0
        private void LateUpdateContents()
        {
            if (inputField == null)
            {
                return;
            }

            #if UNITY_EDITOR
            if (!inputField.isFocused)
            {
                // フォーカスが当たってない時は常時上書き.
                inputFieldText.text = inputField.text;
            }
            #endif

            if (inputField.isFocused)
            {
                // 強制的にラベルを即時更新.
                // キャレットと表示されている文字列の位置を再計算.
                inputField.ForceLabelUpdate();
            }
        }
예제 #23
0
 void ToggleShowPassword(bool show)
 {
     _passwordInputField.contentType = show ? InputField.ContentType.Standard : InputField.ContentType.Password;
     _passwordInputField.ForceLabelUpdate();
 }
예제 #24
0
 public void SetText(string text)
 {
     inputField.text = text;
     isSet           = true;
     inputField.ForceLabelUpdate();
 }
예제 #25
0
 public static void setSelectedStringInfoFromReflection(InputField inputField, int[] infos)
 {
     caretPositionInfo.SetValue(inputField, infos[0], null);
     caretSelectPositionInfo.SetValue(inputField, infos[1], null);
     inputField.ForceLabelUpdate();
 }
예제 #26
0
    public void OnClick()
    {
        switch (Key)
        {
        case SpecialKeyType.Backspace:
            if (_inputField.caretPosition > 0)
            {
                string text = _inputField.text.Substring(0, _inputField.caretPosition - 1);
                if (_inputField.caretPosition < _inputField.text.Length)
                {
                    text += _inputField.text.Substring(_inputField.caretPosition, _inputField.text.Length - _inputField.caretPosition);
                    _inputField.caretPosition--;
                }
                _inputField.text = text;
            }
            break;

        case SpecialKeyType.Delete:
            if (_inputField.caretPosition <= _inputField.text.Length)
            {
                string text = _inputField.text.Substring(0, _inputField.caretPosition);
                if (_inputField.caretPosition < _inputField.text.Length - 1)
                {
                    text += _inputField.text.Substring(_inputField.caretPosition + 1, _inputField.text.Length - _inputField.caretPosition - 1);
                }
                _inputField.text = text;
            }
            break;

        case SpecialKeyType.CapsLock:
            _keyboard.ApplyCapsLock();
            break;

        case SpecialKeyType.Shift:
            _keyboard.ApplyShift();
            break;

        case SpecialKeyType.Alt:
            _keyboard.ApplyAlt();
            break;

        case SpecialKeyType.Confirm:
            break;

        case SpecialKeyType.Cancel:
            break;

        case SpecialKeyType.Clear:
            _inputField.text          = "";
            _inputField.caretPosition = 0;
            break;

        case SpecialKeyType.LeftCaret:
            if (_inputField.caretPosition > 0)
            {
                _inputField.caretPosition--;
            }
            break;

        case SpecialKeyType.RightCaret:
            if (_inputField.caretPosition <= _inputField.text.Length)
            {
                _inputField.caretPosition++;
            }
            break;
        }

        _inputField.ForceLabelUpdate();
    }
예제 #27
0
        // -------------------------------------------

        /*
         * OnBitcoinManagerEvent
         */
        protected override void OnMenuEvent(string _nameEvent, params object[] _list)
        {
            base.OnMenuEvent(_nameEvent, _list);

#if !(ENABLE_OCULUS || ENABLE_WORLDSENSE)
            if (!this.gameObject.activeSelf)
            {
                return;
            }
#endif

            if (_nameEvent == ScreenController.EVENT_CONFIRMATION_POPUP)
            {
                string subEvent = (string)_list[2];
                if (subEvent == SUB_EVENT_SCREENBITCOIN_CONFIRMATION_EXIT_WITHOUT_SAVE)
                {
                    if ((bool)_list[1])
                    {
                        BasicSystemEventController.Instance.DispatchBasicSystemEvent(EVENT_SCREENBITCOINPRIVATEKEY_CANCELATION);
                        Destroy();
                    }
                }
                if (subEvent == SUB_EVENT_SCREENBITCOINPRIVATEKEY_CONFIRMATION_DELETE)
                {
                    if ((bool)_list[1])
                    {
                        BitCoinController.Instance.RemovePrivateKey(BitCoinController.Instance.CurrentPrivateKey);
                        BitcoinEventController.Instance.DispatchBitcoinEvent(BitCoinController.EVENT_BITCOINCONTROLLER_UPDATE_ACCOUNT_DATA);
                        BitCoinController.Instance.BackupCurrentPrivateKey = "";
                        Destroy();
                    }
                }
                if (subEvent == SUB_EVENT_SCREENBITCOINPRIVATEKEY_VIDEO_TUTORIAL)
                {
                    if ((bool)_list[1])
                    {
                        Application.OpenURL("https://www.youtube.com/watch?v=wSwt2hYeAmE");
                    }
                }
                if (subEvent == SUB_EVENT_SCREENBITCOINPRIVATEKEY_BURN_KEY_CONFIRMATION)
                {
                    if ((bool)_list[1])
                    {
                        UIEventController.Instance.DispatchUIEvent(UIEventController.EVENT_SCREENMANAGER_OPEN_INFORMATION_SCREEN, ScreenInformationView.SCREEN_WAIT, UIScreenTypePreviousAction.KEEP_CURRENT_SCREEN, LanguageController.Instance.GetText("message.info"), LanguageController.Instance.GetText("message.please.wait"), null, "");
                        Invoke("OnRealSaveButton", 0.1f);
                    }
                }
                if (subEvent == SUB_EVENT_SCREENBITCOINPRIVATEKEY_HIDE_INFO_BUTTONS)
                {
                    m_buttonSave.SetActive(false);
                    m_outputTransactionHistory.SetActive(false);
                    m_inputTransactionHistory.SetActive(false);
                    m_buttonBalance.SetActive(false);
                }
            }
            if (_nameEvent == ScreenEmailPrivateKeyView.EVENT_SCREENENTEREMAIL_PRIVATE_KEY_CONFIRMATION)
            {
                Application.OpenURL("mailto:" + (string)_list[0] + "?subject=" + LanguageController.Instance.GetText("message.private.address") + "&body=" + LanguageController.Instance.GetText("screen.bitcoin.wallet.send.private.key.warning") + ":" + BitCoinController.Instance.CurrentPrivateKey + ", PUBLIC KEY=" + BitCoinController.Instance.CurrentPublicKey);
            }
            if (_nameEvent == ButtonEventCustom.EVENT_BUTTON_CUSTOM_PRESSED_DOWN)
            {
                GameObject sButtonSee = (GameObject)_list[0];
                if (m_seeComplete == sButtonSee)
                {
                    m_completeKey.contentType = UnityEngine.UI.InputField.ContentType.Standard;
                    m_completeKey.lineType    = UnityEngine.UI.InputField.LineType.MultiLineNewline;
                    m_completeKey.ForceLabelUpdate();
                    m_btnInfoPrivateKey.SetActive(false);
                    m_emailPrivateKey.SetActive(false);
                }
            }
            if (_nameEvent == ButtonEventCustom.EVENT_BUTTON_CUSTOM_RELEASE_UP)
            {
                m_completeKey.contentType = UnityEngine.UI.InputField.ContentType.Password;
                m_completeKey.ForceLabelUpdate();
                m_btnInfoPrivateKey.SetActive(true);
                m_emailPrivateKey.SetActive(true);
            }
            if (_nameEvent == EVENT_SCREENPROFILE_LOAD_SCREEN_EXCHANGE_TABLES_INFO)
            {
                CommsHTTPConstants.GetBitcoinExchangeRatesTable();
            }
            if (_nameEvent == EVENT_SCREENPROFILE_LOAD_CHECKING_KEY_PROCESS)
            {
                CheckKeyEnteredInMainField();
            }
            if (this.gameObject.activeSelf)
            {
                if (_nameEvent == UIEventController.EVENT_SCREENMANAGER_ANDROID_BACK_BUTTON)
                {
                    OnBackButton();
                }
            }
        }
예제 #28
0
        private void OnKeyPressed(VirtualKeyboard keyboard, VirtualKey key)
        {
            if (!m_inputField.isFocused)
            {
                return;
            }

            if (key.IsFunctional)
            {
                switch (key.KeyCode)
                {
                case KeyCode.Backspace:
                    string text = m_inputField.text;
                    if (m_inputField.selectionAnchorPosition != m_inputField.selectionFocusPosition)
                    {
                        int start = Mathf.Min(m_inputField.selectionAnchorPosition, m_inputField.selectionFocusPosition);
                        int end   = Math.Max(m_inputField.selectionAnchorPosition, m_inputField.selectionFocusPosition);

                        m_inputField.text          = text.Remove(start, end - start);
                        m_inputField.caretPosition = start;
                    }
                    else
                    {
                        if (m_inputField.caretPosition > 0)
                        {
                            int prevCaretPosition = m_inputField.caretPosition;

                            m_inputField.text = text.Remove(m_inputField.caretPosition - 1, 1);

                            if (prevCaretPosition == m_inputField.caretPosition)
                            {
                                m_inputField.caretPosition -= 1;
                            }
                        }
                    }

                    break;

                case KeyCode.Return:
                    m_inputField.DeactivateInputField();
                    break;
                }
            }
            else
            {
                string text = m_inputField.text;
                if (m_inputField.selectionAnchorPosition != m_inputField.selectionFocusPosition)
                {
                    int start = Mathf.Min(m_inputField.selectionAnchorPosition, m_inputField.selectionFocusPosition);
                    int end   = Math.Max(m_inputField.selectionAnchorPosition, m_inputField.selectionFocusPosition);

                    text = text.Remove(start, end - start);
                    m_inputField.text          = text.Insert(start, key.Char);
                    m_inputField.caretPosition = start + key.Char.Length;
                }
                else
                {
                    m_inputField.text           = text.Insert(m_inputField.caretPosition, key.Char);
                    m_inputField.caretPosition += key.Char.Length;
                }
            }

            m_inputField.ForceLabelUpdate();
        }
예제 #29
0
 public override void draw(object hdc, int x, int y, int z, position clip)
 {
     base.draw(hdc, x, y, z, clip);
     _edit.ForceLabelUpdate();
 }
예제 #30
0
        /// <summary>
        /// Completes the current word.
        /// </summary>
        private void AutoComplete()
        {
            _inputField.text = _inputField.text.TrimEnd();
            var word       = GetLastWord(_inputField.text);
            var parts      = word.Split('.');
            var candidates = new List <string>();

            if (parts.Length == 1)
            {
                foreach (var className in _bindings.Keys)
                {
                    if (className.StartsWith(word))
                    {
                        candidates.Add(className.Remove(0, word.Length));
                    }
                }
            }
            else
            {
                // Look for method that starts with text.
                foreach (var className in _bindings.Keys)
                {
                    if (className == parts[0])
                    {
                        foreach (var methodName in _bindings[className])
                        {
                            if (methodName.StartsWith(parts[1]))
                            {
                                candidates.Add(methodName.Remove(0, parts[1].Length));
                            }
                        }
                    }
                }
            }
            if (candidates.Count == 0)
            {
                return;
            }
            int shortestCandidateLength = 99999999;

            foreach (var candidate in candidates)
            {
                if (candidate.Length < shortestCandidateLength)
                {
                    shortestCandidateLength = candidate.Length;
                }
            }
            for (int characterIndex = 0; characterIndex < shortestCandidateLength; characterIndex++)
            {
                bool allCandidatesMatchAtCharacterIndex = true;
                for (int candidateIndex = 0; candidateIndex < candidates.Count - 1; candidateIndex++)
                {
                    if (candidates[candidateIndex][characterIndex] != candidates[candidateIndex + 1][characterIndex])
                    {
                        allCandidatesMatchAtCharacterIndex = false;
                    }
                }
                if (allCandidatesMatchAtCharacterIndex)
                {
                    _inputField.text += candidates[0][characterIndex];
                }
                else
                {
                    break;
                }
            }
            _inputField.caretPosition = _inputField.text.Length;
            _inputField.ForceLabelUpdate();
            _inputField.onValueChanged?.Invoke(_inputField.text);
        }