예제 #1
0
    void OnGUI()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            if (GUI.Button(new Rect(Screen.width / 2, Screen.height / 2 - 200, 200, 150), "Start Speech"))
            {
                SpeakNow.startSpeech(LanguageUtil.JAPANESE);
            }
            if (GUI.Button(new Rect(Screen.width / 2, Screen.height / 2, 200, 150), "Reset"))
            {
                if (checkSpeak(SpeakNow.speechResult().ToString().Trim()))
                {
                    //   GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 350, 200, 200), " Exactly ");
                    incDem();
                    updateQuestSpeak(dem);
                    SpeakNow.reset();
                }
                //else
                //  GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 450, 200, 200), " no correct ");
            }

            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 230, 200, 200), "Speech Result : " + SpeakNow.speechResult());
            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 260, 200, 200), "Quest : " + result);
            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 350, 200, 200), checkSpeak(SpeakNow.speechResult().ToString().Trim()) ? "Exactly" : " no correct");
        }
        else
        {
            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2, 300, 200), "Please Build and Run in Android and see documentation for usage of functionalities.");
        }
    }
예제 #2
0
    public void gantiSkenario()
    {
        hasilSpeech = SpeakNow.speechResult();
        SceneController1 s1 = new SceneController1();

        s1.sceneControl(hasilSpeech, skenarioGanti, skenarioTujuan);
    }
예제 #3
0
    public void sceneControl(string speakResult, string skenarioGanti, string skenario)
    {
        m_sceneName  = SceneManager.GetActiveScene();
        currentScene = m_sceneName.name;

        if (currentScene == "Skenario01" || currentScene == "CheckIn01" || currentScene == "CheckOut_01")
        {
            PlayerPrefs.SetInt("nilai", 0);
            resetScores();
        }
        loadKataKunci();

        PlayerPrefs.GetInt("todo1");
        PlayerPrefs.GetInt("todo2");
        PlayerPrefs.GetInt("todo3");
        PlayerPrefs.GetInt("todo4");
        PlayerPrefs.GetInt("todo5");
        PlayerPrefs.GetInt("todo6");
        PlayerPrefs.GetInt("todo7");
        PlayerPrefs.GetInt("todo8");
        PlayerPrefs.GetInt("todo8");
        PlayerPrefs.GetInt("todo9");
        PlayerPrefs.GetInt("nilai");


        for (int i = 0; i < word.Count; i++)
        {
            if (speakResult.Contains(word[i].kataKunci))
            {
                if (word[i].skenarioTujuan.Contains(skenario))
                {
                    PlayerPrefs.SetInt(word[i].toDo, 1);
                    SceneManager.LoadScene(word[i].skenarioTujuan);
                    PlayerPrefs.SetInt("nilai", (PlayerPrefs.GetInt("nilai") + word[i].nilai));
                    SceneManager.UnloadScene(SceneManager.GetActiveScene());
                    SpeakNow.reset();
                    speakResult = "";
                }
            }
            else if (speakResult != "" && speakResult != word[i].kataKunci)
            {
                SceneManager.UnloadScene(SceneManager.GetActiveScene());
                SceneManager.LoadScene(skenarioGanti);
                SpeakNow.reset();
            }
        }
    }
예제 #4
0
 private void OnMouseUp()
 {
     if (type == typeBotton.buttonStartSpeak)
     {
         SpeakNow.startSpeech(LanguageUtil.JAPANESE);
         creategameOver = true;
     }
     if (type == typeBotton.buttonCheckSpeak)
     {
         if (questSpeak.GetComponent <QuestSpeak>().checkSpeak(SpeakNow.speechResult().ToString().Trim()))
         {
             playerSpeak.GetComponent <PlayerSpeak>().pointSpeak++;
             questSpeak.GetComponent <QuestSpeak>().incDem();
             questSpeak.GetComponent <QuestSpeak>().updateQuestSpeak(questSpeak.GetComponent <QuestSpeak>().dem);
             SpeakNow.reset();
         }
     }
 }
예제 #5
0
    void OnGUI()
    {
        if (Application.platform == RuntimePlatform.Android)
        {
            if (GUI.Button(new Rect(Screen.width / 2, Screen.height / 2 - 200, 200, 150), "Start Speech"))
            {
                SpeakNow.startSpeech(LanguageUtil.ENGLISH_US);
            }
            if (GUI.Button(new Rect(Screen.width / 2, Screen.height / 2, 200, 150), "Reset"))
            {
                SpeakNow.reset();
            }

            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 230, 200, 200), "Speech Result : " + SpeakNow.speechResult());
            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 260, 200, 200), SpeakNow.getConfidenceScore().Length > 0?"Confidence Score : " + SpeakNow.getConfidenceScore():"");
            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2 + 350, 200, 200), SpeakNow.isResultMatches("almost") ? "Matched : " + SpeakNow.isResultMatches("almost") : "");
        }
        else
        {
            GUI.Label(new Rect(Screen.width / 2, Screen.height / 2, 300, 200), "Please Build and Run in Android and see documentation for usage of functionalities.");
        }
    }
예제 #6
0
 public void stopSpeech()
 {
     SpeakNow.reset();
 }
예제 #7
0
 public void mulaiSpeech()
 {
     SpeakNow.startSpeech(LanguageUtil.INDONESIAN);
     btn_startSpeak.GetComponent <Image>().color = Color.green;
 }
예제 #8
0
 // Update is called once per frame
 void Update()
 {
     if (creategameOver == true && !questSpeak.GetComponent <QuestSpeak>().checkSpeak(SpeakNow.speechResult().ToString().Trim()) && (SpeakNow.speechResult().ToString().Trim()) != "")
     {
         playerSpeak.GetComponent <PlayerSpeak>().timeSpeak--;
         resultSpeak.GetComponent <TextMesh>().text = "False, please speak againt!!!";
         creategameOver = false;
     }
 }