Exemple #1
0
    private void OnUserLoginClick(Face f, GameObject panelInstance)
    {
        CloudUserData userData = CloudUserData.Instance;

        if (userData)
        {
            userData.selectedUser = f;
        }

        // SetHintText("Selected: " + (userData ? userData.selectedUser.candidate.person.name : "-"));

        CloudUserManager userManager      = CloudUserManager.Instance;
        CloudFaceManager cloudFaceManager = CloudFaceManager.Instance;
        Person           person           = userData.selectedUser.candidate.person;
        StringBuilder    sbPerson         = new StringBuilder();
        CultureInfo      culture          = new CultureInfo("en-US");

        string groupId = userManager ? userManager.userGroupId : "";
        string checkIn = System.DateTime.Now.ToString("g", culture);         // Timestamp on "Check In" Press

        person.userData += string.Format("|CheckIn={0}", checkIn);
        cloudFaceManager.UpdatePersonData(groupId, person);

        sbPerson.Append(person.name).AppendLine()
        .AppendLine(person.userData).AppendLine()
        .AppendLine("Person Updated in Cloud").AppendLine();

        Debug.Log(sbPerson.ToString());
        panelInstance.gameObject.SetActive(false);
        SetHintText(string.Format("{0} Checked In", person.name));

        // load the main scene
        // SceneManager.LoadScene(1);
    }
    /// <summary>
    /// Updates the person's name or userData field.
    /// </summary>
    /// <param name="person">Person to be updated.</param>
    public void UpdateUserData(Person person)
    {
        if (userGroupId != initedGroupId)
        {
            GetOrGreateUserGroup();
        }
        if (userGroupId != initedGroupId)
        {
            return;
        }

        if (faceManager != null && !string.IsNullOrEmpty(userGroupId) && person != null)
        {
            faceManager.UpdatePersonData(userGroupId, person);
        }
    }