Exemplo n.º 1
0
        /// <summary>
        /// Fill the community panel with friends (or blacklisted gamers).
        /// </summary>
        /// <param name="friendsList">List of the friends to display.</param>
        public void FillCommunityPanel(NonpagedList <GamerInfo> friendsList)
        {
            // Clear the community panel
            ClearCommunityPanel(false);

            // If there are friends to display, fill the community panel with friend prefabs
            if ((friendsList != null) && (friendsList.Count > 0))
            {
                foreach (GamerInfo friend in friendsList)
                {
                    // Create a community friend GameObject and hook it at the community items layout
                    GameObject prefabInstance = Instantiate <GameObject>(communityFriendPrefab);
                    prefabInstance.transform.SetParent(communityItemsLayout.transform, false);

                    // Fill the newly created GameObject with friend data
                    CommunityFriendHandler communityFriendHandler = prefabInstance.GetComponent <CommunityFriendHandler>();
                    communityFriendHandler.FillData(friend["profile"]);

                    // Add the newly created GameObject to the list
                    communityItems.Add(prefabInstance);
                }
            }
            // Else, show the "no friend" text
            else
            {
                noFriendText.SetActive(true);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Build a "friend's relationship changed" event type then add it to the pending list to display. (events are displayed one by one)
        /// </summary>
        /// <param name="eventMessage">Message of the event. (describes the relationship change)</param>
        /// <param name="friendProfile">Profile of the friend whith who the relationship changed under the Bundle format.</param>
        /// <param name="relationship">Type of relationship which has been set.</param>
        public void BuildAndAddEventItem_FriendRelationshipChanged(string eventMessage, Bundle friendProfile, FriendRelationshipStatus relationship)
        {
            // Create a community friend GameObject
            GameObject communityFriendPrefabInstance = Instantiate <GameObject>(communityFriendPrefab);

            // Fill the newly created GameObject with event friend data
            CommunityFriendHandler communityFriendHandler = communityFriendPrefabInstance.GetComponent <CommunityFriendHandler>();

            communityFriendHandler.FillData(friendProfile, relationship);

            // Add an event item with the newly created GameObject linked to it
            AddEventItem(eventMessage, communityFriendPrefabInstance);
        }