public void initLuisStucts() { GameObject.Find("Holder").GetComponent <GetNMLocations> ().getNMLocationsAll(); LuisStruct luisStruct = new LuisStruct(); luisStruct.intent = "UWM - Snacks"; luisStruct.routeID = "1"; luisStruct.sentence = "Follow me to the treats"; luisStructs.Add(luisStruct); luisDictionary [luisStruct.intent] = luisStruct; luisStruct = new LuisStruct(); luisStruct.intent = "UWM - Food Tables"; luisStruct.routeID = "2"; luisStruct.sentence = "Let me take you to lunch."; luisStructs.Add(luisStruct); luisDictionary [luisStruct.intent] = luisStruct; luisStruct = new LuisStruct(); luisStruct.intent = "NMW - Security to Fast Track"; luisStruct.sentence = "Follow me to Fast Track"; luisStruct.routeID = "3"; luisStructs.Add(luisStruct); luisDictionary [luisStruct.intent] = luisStruct; luisStruct = new LuisStruct(); luisStruct.intent = "NMW - Fast Track to Restroom"; luisStruct.sentence = "I will show you the way to the restrooms"; luisStruct.routeID = "4"; luisStructs.Add(luisStruct); luisDictionary [luisStruct.intent] = luisStruct; luisStruct = new LuisStruct(); luisStruct.intent = "NMW - Fast Track to Cafeteria"; luisStruct.sentence = "Follow me to the cafeteria"; luisStruct.routeID = "5"; luisStructs.Add(luisStruct); luisDictionary [luisStruct.intent] = luisStruct; luisStruct = new LuisStruct(); luisStruct.intent = "NWM - Fast Track to Security"; luisStruct.sentence = "This way to Security"; luisStruct.routeID = "6"; luisStructs.Add(luisStruct); luisDictionary [luisStruct.intent] = luisStruct; }
public void ProcessPayload(string payload) { string top = JsonHelper2.GetJsonObject(payload, "topScoringIntent"); // string theintent = JsonHelper2.GetJsonObject (top, "intent".IndexOf); //int pos = top.Substring string[] parts = top.Split(":"[0]); string[] pts = parts [1].Split(","[0]); string intent = pts [0]; intent = intent.Substring(2); intent = intent.Substring(0, intent.Length - 1); LuisStruct luisStruct = luisDictionary [intent]; if (luisStruct.routeID == "5") { GlobalManager.lunchcube.SetActive(true); } else { GlobalManager.lunchcube.SetActive(false); } if (luisStruct.routeID == "3") { GlobalManager.videocuber.SetActive(true); } else { GlobalManager.videocuber.SetActive(false); } print("**********the Luis data is********: " + luisStruct.sentence); //call mp3 GameObject.Find("Holder").GetComponent <GetNMLocations> ().getNMLocationByID(luisStruct.routeID); GameObject.Find("Holder").GetComponent <MP3Call> ().callMP3WithString(luisStruct.sentence); //print("**********the Luis intent is********: " + theintent); }