private void populateRecentlyViewed()
        {
            GFriendsManager       friendsMgr     = GFriendsManager.Instance;
            List <RecentlyViewed> recentlyViewed = new List <RecentlyViewed>();

            if (GFriendsManager.Instance.RecentlyViewed != null)
            {
                Array previousMembers = (Array)friendsMgr.RecentlyViewed["previousMembers"];
                foreach (Dictionary <string, object> dict in previousMembers)
                {
                    // Add only the non-serverBot players into the RecentlyViewed list.
                    if (!(dict["ProfileId"] as string).Contains("serverBot"))
                    {
                        if (!friendsMgr.IsProfileIdInFriendsList(dict["ProfileId"] as string))
                        {
                            recentlyViewed.Add(new RecentlyViewed(dict));
                        }
                    }
                }
            }

            if (recentlyViewed.Count > 0)
            {
                // find the entity for recently viewed,
                Text newField = GEntityFactory.Instance.CreateObject(m_titleText, Vector3.zero, Quaternion.identity, SearchResultsScrollView.transform).GetComponent <Text>();
                newField.text = "    RECENTLY VIEWED";

                // put them all on
                foreach (RecentlyViewed newData in recentlyViewed)
                {
                    FriendsListItem newItem = CreateFriendsListItem(SearchResultsScrollView.transform);
                    newItem.Init(newData, true, false);
                }
            }
        }
Exemplo n.º 2
0
        private void PopulateFriendsScrollView(List <PlayerData> in_friendsItems, List <FriendsListItem> in_friendsListItem, RectTransform in_scrollView, bool in_add, bool in_remove)
        {
            RemoveAllCellsInView(in_friendsListItem);
            NoFriendsOnline.gameObject.SetActive(true);
            if (in_friendsItems.Count == 0)
            {
                return;
            }

            if (in_scrollView != null)
            {
                List <PlayerData> activeListData = in_friendsItems;
                for (int i = 0; i < activeListData.Count; ++i)
                {
                    FriendsListItem newItem = CreateFriendsListItem(in_scrollView);
                    newItem.Init(activeListData[i], in_add, in_remove);
                    newItem.transform.localPosition = new Vector3(0.0f, 0.0f);
                    newItem.RefreshOnlineVisibility();
                    if (newItem.ItemData.Presence.IsOnline)
                    {
                        NoFriendsOnline.gameObject.SetActive(false);
                    }

                    in_friendsListItem.Add(newItem);
                }
            }
        }
Exemplo n.º 3
0
        private FriendsListItem CreateFriendsListItem(Transform in_parent = null, bool isYou = false)
        {
            FriendsListItem toReturn = null;

            toReturn = (GEntityFactory.Instance.CreateResourceAtPath(isYou ? "Prefabs/UI/youCell" : "Prefabs/UI/friendCell", in_parent.transform)).GetComponent <FriendsListItem>();
            toReturn.transform.SetParent(in_parent);
            toReturn.transform.localScale = Vector3.one;
            return(toReturn);
        }
        private void PopulateFriendsScrollView(List <PlayerData> in_friendsItems, List <FriendsListItem> in_friendsListItem, RectTransform in_scrollView, bool in_add, bool in_remove)
        {
            RemoveAllCellsInView(in_scrollView, in_friendsListItem);

            if (in_scrollView != null && in_friendsItems != null)
            {
                for (int i = 0; i < in_friendsItems.Count; ++i)
                {
                    FriendsListItem newItem = CreateFriendsListItem(in_scrollView);
                    newItem.Init(in_friendsItems[i], in_add, in_remove);
                    newItem.transform.localPosition = new Vector3(0.0f, 0.0f);
                    in_friendsListItem.Add(newItem);
                }
            }
        }