Esempio n. 1
0
    private void Start()
    {
        m_Error = new Error.ErrorResponse();
        m_PersonCreatedSuccess = new PersonCreateSuccess.PersonCreateSuccessResponse();
        m_TrainingStatus       = new Training.TrainingStatus();
        m_ListOfPersonsInGroup = new List <PersonInGroup.Person>();

        m_AzureManager = GetComponent <AzureManager>();
        m_ApiKey       = m_AzureManager.GetApiKey();
        m_Endpoint     = m_AzureManager.GetEndpoint();
    }
Esempio n. 2
0
    IEnumerator CheckPersonIdExists(string name, string birthday)
    {
        string personListInGroup = "";

        Debug.Log("CheckPersonIdExists : " + m_ActivePersonGroup);
        yield return(RequestManager.GetPersonListInGroup(m_AzureManager.GetEndpoint(), m_AzureManager.GetApiKey(), m_ActivePersonGroup, value => personListInGroup = value));

        Debug.Log("back to CheckPersonIdExists and personListInGroup : " + personListInGroup);
        if (personListInGroup != null)
        {
            PersonInGroup.Person[] personList = JsonHelper.getJsonArray <PersonInGroup.Person>(personListInGroup);

            // If the personList is not empty, it means the person ID has been used before. TODO : restart registration flow to use a different person ID
            if (personList.Length > 0)
            {
                foreach (PersonInGroup.Person person in personList)
                {
                    if (person.name.Equals(name))
                    {
                        personId = person.personId;
                        m_WebcamManager.SetPersonId(personId);
                        Debug.Log("This person exists, personId is : " + personId);
                    }
                }
            }
            else
            {
                // the personList is empty which means the person ID has not been used before, so create a new person with this ID
                Debug.Log("person list returned empty. creating...");
                StartCoroutine(CreatePersonInPersonGroup(m_ActivePersonGroup, name, birthday));
            }
        }
        else
        {
            Debug.Log("person list returned null. creating...");
            StartCoroutine(CreatePersonInPersonGroup(m_ActivePersonGroup, name, birthday));
        }
    }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        WindowsVoice.speak("こんにちは。写真を登録してください。");

        retrievedHoroscope += OnRetrievedHoroscope;

        StartCoroutine(NetworkManager.GetRequest("http://api.jugemkey.jp/api/horoscope/free/2019/05/20", retrievedHoroscope));

        m_WebcamManager = GameObject.FindGameObjectWithTag("CameraManager").GetComponent <WebcamManager>();
        m_AzureManager  = GameObject.FindGameObjectWithTag("AzureManager").GetComponent <AzureManager>();
        m_BaseManager   = GameObject.Find("BaseManager").GetComponent <BaseManager>();


        m_ActivePersonGroup = GetPersonGroupId();

        m_StatusText    = GameObject.FindGameObjectWithTag("Status").GetComponent <TMPro.TextMeshProUGUI>();
        m_GroupNameText = GameObject.FindGameObjectWithTag("GroupNameText").GetComponent <TMPro.TextMeshProUGUI>();

        m_Endpoint = m_AzureManager.GetEndpoint();
        m_ApiKey   = m_AzureManager.GetApiKey();

        m_CreatePersonButton = GameObject.FindGameObjectWithTag("CreatePersonButton").GetComponent <Button>();
        m_CreatePersonButton.onClick.AddListener(() => {
            if (!m_CreatePersonButtonClicked)
            {
                string name     = GetCurrentPersonName();
                string birthday = GetCurrentPersonBirthday();
                if (!name.Equals("null") && !birthday.Equals("null"))
                {
                    Debug.Log("Checking if person Id exists...");
                    StartCoroutine(CheckPersonIdExists(name, birthday));
                    m_CreatePersonButtonClicked = true;
                }
            }
        });

        m_AddFacesButton = GameObject.FindGameObjectWithTag("AddFacesButton").GetComponent <Button>();
        m_AddFacesButton.onClick.AddListener(() => {
            // TODO : add body
            Debug.Log("Add faces body");
            AddFacesToAzure();
        });
    }