private void RefreshUsers(string group, bool isOnGroupSelect)
        {
            var users = FriendsMenuHelper.GetUsersByGroup(group);

            users = FilterUsersByStartWord(users, userSearchBox.text);

            usersContainer.Clear();

            if (users != null && users.Count > 0)
            {
                if (isOnGroupSelect)
                {
                    userSearchBox.gameObject.SetActive(true);
                }

                DisableEmptyGroupMessages();
                users.ForEach(u =>
                {
                    var go = usersContainer.AddItem(userPrefabProvider.GetValue());
                    go.GetComponent <FriendUI>().Initialize(u);
                });
            }
            else if (isOnGroupSelect)
            {
                userSearchBox.gameObject.SetActive(false);
                EnableEmptyGroupMessage(group);
            }
        }
Ejemplo n.º 2
0
 void Start()
 {
     if (groupsController != null)
     {
         FriendsMenuHelper.RefreshGroups(groupsController, FriendsMenuHelper.ADD_FRIENDS_GROUP);
         Action <string> groupChangedCallback = group =>
         {
             FriendsMenuHelper.RefreshGroups(groupsController, group);
             DemoController.Instance.SetState(MenuState.Friends);
         };
         groupsController.GroupSelectedEvent += _ => groupsController.GroupSelectedEvent -= groupChangedCallback;
         groupsController.GroupSelectedEvent += groupChangedCallback;
     }
 }
 void Start()
 {
     if (groupsController != null)
     {
         groupsController.GroupSelectedEvent += group =>
         {
             if (group.Equals(FriendsMenuHelper.ADD_FRIENDS_GROUP))
             {
                 DemoController.Instance.SetState(MenuState.SocialFriends);
             }
             else
             {
                 userSearchBox.text = string.Empty;
                 RefreshUsers(group, isOnGroupSelect: true);
             }
         };
         FriendsMenuHelper.RefreshGroups(groupsController);
         if (userSearchBox != null)
         {
             userSearchBox.onValueChanged.AddListener(_ => RefreshUsers(groupsController.GetSelectedGroup().Name, isOnGroupSelect: false));
         }
     }
 }