Example #1
0
    void KeyControl()
    {
        if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
        {
            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                lexicon.ChangePhrase(-3);
            }
        }
        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                server.Send("TouchScreen Keyboard Width", "+");
            }
            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                server.Send("TouchScreen Keyboard Width", "-");
            }
            if (Input.GetKeyDown(KeyCode.D))
            {
                debugOn ^= true;
                info.Log("Debug", debugOn.ToString());
                lexicon.SetDebugDisplay(debugOn);
            }
            if (Input.GetKeyDown(KeyCode.M))
            {
                parameter.ChangeMode();
            }
            if (Input.GetKeyDown(KeyCode.L))
            {
                parameter.ChangeLocationFormula();
            }
            if (Input.GetKeyDown(KeyCode.N))
            {
                lexicon.ChangePhrase();
            }
            if (Input.GetKeyDown(KeyCode.C))
            {
                lexicon.ChangeCandidatesChoose(true);
            }
            if (Input.GetKeyDown(KeyCode.R))
            {
                server.Send("Change Ratio", "");
                server.Send("Get Keyboard Size", "");
            }
            if (Input.GetKeyDown(KeyCode.T))
            {
                parameter.ChangeRatio();
                lexicon.CalcKeyLayout();
                lexicon.CalcLexicon();
            }
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                HideDisplay();
                info.Clear();
                if (Parameter.userStudy == Parameter.UserStudy.Basic)
                {
                    Parameter.userStudy = Parameter.UserStudy.Study1_Train;
                    lexicon.ChangePhrase();
                    textManager.HighLight(-100);
                    info.Log("Phrase", "Warmup");
                    return;
                }
                Parameter.userStudy = Parameter.UserStudy.Study1;
                lexicon.ChangePhrase(phraseID);
                SendPhraseMessage();
                textManager.HighLight(-100);
                info.Log("Phrase", (phraseID + 1).ToString() + "/40");
                server.Send("Get Keyboard Size", "");
            }
            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                HideDisplay();
                Parameter.userStudy = Parameter.UserStudy.Study2;
                lexicon.SetPhraseList(Parameter.userStudy);
                lexicon.ChangePhrase(phraseID);
                SendPhraseMessage();
                info.Clear();
                info.Log("Mode", Parameter.mode.ToString());
                blockID = blockID % 4 + 1;
                info.Log("Block", blockID.ToString() + "/4");
                info.Log("Phrase", (phraseID % 10 + 1).ToString() + "/10");
            }
        }
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            if (Input.GetKey(KeyCode.E))
            {
                parameter.ChangeEndOffset(0.1f);
            }
            if (Input.GetKey(KeyCode.R))
            {
                parameter.ChangeRadius(0.1f);
            }
            if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
                server.Send("TouchScreen Keyboard Height", "+");
            }
            if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
            {
                server.Send("TouchScreen Keyboard Size", "+");
                server.Send("Get Keyboard Size", "");
            }
        }
        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            if (Input.GetKey(KeyCode.E))
            {
                parameter.ChangeEndOffset(-0.1f);
            }
            if (Input.GetKey(KeyCode.R))
            {
                parameter.ChangeRadius(-0.1f);
            }
            if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
                server.Send("TouchScreen Keyboard Height", "-");
            }
            if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
            {
                server.Send("TouchScreen Keyboard Size", "-");
                server.Send("Get Keyboard Size", "");
            }
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            switch (Parameter.userStudy)
            {
            case Parameter.UserStudy.Basic:
                lexicon.ChangePhrase();
                break;

            case Parameter.UserStudy.Study1_Train:
                lexicon.ChangePhrase();
                textManager.HighLight(-100);
                break;

            case Parameter.UserStudy.Study1:
                if (!textManager.InputNumberCorrect() && !(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
                {
                    return;
                }
                server.Send("Study1 End Phrase", Parameter.mode.ToString());
                phraseID++;
                if (phraseID % 10 == 0)
                {
                    Parameter.userStudy = Parameter.UserStudy.Study1_Train;
                    lexicon.ChangePhrase();
                    textManager.HighLight(-100);
                    info.Log("Phrase", "<color=red>Rest</color>");
                    return;
                }
                lexicon.ChangePhrase(phraseID);
                SendPhraseMessage();
                textManager.HighLight(-100);
                info.Log("Phrase", (phraseID + 1).ToString() + "/40");
                break;

            case Parameter.UserStudy.Study2:
                if (!textManager.InputNumberCorrect() && !(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)))
                {
                    return;
                }
                FinishStudy2Phrase();
                break;
            }
        }
        if (Input.GetKeyDown(KeyCode.Backspace))
        {
            if (Parameter.userStudy == Parameter.UserStudy.Study1 || Parameter.userStudy == Parameter.UserStudy.Study2)
            {
                server.Send("Backspace", "");
            }
            if (Parameter.userStudy == Parameter.UserStudy.Study1 || Parameter.userStudy == Parameter.UserStudy.Study1_Train)
            {
                textManager.HighLight(-100);
            }
            if (Parameter.userStudy == Parameter.UserStudy.Study2 || Parameter.userStudy == Parameter.UserStudy.Basic)
            {
                lexicon.Clear();
            }
        }
    }