Exemplo n.º 1
0
    private void Start()
    {
        avatarRenderer = GetComponent <AvatarImageComponent>();
        AvatarImageComponent avatarImageComponent = avatarRenderer;

        avatarImageComponent.OnImageReady = (Action <DataEntityHandle, Texture2D>)Delegate.Combine(avatarImageComponent.OnImageReady, new Action <DataEntityHandle, Texture2D>(onImageReady));
        DataEntityHandle     localPlayerHandle    = Service.Get <CPDataEntityCollection>().LocalPlayerHandle;
        AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(AnimationState, 0.5f);

        avatarRenderer.RequestImage(localPlayerHandle, avatarAnimationFrame);
    }
    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);
    }
Exemplo n.º 3
0
 private void renderOwner(FriendListItem friendListItem, DataEntityHandle handle, string displayName, bool isOnline)
 {
     if (!friendListItem.IsRendered || (friendListItem.IsOnlineSet && isOnline != friendListItem.IsOnline))
     {
         friendListItem.IsRendered = true;
         friendListItem.SetPreloaderActive(isActive: true);
         friendListItem.SetAvatarIconActive(isActive: false);
         if (friendAvatarRenderer.IsRenderInProgress(displayName))
         {
             friendAvatarRenderer.CancelRender(displayName);
         }
         if (isOnline)
         {
             AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(IdlePenguinState, 0.5f);
             friendAvatarRenderer.RequestImage(handle, avatarAnimationFrame, "FriendsListIdle");
         }
         else
         {
             AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(SleepingPenguinState, 0.75f);
             friendAvatarRenderer.RequestImage(handle, avatarAnimationFrame, "FriendsListSleeping");
         }
     }
 }
 protected void renderPlayer(AbstractPlayerListItem playerListItem, DataEntityHandle handle, string displayName, bool isOnline)
 {
     if (!playerListItem.IsRendered)
     {
         playerListItem.IsRendered = true;
         playerListItem.SetPreloaderActive(isActive: true);
         playerListItem.SetAvatarIconActive(isActive: false);
         if (playerAvatarRenderer.IsRenderInProgress(displayName))
         {
             playerAvatarRenderer.CancelRender(displayName);
         }
         if (isOnline)
         {
             AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(IdlePenguinState, 0.5f);
             playerAvatarRenderer.RequestImage(handle, avatarAnimationFrame, "FriendsListIdle");
         }
         else
         {
             AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(SleepingPenguinState, 0.75f);
             playerAvatarRenderer.RequestImage(handle, avatarAnimationFrame, "FriendsListSleeping");
         }
     }
 }
        private void onElementShown(int index, GameObject element)
        {
            FullScreenChatBlock component = element.GetComponent <FullScreenChatBlock>();

            component.SessionId = fullScreenChatBlockDataList[index].SessionId;
            component.SetChatMessage(fullScreenChatBlockDataList[index].DisplayName, fullScreenChatBlockDataList[index].Message, fullScreenChatBlockDataList[index].IsChatActivity, fullScreenChatBlockDataList[index].IsAwatingModeration, fullScreenChatBlockDataList[index].IsChatBlocked);
            component.OnClicked = (Action <long>)Delegate.Combine(component.OnClicked, new Action <long>(onFullScreenChatBlockClicked));
            if (!imageRequests.Contains(fullScreenChatBlockDataList[index].SessionId))
            {
                DataEntityHandle handle = findPlayerHandle(fullScreenChatBlockDataList[index].SessionId);
                imageRequests.Enqueue(fullScreenChatBlockDataList[index].SessionId);
                AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame("Base Layer.Idle", 0.5f);
                avatarImageComponent.RequestImage(handle, avatarAnimationFrame, "FullScreenChatAvatar");
            }
        }
    private void Start()
    {
        avatarImageComponent = GetComponent <AvatarImageComponent>();
        AvatarImageComponent obj = avatarImageComponent;

        obj.OnImageReady = (Action <DataEntityHandle, Texture2D>)Delegate.Combine(obj.OnImageReady, new Action <DataEntityHandle, Texture2D>(onImageReady));
        CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
        DataEntityHandle       localPlayerHandle      = cPDataEntityCollection.LocalPlayerHandle;

        if (!localPlayerHandle.IsNull)
        {
            AvatarAnimationFrame avatarAnimationFrame = new AvatarAnimationFrame(AnimationStateName, AnimationNormalizedTime);
            avatarImageComponent.RequestImage(localPlayerHandle, avatarAnimationFrame, Context);
        }
        else
        {
            Log.LogError(this, "Local player handle was null");
        }
    }