Exemplo n.º 1
0
        void UpdateFriendsAvatars(ClientModel dataModel, MyParams p)
        {
            // Set avatars for friends + set their alpha to 1;
            int i            = 0;
            int friendsCount = dataModel.friendsAvatarIds.Length;
            int limit        = Mathf.Min(MAX_DISPLAYED_FRIENDS, friendsCount);

            for (; i < limit; i++)
            {
                friendsAvatarImages[i].sprite = p.sampleAvatarsDownsized[dataModel.friendsAvatarIds[i]];
                //friendsPanels[i].gameObject.SetActive(true);
                friendsPanels[i].localScale = Vector3.one;
            }

            // Hide the rest
            for (; i < MAX_DISPLAYED_FRIENDS; ++i)
            {
                //friendsPanels[i].gameObject.SetActive(false);
                friendsPanels[i].localScale = Vector3.zero;
            }

            // .. but fade the last 2, if the friends count is big enough
            if (friendsCount > MAX_DISPLAYED_FRIENDS - 1)
            {
                friendsPanelsCanvasGroups[MAX_DISPLAYED_FRIENDS - 1].alpha = .1f;
            }
            if (friendsCount > MAX_DISPLAYED_FRIENDS - 2)
            {
                friendsPanelsCanvasGroups[MAX_DISPLAYED_FRIENDS - 2].alpha = .4f;
            }
        }
Exemplo n.º 2
0
        public void UpdateViews(MyParams p, ClientModel dataModel)
        {
            avatarImage.sprite = p.sampleAvatars[dataModel.avatarImageId];
            UpdateTitleByItemIndex(dataModel);
            locationText.text = "  " + dataModel.location;
            UpdateScores(dataModel);
            friendsText.text = dataModel.friendsAvatarIds.Length + (dataModel.friendsAvatarIds.Length == 1 ? " friend" : " friends");
            if (dataModel.isOnline)
            {
                statusText.text  = "Online";
                statusText.color = Color.green;
            }
            else
            {
                statusText.text  = "Offline";
                statusText.color = Color.white * .8f;
            }

            UpdateFriendsAvatars(dataModel, p);

            if (expandCollapseComponent)
            {
                expandCollapseComponent.expanded        = dataModel.expanded;
                expandCollapseComponent.nonExpandedSize = dataModel.nonExpandedSize;
            }
        }