예제 #1
0
    private void OnMouseEnter()
    {
        buttonContainer.SetActive(true);
        if (buttonScript.tempSelect != "")
        {
            switch (buttonScript.tempSelect)
            {
            case "/toggle":
                buttonScript.Toggle();
                break;

            case "/space":
                wordCache = textInput[textInput.Count - 1].Clone().ToString();
                API.SendNext(textInput[textInput.Count - 1]);
                textInput.Add(string.Empty);
                break;

            case "/backspace":
                if (textInput[textInput.Count - 1].Length > 0)
                {
                    if (buttonScript.delay > capitalizeDelay)
                    {
                        textInput[textInput.Count - 1] = string.Empty;
                    }
                    else
                    {
                        textInput[textInput.Count - 1] = textInput[textInput.Count - 1].Remove(textInput[textInput.Count - 1].Length - 1);
                    }
                    wordCandidates.backspace();
                    API.SendRequest(wordCandidates.getList());
                }
                else
                {
                    if (textInput.Count > 1)
                    {
                        textInput.RemoveAt(textInput.Count - 1);
                    }
                    textInput[textInput.Count - 1] = wordCache.Clone().ToString();
                    wordCandidates.input(new string[] { textInput[textInput.Count - 1] });
                    API.SendRequest(wordCandidates.getList());
                }
                break;

            default:
                if (buttonScript.tempSelect.Length > 1)
                {
                    wordCache = textInput[textInput.Count - 1].Clone().ToString();
                    textInput[textInput.Count - 1] = buttonScript.tempSelect;
                    textInput.Add(string.Empty);
                    API.SendNext(buttonScript.tempSelect);
                }
                else
                {
                    if (buttonScript.delay > capitalizeDelay)
                    {
                        buttonScript.tempSelect = buttonScript.tempSelect.ToUpper();
                    }
                    textInput[textInput.Count - 1] += buttonScript.tempSelect;
                    wordCandidates.input(buttonScript.tempSelection);
                    API.SendRequest(wordCandidates.getList());
                }
                break;
            }
            input.text = string.Join(" ", textInput.ToArray());
            buttonScript.tempSelect = "";
        }
    }