private static void Recognizer_OnDialogueLineRecognized(RecognitionResult result)
        {
            string line = result.Text;

            lock (dialogueLock) {
                if (currentDialogue != null)
                {
                    int idx = currentDialogue.GetLineIndex(result.Grammar);
                    if (idx != -1)
                    {
                        SubmitCommand("DIALOGUE|" + currentDialogue.id + "|" + idx);
                    }
                }
                else
                {
                    string command = favoritesList.GetCommandForResult(result);
                    if (command != null)
                    {
                        SubmitCommand("EQUIP|" + command);
                    }
                    else
                    {
                        command = Configuration.GetConsoleCommandList().GetCommandForPhrase(result.Grammar);
                        if (command != null)
                        {
                            SubmitCommand("COMMAND|" + command);
                        }
                    }
                }
            }
        }
Exemple #2
0
        private void Recognizer_OnDialogueLineRecognized(RecognitionResult result)
        {
            string line = result.Text;

            lock (dialogueLock) {
                if (currentDialogue != null)
                {
                    int idx = currentDialogue.GetLineIndex(result.Grammar);
                    if (idx != -1)
                    {
                        SubmitCommand("DIALOGUE|" + currentDialogue.id + "|" + idx);
                    }
                }
                else
                {
                    string command = favoritesList.GetCommandForResult(result);
                    if (command != null)
                    {
                        SubmitCommand(command);
                        return;
                    }

                    command = spellBook.GetCommandForResult(result);
                    if (command != null)
                    {
                        SubmitCommand(command);
                        return;
                    }

                    command = shoutsKnowledge.GetCommandForResult(result);
                    if (command != null)
                    {
                        SubmitCommand(command);
                        return;
                    }

                    command = commandList.GetCommandForPhrase(result.Grammar);
                    if (command != null)
                    {
                        SubmitCommand(command);
                        return;
                    }

                    Trace.TraceWarning("Nothing regonised for grammer {} ", result.Grammar);
                }
            }
        }
        private void Recognizer_OnDialogueLineRecognized(RecognitionResult result)
        {
            string line = result.Text;

            lock (dialogueLock) {
                if (currentDialogue != null)
                {
                    int idx = currentDialogue.GetLineIndex(result.Grammar);
                    if (idx != -1)
                    {
                        SubmitCommand("DIALOGUE|" + currentDialogue.id + "|" + idx);
                    }
                }
                else
                {
                    string command = favoritesList.GetCommandForResult(result);
                    if (command != null)
                    {
                        SubmitCommand("EQUIP|" + command);
                    }
                    else
                    {
                        command = config.GetConsoleCommandList().GetCommandForPhrase(result.Grammar);
                        if (command != null)
                        {
                            // Starting with @ is the SRGS file, the command is in semantics
                            if (command[0] == '@')
                            {
                                command = result.Semantics.Value.ToString();
                            }
                            SubmitCommand("COMMAND|" + command);
                        }
                    }
                }
            }
        }