Пример #1
0
    public void UpdateMember(GroupMember member)
    {
        User currentUser = UserService.user;

        this.member = member;

        Image crownBg = toggleAdmin.GetComponent <Image>();

        if (member.is_admin)
        {
            crownIcon.SetActive(true);
            crownBg.color = COLOR_RED;
        }
        else
        {
            crownIcon.SetActive(false);
            crownBg.color = COLOR_GREEN;
        }

        if (currentUser._id == member._user)
        {
            isCurrentUser = true;

            logoutButton.gameObject.SetActive(true);
            toggleAdmin.gameObject.SetActive(false);
            removeButton.gameObject.SetActive(false);

            UpdateFields();
        }
        else
        {
            isCurrentUser = false;

            if (GroupsService.CurrentUserIsAdmin())
            {
                logoutButton.gameObject.SetActive(false);
                toggleAdmin.gameObject.SetActive(true);
                removeButton.gameObject.SetActive(true);
            }
            else
            {
                logoutButton.gameObject.SetActive(false);
                toggleAdmin.gameObject.SetActive(false);
                removeButton.gameObject.SetActive(false);
            }

            StartCoroutine(_GetMemberInfo());
        }
    }
Пример #2
0
 private void CheckAuthority()
 {
     if (GroupsService.CurrentUserIsAdmin())
     {
         newMemberBtn.gameObject.SetActive(true);
         newMessageBtn.gameObject.SetActive(true);
         removeGroupBtn.gameObject.SetActive(true);
         editGroup.gameObject.SetActive(true);
     }
     else
     {
         newMemberBtn.gameObject.SetActive(true);
         newMessageBtn.gameObject.SetActive(false);
         removeGroupBtn.gameObject.SetActive(false);
         editGroup.gameObject.SetActive(false);
     }
 }