Пример #1
0
    IEnumerator GetMarket()
    {
        Debug.Log("Getting Market Data.......");
        UnityWebRequest www2 = UnityWebRequest.Get("https://eddb.io/archive/v5/listings.csv");

        yield return(www2.SendWebRequest());

        if (www2.isNetworkError || www2.isHttpError)
        {
            UnityEngine.Debug.Log(www2.error);
        }
        else
        {
            Debug.Log("Getting Market Data.......");
            SystemDump = www2.downloadHandler.text;
            string[] Marketdata = SystemDump.Split("\n"[0]);
            foreach (string line in Marketdata)
            {
                try
                {
                    string[] Markets = line.Split(","[0]);
                    EDDBMarkets.Add(new Markets {
                        Commodity_id = Markets[2], Supply = Markets[3], buy_price = Markets[5], sell_price = Markets[6]
                    });
                }
                catch (Exception)
                {
                }
            }
            Debug.Log(EDDBMarkets[0].Commodity_id);
        }
        WindowsVoice.speak("Market Data Loaded", 0);
    }
Пример #2
0
    public void DeleteNavigationPoint(int navigationNumber)
    {
        if (sharedData.savedPlacesOnMap.Count > navigationNumber)
        {
            GameObject iconInstance = sharedData.savedPlacesOnMap[navigationNumber - 1];
            //sharedData.savedPlacesOnMap.RemoveAt(navigationNumber - 1);
            sharedData.savedPlacesOnMap.Remove(iconInstance);
            Destroy(iconInstance);

            //Refresh der Nummerierung aller restlichen Orte
            int i = 1;
            foreach (GameObject otherIcon in sharedData.savedPlacesOnMap)
            {
                Text iconText = otherIcon.transform.Find("Image").Find("Text").GetComponent <Text>();
                Debug.LogFormat("Nummer des Ortes war {0} bei Index {1}...", iconText.text, i);
                iconText.text = i.ToString();
                Debug.LogFormat("...ist nun: {0}", iconText.text);
                i++;
            }

            //Löse Intent aus der NLU informiert, falls nun alle Orte entfernt wurden
            if (sharedData.savedPlacesOnMap.Count == 0)
            {
                EventManager.TriggerEvent(EventManager.asrRequerstDetectedEvent, new EventMessageObject(EventManager.asrRequerstDetectedEvent, "Alle gespeicherten Orte sind nun entfernt"));
            }
        }
        else
        {
            WindowsVoice.speak(string.Format("Ich konnte keinen Ort mit Nummer {0} finden.", navigationNumber), 3);
        }
    }
Пример #3
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.T))
     {
         WindowsVoice.getInstance().test();
     }
 }
Пример #4
0
    IEnumerator GetCommodityList()
    {
        UnityWebRequest www2 = UnityWebRequest.Get("https://eddb.io/archive/v5/commodities.json");

        yield return(www2.SendWebRequest());

        if (www2.isNetworkError || www2.isHttpError)
        {
            UnityEngine.Debug.Log(www2.error);
        }
        else
        {
            SystemDump = www2.downloadHandler.text;
            string[] Marketdata = SystemDump.Split("}}"[0]);
            foreach (string line in Marketdata)

            {
                Debug.Log(line);
                try
                {
                    Commodities eddbCommodity = JsonConvert.DeserializeObject <Commodities>(line);
                    Debug.Log(line);
                    EDDBCommodity.Add(new Commodities {
                        name = eddbCommodity.name, id = eddbCommodity.id
                    });
                }
                catch (Exception)
                {
                }
            }
        }
        Debug.Log(EDDBCommodity.Count);
        WindowsVoice.speak("Commodity Data Loaded", 0);
    }
Пример #5
0
    public void SendText(string text)
    {
        ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
            return(true);
        };

        try {
            var response = apiAiUnity.TextRequest(text);
            if (response != null)
            {
                string outText     = JsonConvert.SerializeObject(response);
                string targetBegin = "\"speech\":\"";
                string targetEnd   = "\"},\"source\"";
                String result      = getStringInBetween(outText, targetBegin, targetEnd);

                Debug.Log("Result: " + result);
                WindowsVoice.speak(result);
            }
            else
            {
                Debug.LogError("Response is null");
            }
        }
        catch (Exception ex) {
            Debug.LogException(ex);
        }
    }
Пример #6
0
 void OnEnable()
 {
     if (theVoice == null)
     {
         theVoice = this;
     }
 }
Пример #7
0
 private void Start()
 {
     WindowsVoice.speak("Welcome To The Remlok Intelligent H U D", 0);
     GetEDDB();
     //   GetFile();
     InvokeRepeating("UpdateLists", 0, 1);
 }
Пример #8
0
    IEnumerator GetText()
    {
        UnityWebRequest www = UnityWebRequest.Get("https://eddb.io/archive/v5/systems_populated.jsonl");

        yield return(www.SendWebRequest());

        if (www.isNetworkError || www.isHttpError)
        {
            UnityEngine.Debug.Log(www.error);
        }
        else
        {
            SystemDump = www.downloadHandler.text;
            string[] systemdata = SystemDump.Split("\n"[0]);
            foreach (string line in systemdata)
            {
                try
                {
                    Systems eddb = JsonConvert.DeserializeObject <Systems>(line);
                    EDDBData.Add(new Systems {
                        name = eddb.name, x = eddb.x, y = eddb.y, z = eddb.z
                    });
                }
                catch (Exception)
                {
                }
            }
        }
        WindowsVoice.speak("Cartographic Data Loaded", 0);
        MissionCleanse();
        WindowsVoice.speak("Mission System Online", 0);
        Debug.Log("System Data loaded");
    }
Пример #9
0
 void OnDestroy()
 {
     if (theVoice == this)
     {
         destroySpeech();
         theVoice = null;
     }
 }
Пример #10
0
 void Speak(string s)
 {
             #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
     WindowsVoice.Speak(s);
             #else
     InfinityEngine.Localization.SpeechEngine.Speak(s);
             #endif
 }
Пример #11
0
 public void StopSpeech()
 {
     if (voice != null)
     {
         Destroy(voice);
         voice = null;
     }
 }
Пример #12
0
 public void Speak(String _textToDisplay, Text _ausgabefeld = null)
 {
     if (_ausgabefeld != null)
     {
         DisplayText(_ausgabefeld, _textToDisplay);  //nur solange keine TTS implementiert
     }
     WindowsVoice.speak(_textToDisplay);
 }
Пример #13
0
    private void Start()
    {
        Factionpath = Application.dataPath + "/Resources/Factions.json";
        MissionPath = Application.dataPath + "/Resources/missionlist.json";
        WindowsVoice.speak("Welcome To The Remlok Intelligent H U D", 0);
        GetEDDB();

        InvokeRepeating("UpdateLists", 0, 1f);
    }
Пример #14
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         Debug.Log("Initializing speech");
         initSpeech();
     }
 }
Пример #15
0
 void OnDestroy()
 {
     if (instance == this)
     {
         Debug.Log("Destroying speech");
         destroySpeech();
         instance = null;
     }
 }
Пример #16
0
 void OnDestroy()
 {
     if (theVoice == this)
     {
       Debug.Log("Destroying speech");
       destroySpeech();
       theVoice = null;
     }
 }
Пример #17
0
 // Use this for initialization
 void Start()
 {
     if (theVoice == null)
     {
         theVoice = this;
         DontDestroyOnLoad(gameObject);
         initSpeech();
     }
 }
Пример #18
0
    public void Speak(ThingPart thingPart, string text, VoiceProperties properties)
    {
        if (voice == null)
        {
            try
            {
                voice = gameObject.AddComponent <WindowsVoice>() as WindowsVoice;
                voice.Init();
            }
            catch (Exception exception)
            {
                voice = null;
                Log.Debug("Failed to initialize Windows Voice");
            }
        }

        if (voice != null)
        {
            bool  hasSurroundSound = false;
            Thing thing            = thingPart.transform.parent.gameObject.GetComponent <Thing>();
            if (thing != null)
            {
                hasSurroundSound = thing.hasSurroundSound;
            }

            Vector3 ourPosition = Managers.personManager.ourPerson.Head.transform.position;
            float   distance    = Vector3.Distance(ourPosition, thingPart.transform.position);

            const float maxDistanceToHear     = 12.5f;
            const float startOfHearingFallOff = 2f;
            float       relativeVolume        = 1f;
            if (distance > startOfHearingFallOff && !hasSurroundSound)
            {
                relativeVolume = 1f - (distance - startOfHearingFallOff) /
                                 (maxDistanceToHear - startOfHearingFallOff);
            }

            const float generalVolumeAdjust = 0.5f;
            relativeVolume *= generalVolumeAdjust;

            if (properties == null)
            {
                properties = new VoiceProperties();
            }

            VoiceProperties adjustedProperties = new VoiceProperties();
            adjustedProperties.gender = properties.gender;
            adjustedProperties.volume = (int)((float)properties.volume * relativeVolume);
            adjustedProperties.pitch  = properties.pitch;
            adjustedProperties.speed  = properties.speed;

            if (adjustedProperties.volume > 0)
            {
                voice.Speak(text, adjustedProperties);
            }
        }
    }
Пример #19
0
    public void SendChat(string text)
    {
        //print(GetSocket.SocketSendReceive(server,Convert.ToInt32(port),user + Char.MinValue + bot + Char.MinValue +text.text+ Char.MinValue));
        //netSock.SendMsg("\0"+"\0"+"\0");
        string msg = user + " " + bot + " " + text;

        print("Message to send: " + msg);
        WindowsVoice.Speak(netSock.SendMsg(user, bot, text));
    }
Пример #20
0
 void OnDestroy()
 {
     if (theVoice == this)
     {
         Debug.Log("Destroying speech");
         destroySpeech();
         theVoice = null;
     }
 }
Пример #21
0
 // Use this for initialization
 void OnEnable()
 {
     if (theVoice == null)
     {
         theVoice = this;
         Debug.Log("Initializing speech");
         initSpeech();
     }
 }
Пример #22
0
 void OnDestroy()
 {
     skip();
     if (theVoice == this)
     {
         Log("Destroying speech");
         destroySpeech();
         theVoice = null;
     }
 }
Пример #23
0
    // Update is called once per frame
    void Update()
    {
        time += Time.deltaTime;

        if (time >= T)

        {
            WindowsVoice.speak("Draw a " + word);
        }
    }
Пример #24
0
 // Use this for initialization
 void OnEnable()
 {
     if (theVoice == null)
     {
         theVoice = this;
         initSpeech();
     }
     //else
     //Destroy(gameObject);
 }
Пример #25
0
    public void ProcessOutput(ApiAiSDK.Model.AIResponse res)
    {
        string outText = JsonConvert.SerializeObject(res);

        Debug.Log(outText);
        string result = res.Result.Fulfillment.Speech;//getStringInBetween(outText, targetBegin, targetEnd);

        Debug.Log("Result: " + result);
        WindowsVoice.speak(result);
    }
Пример #26
0
    private void OnPhraseRecognized(PhraseRecognizedEventArgs args)
    {
        WindowsVoice.Speak("Initiating " + args.text);
        keywords[args.text].Invoke();
        StringBuilder builder = new StringBuilder();

        builder.AppendFormat("{0} ({1}){2}", args.text, args.confidence, Environment.NewLine);
        builder.AppendFormat("Timestamp: {0}{1}", args.phraseStartTime, Environment.NewLine);
        builder.AppendFormat("Duration: {0} seconds{1}", args.phraseDuration.TotalSeconds, Environment.NewLine);
        Debug.Log(builder.ToString());
    }
Пример #27
0
 // Use this for initialization
 void Start()
 {
     if (theVoice == null)
     {
       theVoice = this;
       DontDestroyOnLoad(gameObject);
       initSpeech();
     }
     //else
       //Destroy(gameObject);
 }
Пример #28
0
    // Use this for initialization
    void Start()
    {
        m_Chat          = new ChatData();
        m_Chat.endPoint = m_Endpoints[0].endPoint;
        m_Chat.apiKey   = m_Endpoints[0].apiKey;

        m_ConversationCanvas = GameObject.FindGameObjectWithTag("ConversationCanvas").gameObject;
        m_UserInput          = m_ConversationCanvas.transform.Find("UserInput").transform.Find("Text Area").transform.Find("Text").gameObject.GetComponent <TMPro.TextMeshProUGUI>();
        m_AvatarInput        = m_ConversationCanvas.transform.Find("AvatarResponse").GetComponent <TMPro.TextMeshProUGUI>();

        WindowsVoice.speak("リトルプラネットへようこそ");
    }
Пример #29
0
        private bool internal_HandleSelection(int selection)
        {
            PersonType type       = selection == 0 ? sessionDetails.type2 : sessionDetails.type1;
            PersonType talkerType = selection == 0 ? sessionDetails.type1 : sessionDetails.type2;
            string     talkerName = selection == 0 ? sessionDetails.name1 : sessionDetails.name2;

            WindowsVoice.getInstance().speak(talkerName, GetTypePrefix(talkerType), PhraseGenerator.getPhrase(sessionDetails.currentIndex, type));
            bool correct = sessionDetails.correctAnswerIndex[sessionDetails.currentIndex++] == selection;

            sessionEnded = sessionDetails.currentIndex >= sessionDetails.correctAnswerIndex.Count;
            return(correct);
        }
Пример #30
0
 // Use this for initialization
 void Start()
 {
     if (theVoice == null)
     {
         theVoice = this;
         DontDestroyOnLoad(gameObject);
         Debug.Log("Initiating speech");
         initSpeech();
     }
     //else
     //Destroy(gameObject);
 }
Пример #31
0
 public void OnPayChipClick()
 {
     if (Player == Game.theGame.CurrentPlayer)
     {
         if (Player.NumChips > 0)
         {
             Timeline.theTimeline.addEvent(new PPayChip());
         }
         else
         {
             WindowsVoice.speak("Out of chips");
         }
     }
 }
    private void Awake()
    {
        if (!sharedData.TrainingMode)  //aktiviere Sprachassistent nicht beim ML Training -> Keywords können Simulation stören
        {
            asr     = gameObject.AddComponent <ASR>();
            nlu     = gameObject.AddComponent <NLU>();
            actions = gameObject.AddComponent <IPAAction>();
            tts     = gameObject.AddComponent <WindowsVoice>();


            CallNLU       = new UnityAction <EventMessageObject>(SendTextToNLU);
            Print         = new UnityAction <EventMessageObject>(PrintMessageBody);
            IntentHandler = new UnityAction <EventMessageObject>(HandleIntent);
        }
    }