/// <summary> /// Provided a personId, retrieve the person name associated with it /// </summary> internal IEnumerator GetPerson(string personId) { string getGroupEndpoint = $"{baseEndpoint}persongroups/{personGroupId}/persons/{personId}?"; WWWForm webForm = new WWWForm(); using (UnityWebRequest www = UnityWebRequest.Get(getGroupEndpoint)) { www.SetRequestHeader("Ocp-Apim-Subscription-Key", key); www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.SendWebRequest()); string jsonResponse = www.downloadHandler.text; Debug.Log($"Get Person - jsonResponse: {jsonResponse}"); //tempText.text = "Person: " + jsonResponse; IdentifiedPerson_RootObject identifiedPerson_RootObject = JsonConvert.DeserializeObject <IdentifiedPerson_RootObject>(jsonResponse); // Display the name of the person in the UI //tempText.text = identifiedPerson_RootObject.name + " | " + identifiedPerson_RootObject.personId; FaceRecName.instance.recName = identifiedPerson_RootObject.name; FaceRecName.instance.displayText.text = "Face Found:\n" + identifiedPerson_RootObject.name; FaceRecName.instance.Begin(); } }
/// <summary> /// Provided a personId, retrieve the person name associated with it /// </summary> internal IEnumerator GetPerson(string personId) { string getGroupEndpoint = $"{baseEndpoint}persongroups/{personGroupId}/persons/{personId}?"; WWWForm webForm = new WWWForm(); using (UnityWebRequest www = UnityWebRequest.Get(getGroupEndpoint)) { www.SetRequestHeader("Ocp-Apim-Subscription-Key", azureKey); www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.SendWebRequest()); string jsonResponse = www.downloadHandler.text; Debug.Log($"Get Person - jsonResponse: {jsonResponse}"); IdentifiedPerson_RootObject identifiedPerson_RootObject = JsonConvert.DeserializeObject <IdentifiedPerson_RootObject>(jsonResponse); // Display the name of the person in the UI labelText.text = identifiedPerson_RootObject.name; handles = identifiedPerson_RootObject.userData.Split('|'); CancelInvoke(); LoadInstagramContent(handles[1]); LoadTwitterContent(handles[0]); ui.SetActive(true); } }
/// <summary> /// Provided a personId, retrieve the person name associated with it /// </summary> internal IEnumerator GetPerson(string personId) { string getGroupEndpoint = $"{baseEndpoint}persongroups/{personGroupId}/persons/{personId}?"; WWWForm webForm = new WWWForm(); using (UnityWebRequest www = UnityWebRequest.Get(getGroupEndpoint)) { www.SetRequestHeader("Ocp-Apim-Subscription-Key", key); www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.SendWebRequest()); string jsonResponse = www.downloadHandler.text; Debug.Log($"Get Person - jsonResponse: {jsonResponse}"); IdentifiedPerson_RootObject identifiedPerson_RootObject = JsonConvert.DeserializeObject <IdentifiedPerson_RootObject>(jsonResponse); //star.SetActive(false); // Display the name of the person in the UI if (identifiedPerson_RootObject.name.Equals("Andrew Chang")) { Tanmoy.SetActive(false); Jon.SetActive(false); modelT.SetActive(false); modelJ.SetActive(false); Andrew.SetActive(true); modelA.SetActive(true); } else if (identifiedPerson_RootObject.name.Equals("Tanmoy Panigrahi")) { Jon.SetActive(false); Andrew.SetActive(false); modelA.SetActive(false); modelJ.SetActive(false); Tanmoy.SetActive(true); modelT.SetActive(true); } else if (identifiedPerson_RootObject.name.Equals("Jon Womack")) { Andrew.SetActive(false); Tanmoy.SetActive(false); modelT.SetActive(false); modelA.SetActive(false); Jon.SetActive(true); modelJ.SetActive(true); } //labelText.text = identifiedPerson_RootObject.name; } }
/// <summary> /// Provided a personId, retrieve the person name associated with it /// </summary> internal IEnumerator GetPerson(string personId) { string getGroupEndpoint = $"{baseEndpoint}persongroups/{personGroupId}/persons/{personId}?"; WWWForm webForm = new WWWForm(); using (UnityWebRequest www = UnityWebRequest.Get(getGroupEndpoint)) { www.SetRequestHeader("Ocp-Apim-Subscription-Key", key); www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.SendWebRequest()); string jsonResponse = www.downloadHandler.text; Debug.Log($"Get Person - jsonResponse: {jsonResponse}"); IdentifiedPerson_RootObject identifiedPerson_RootObject = JsonConvert.DeserializeObject <IdentifiedPerson_RootObject>(jsonResponse); SetTagsToLastLabel(identifiedPerson_RootObject.name); } }
/// <summary> /// Provided a personId, retrieve the person name associated with it /// </summary> internal IEnumerator GetPerson(string personId) { string getGroupEndpoint = $"{baseEndpoint}persongroups/{personGroupId}/persons/{personId}?"; WWWForm webForm = new WWWForm(); using (UnityWebRequest www = UnityWebRequest.Get(getGroupEndpoint)) { www.SetRequestHeader("Ocp-Apim-Subscription-Key", Constants.MCS_FACEKEY); www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.SendWebRequest()); string jsonResponse = www.downloadHandler.text; Debug.Log($"Get Person - jsonResponse: {jsonResponse}"); IdentifiedPerson_RootObject identifiedPerson_RootObject = JsonConvert.DeserializeObject <IdentifiedPerson_RootObject>(jsonResponse); // Display the name of the person in the UI labelText.text = identifiedPerson_RootObject.name; ttsManager.StartSpeaking("This is {identifiedPerson_RootObject.name}."); } }
///step 13 /// /// <summary> /// Provided a personId, retrieve the person name associated with it /// </summary> internal IEnumerator GetPerson(string personId) { string getGroupEndpoint = $"{baseEndpoint}persongroups/{personGroupId}/persons/{personId}?"; WWWForm webForm = new WWWForm(); using (UnityWebRequest www = UnityWebRequest.Get(getGroupEndpoint)) { www.SetRequestHeader("Ocp-Apim-Subscription-Key", key); www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.SendWebRequest()); string jsonResponse = www.downloadHandler.text; Debug.Log($"Get Person - jsonResponse: {jsonResponse}"); IdentifiedPerson_RootObject identifiedPerson_RootObject = JsonConvert.DeserializeObject <IdentifiedPerson_RootObject>(jsonResponse); // Display the name of the person in the UI labelText.text = identifiedPerson_RootObject.name; currentPerson = identifiedPerson_RootObject.name; analyzing = false; Debug.Log("~~~PERSON FOUND: " + identifiedPerson_RootObject.name); } }