private void populateRequestPrefab(FriendRequestItem friendRequestItem, DataEntityHandle handle)
    {
        string displayName = dataEntityCollection.GetComponent <DisplayNameData>(handle).DisplayName;

        friendRequestItem.SetPlayer(handle);
        friendRequestItem.SetName(displayName);
        friendRequestItem.SetPreloaderActive(isActive: true);
        friendRequestItem.SetAvatarIconActive(isActive: false);
        friendRequestItem.SetMembershipType(getMembershipType(handle));
        AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(IdlePenguinState, 0.5f);

        friendAvatarRenderer.RequestImage(handle, avatarAnimationFrame);
    }
Example #2
0
        public void Initialize(DataEntityHandle handle)
        {
            mapCategoriesStrings();
            DataEntityCollection dataEntityCollection = Service.Get <CPDataEntityCollection>();
            DisplayNameData      component            = dataEntityCollection.GetComponent <DisplayNameData>(handle);

            if (component != null && !string.IsNullOrEmpty(component.DisplayName))
            {
                displayName   = component.DisplayName;
                NameText.text = displayName;
            }
            else
            {
                Log.LogError(this, "Could not find display name data on this handle");
                destroy();
            }
            if (dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out var component2))
            {
                AvatarRenderTextureComponent.RenderAvatar(component2);
            }
            else
            {
                Log.LogError(this, "AvatarDetailsData was not found");
            }
            if (dataEntityCollection.TryGetComponent <ProfileData>(handle, out profileData))
            {
                bool flag = profileData != null && profileData.HasPublicIgloo;
                reportIglooButton.ToggleButton(flag);
            }
            else
            {
                Log.LogError(this, "Could not find ProfileData for this handle.");
                reportIglooButton.ToggleButton(enabled: false);
            }
        }
 public void Start()
 {
     dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <ServerObjectItemData> >(onServerObjectItemAdded);
     dataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.EntityRemovedEvent>(onServerObjectRemoved);
     DataEntityHandle[] entitiesByType = dataEntityCollection.GetEntitiesByType <ServerObjectItemData>();
     foreach (DataEntityHandle handle in entitiesByType)
     {
         onServerObjectItemAdded(handle, dataEntityCollection.GetComponent <ServerObjectItemData>(handle));
     }
 }
Example #4
0
 private static void setClaimedRewardIds(DataEntityCollection dataEntityCollection, DataEntityHandle handle, List <int> claimedRewardIds)
 {
     if (!dataEntityCollection.HasComponent <ClaimedRewardIdsData>(handle))
     {
         dataEntityCollection.AddComponent <ClaimedRewardIdsData>(handle);
     }
     if (claimedRewardIds != null && claimedRewardIds.Count > 0)
     {
         ClaimedRewardIdsData component = dataEntityCollection.GetComponent <ClaimedRewardIdsData>(handle);
         component.RewardIds = claimedRewardIds;
     }
 }
        private string createHash(DataEntityHandle handle, string context)
        {
            string text = null;

            if (dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out var component) && component.Outfit != null)
            {
                string displayName         = dataEntityCollection.GetComponent <DisplayNameData>(handle).DisplayName;
                AvatarDetailsHashable data = new AvatarDetailsHashable(component, displayName, context);
                return(MD5HashUtil.GetHash(data));
            }
            throw new ArgumentException("Data entity handle did not have valid avatar details");
        }
        public void RequestImage(DataEntityHandle handle, AvatarAnimationFrame avatarAnimationFrame = null, string context = null)
        {
            if (UseCache && string.IsNullOrEmpty(context))
            {
                throw new ArgumentException("If using the cache, the context string must not be null");
            }
            string displayName = dataEntityCollection.GetComponent <DisplayNameData>(handle).DisplayName;

            if (!pendingRenderRequests.ContainsKey(displayName))
            {
                RenderRequest renderRequest = new RenderRequest(handle);
                renderRequest.AvatarAnimationFrame = avatarAnimationFrame;
                renderRequest.Context = context;
                pendingRenderRequests.Add(displayName, renderRequest);
                if (!dataEntityCollection.TryGetComponent <AvatarDetailsData>(handle, out var component))
                {
                    otherPlayerDetailsRequestBatcher.RequestOtherPlayerDetails(handle);
                    return;
                }
                renderRequest.AvatarDetailsData = component;
                getImage(displayName, renderRequest);
            }
        }
Example #7
0
 private void setUpFindUserItem()
 {
     if (findUserItem != null)
     {
         FriendStatus friendStatus = FriendsDataModelService.GetFriendStatus(handle);
         findUserItem.SetPlayer(handle);
         findUserItem.SetFriendStatus(friendStatus);
         findUserItem.SetName(dataEntityCollection.GetComponent <DisplayNameData>(handle).DisplayName);
         findUserItem.SetPreloaderActive(isActive: true);
         findUserItem.SetAvatarIconActive(isActive: false);
         return;
     }
     throw new MissingReferenceException("Find user result prefab not found");
 }
Example #8
0
 private bool getIsOnline(DataEntityHandle handle)
 {
     return(dataEntityCollection.GetComponent <ProfileData>(handle)?.IsOnline ?? false);
 }