A responder that responds to events with a speech
Inheritance: EDDIResponder
示例#1
0
        private void testScript(object sender, RoutedEventArgs e)
        {
            Script          script    = ((KeyValuePair <string, Script>)((Button)e.Source).DataContext).Value;
            SpeechResponder responder = new SpeechResponder();

            responder.Start();
            // See if we have a sample
            Event  sampleEvent;
            object sample = Events.SampleByName(script.Name);

            if (sample == null)
            {
                sampleEvent = null;
            }
            else if (sample is string)
            {
                // It's as tring so a journal entry.  Parse it
                sampleEvent = JournalMonitor.ParseJournalEntry((string)sample);
            }
            else if (sample is Event)
            {
                // It's a direct event
                sampleEvent = (Event)sample;
            }
            else
            {
                Logging.Warn("Unknown sample type " + sample.GetType());
                sampleEvent = null;
            }

            ScriptResolver scriptResolver = new ScriptResolver(Personality.Scripts);

            responder.Say(scriptResolver, script.Name, sampleEvent);
        }
示例#2
0
        private void testButtonClick(object sender, RoutedEventArgs e)
        {
            if (!SpeechService.Instance.eddiSpeaking)
            {
                ScriptRecoveryService.SaveRecoveryScript(ScriptValue,
                                                         ScriptName,
                                                         ScriptDescription,
                                                         Responder,
                                                         Priority,
                                                         _script.defaultValue);

                // Splice the new script in to the existing scripts
                ScriptValue = scriptView.Text;
                Dictionary <string, Script> newScripts = new Dictionary <string, Script>(_scripts);
                Script testScript = new Script(ScriptName, ScriptDescription, false, ScriptValue);
                newScripts.Remove(ScriptName);
                newScripts.Add(ScriptName, testScript);

                SpeechResponder speechResponder = new SpeechResponder();
                speechResponder.Start();
                speechResponder.TestScript(ScriptName, newScripts);
            }
            else
            {
                SpeechService.Instance.ShutUp();
            }
        }
示例#3
0
        private void testButtonClick(object sender, RoutedEventArgs e)
        {
            ScriptRecoveryService.SaveRecoveryScript(ScriptValue,
                                                     ScriptName,
                                                     ScriptDescription,
                                                     Responder,
                                                     Priority,
                                                     _script.defaultValue);
            // Splice the new script in to the existing scripts
            ScriptValue = scriptView.Text;
            Dictionary <string, Script> newScripts = new Dictionary <string, Script>(_scripts);
            Script testScript = new Script(ScriptName, ScriptDescription, false, ScriptValue);

            newScripts.Remove(ScriptName);
            newScripts.Add(ScriptName, testScript);

            SpeechResponder speechResponder = new SpeechResponder();

            speechResponder.Start();

            // See if we have a sample
            List <Event> sampleEvents;
            object       sample = Events.SampleByName(_script.Name);

            if (sample == null)
            {
                sampleEvents = new List <Event>();
            }
            else if (sample is string)
            {
                // It's a string so a journal entry.  Parse it
                sampleEvents = JournalMonitor.ParseJournalEntry((string)sample);
            }
            else if (sample is Event)
            {
                // It's a direct event
                sampleEvents = new List <Event>()
                {
                    (Event)sample
                };
            }
            else
            {
                Logging.Warn("Unknown sample type " + sample.GetType());
                sampleEvents = new List <Event>();
            }

            ScriptResolver scriptResolver = new ScriptResolver(newScripts);

            if (sampleEvents.Count == 0)
            {
                sampleEvents.Add(null);
            }
            foreach (Event sampleEvent in sampleEvents)
            {
                speechResponder.Say(scriptResolver, ((ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor"))?.GetCurrentShip(), ScriptName, sampleEvent, scriptResolver.priority(_script.Name));
            }
        }
 private void testScript(object sender, RoutedEventArgs e)
 {
     if (!SpeechService.Instance.eddiSpeaking)
     {
         Script          script    = ((KeyValuePair <string, Script>)((Button)e.Source).DataContext).Value;
         SpeechResponder responder = new SpeechResponder();
         responder.Start();
         responder.TestScript(script.Name, Personality.Scripts);
     }
     else
     {
         SpeechService.Instance.ShutUp();
     }
 }
示例#5
0
        private void testScript(object sender, RoutedEventArgs e)
        {
            Script          script    = ((KeyValuePair <string, Script>)((Button)e.Source).DataContext).Value;
            SpeechResponder responder = new SpeechResponder();

            responder.Start();
            // See if we have a sample
            List <Event> sampleEvents;
            object       sample = Events.SampleByName(script.Name);

            if (sample == null)
            {
                sampleEvents = new List <Event>();
            }
            else if (sample is string)
            {
                // It's as tring so a journal entry.  Parse it
                sampleEvents = JournalMonitor.ParseJournalEntry((string)sample);
            }
            else if (sample is Event)
            {
                // It's a direct event
                sampleEvents = new List <Event>()
                {
                    (Event)sample
                };
            }
            else
            {
                Logging.Warn("Unknown sample type " + sample.GetType());
                sampleEvents = new List <Event>();
            }

            ScriptResolver scriptResolver = new ScriptResolver(Personality.Scripts);

            if (sampleEvents.Count == 0)
            {
                sampleEvents.Add(null);
            }
            foreach (Event sampleEvent in sampleEvents)
            {
                responder.Say(scriptResolver, ((ShipMonitor)EDDI.Instance.ObtainMonitor("Ship monitor"))?.GetCurrentShip(), script.Name, sampleEvent, scriptResolver.priority(script.Name));
            }
        }
示例#6
0
        private void testButtonClick(object sender, RoutedEventArgs e)
        {
            // Splice the new script in to the existing scripts
            Dictionary <string, Script> newScripts = new Dictionary <string, Script>(scripts);
            Script testScript = new Script(ScriptName, ScriptDescription, false, ScriptValue);

            newScripts.Remove(ScriptName);
            newScripts.Add(ScriptName, testScript);

            SpeechResponder responder = new SpeechResponder();

            responder.Start();

            // See if we have a sample
            Event  sampleEvent;
            object sample = Events.SampleByName(script.Name);

            if (sample == null)
            {
                sampleEvent = null;
            }
            else if (sample.GetType() == typeof(string))
            {
                // It's as tring so a journal entry.  Parse it
                sampleEvent = JournalMonitor.ParseJournalEntry((string)sample);
            }
            else if (sample.GetType() == typeof(Event))
            {
                // It's a direct event
                sampleEvent = (Event)sample;
            }
            else
            {
                Logging.Warn("Unknown sample type " + sample.GetType());
                sampleEvent = null;
            }

            ScriptResolver scriptResolver = new ScriptResolver(newScripts);

            responder.Say(scriptResolver, ScriptName, sampleEvent, 3, false);
        }
        private void testButtonClick(object sender, RoutedEventArgs e)
        {
            // Splice the new script in to the existing scripts
            Dictionary<string, Script> newScripts = new Dictionary<string, Script>(scripts);
            Script testScript = new Script(ScriptName, ScriptDescription, false, ScriptValue);
            newScripts.Remove(ScriptName);
            newScripts.Add(ScriptName, testScript);

            SpeechResponder responder = new SpeechResponder();
            responder.Start();

            // See if we have a sample
            Event sampleEvent;
            object sample = Events.SampleByName(script.Name);
            if (sample == null)
            {
                sampleEvent = null;
            }
            else if (sample.GetType() == typeof(string))
            {
                // It's as tring so a journal entry.  Parse it
                sampleEvent = JournalMonitor.ParseJournalEntry((string)sample);
            }
            else if (sample.GetType() == typeof(Event))
            {
                // It's a direct event
                sampleEvent = (Event)sample;
            }
            else
            {
                Logging.Warn("Unknown sample type " + sample.GetType());
                sampleEvent = null;
            }

            ScriptResolver scriptResolver = new ScriptResolver(newScripts);
            responder.Say(scriptResolver, ScriptName, sampleEvent, 3, false);
        }
        private void testScript(object sender, RoutedEventArgs e)
        {
            Script script = ((KeyValuePair<string, Script>)((Button)e.Source).DataContext).Value;
            SpeechResponder responder = new SpeechResponder();
            responder.Start();
            // See if we have a sample
            Event sampleEvent;
            object sample = Events.SampleByName(script.Name);
            if (sample == null)
            {
                sampleEvent = null;
            }
            else if (sample.GetType() == typeof(string))
            {
                // It's as tring so a journal entry.  Parse it
                sampleEvent = JournalMonitor.ParseJournalEntry((string)sample);
            }
            else if (sample.GetType() == typeof(Event))
            {
                // It's a direct event
                sampleEvent = (Event)sample;
            }
            else
            {
                Logging.Warn("Unknown sample type " + sample.GetType());
                sampleEvent = null;
            }

            ScriptResolver scriptResolver = new ScriptResolver(Personality.Scripts);
            responder.Say(scriptResolver, script.Name, sampleEvent);
        }