Esempio n. 1
0
    private WorldSpeechBubble getSpeechBubble(long sessionId)
    {
        WorldSpeechBubble worldSpeechBubble = null;

        if (activeSpeechBubbles.ContainsKey(sessionId))
        {
            worldSpeechBubble = activeSpeechBubbles[sessionId];
        }
        else
        {
            GameObject gameObject = worldSpeechBubblePool.Spawn();
            if (gameObject != null)
            {
                worldSpeechBubble = gameObject.GetComponent <WorldSpeechBubble>();
                if (worldSpeechBubble == null)
                {
                    throw new InvalidOperationException("WorldChatController.getSpeechBubble: Did not get speech bubble from pool");
                }
                gameObject.transform.SetParent(base.transform, worldPositionStays: false);
                gameObject.transform.localRotation = Quaternion.identity;
                worldSpeechBubble.OnCompleteEvent += onSpeechBubbleComplete;
                activeSpeechBubbles.Add(sessionId, worldSpeechBubble);
            }
        }
        return(worldSpeechBubble);
    }
Esempio n. 2
0
    private void showChatMessage(long sessionId, string message, int sizzleclipID, bool isAwaitingModeration = false, bool isLocalChatPhrase = false)
    {
        bool flag = dataEntityCollection.IsLocalPlayer(sessionId);

        if (!string.IsNullOrEmpty(message))
        {
            WorldSpeechBubble speechBubble = getSpeechBubble(sessionId);
            if (isAwaitingModeration)
            {
                if (isLocalChatPhrase)
                {
                    speechBubble.ShowChatPhraseMessage(sessionId, message);
                }
                else
                {
                    speechBubble.ShowAwaitingModerationMessage(sessionId, message);
                }
            }
            else if (!isLocalChatPhrase || !flag)
            {
                speechBubble.ShowChatMessage(sessionId, message);
            }
        }
        if (sizzleclipID > 0 && (isAwaitingModeration || !flag))
        {
            Transform avatar = getAvatar(sessionId);
            if (avatar != null && LocomotionUtils.CanPlaySizzle(avatar.gameObject))
            {
                Animator component = avatar.GetComponent <Animator>();
                component.SetInteger(AnimationHashes.Params.Emote, sizzleclipID);
                component.SetTrigger(AnimationHashes.Params.PlayEmote);
            }
        }
    }
Esempio n. 3
0
    public WorldSpeechBubble GetActiveSpeechBubble(long sessionID)
    {
        WorldSpeechBubble value = null;

        activeSpeechBubbles.TryGetValue(sessionID, out value);
        return(value);
    }
Esempio n. 4
0
    private void showActiveTyping(long sessionId)
    {
        WorldSpeechBubble speechBubble = getSpeechBubble(sessionId);

        if (speechBubble != null)
        {
            speechBubble.SetChatActive(sessionId);
        }
    }
Esempio n. 5
0
 private void hideIndicatorForChat()
 {
     if (speechBubble == null)
     {
         speechBubble = chatController.GetActiveSpeechBubble(Service.Get <CPDataEntityCollection>().LocalPlayerSessionId);
         speechBubble.OnCompleteEvent += onChatComplete;
         IndicatorAnimator.SetTrigger("Close");
     }
 }
Esempio n. 6
0
 private bool onPlayerLeaveRoom(WorldServiceEvents.PlayerLeaveRoomEvent evt)
 {
     if (isSpeechBubbleActive(evt.SessionId))
     {
         WorldSpeechBubble worldSpeechBubble = activeSpeechBubbles[evt.SessionId];
         worldSpeechBubblePool.Unspawn(worldSpeechBubble.gameObject);
         worldSpeechBubble.OnCompleteEvent -= onSpeechBubbleComplete;
         activeSpeechBubbles.Remove(evt.SessionId);
     }
     return(false);
 }
Esempio n. 7
0
 private bool onChatActivityCancelReceived(ChatServiceEvents.ChatActivityCancelReceived evt)
 {
     if (isSpeechBubbleActive(evt.SessionId))
     {
         WorldSpeechBubble speechBubble = getSpeechBubble(evt.SessionId);
         if (speechBubble != null)
         {
             speechBubble.SetChatInactive();
         }
     }
     return(false);
 }
Esempio n. 8
0
 private bool onChatMessageBlockedReceived(ChatServiceEvents.ChatMessageBlockedReceived evt)
 {
     if (isSpeechBubbleActive(base.localSessionId))
     {
         WorldSpeechBubble speechBubble = getSpeechBubble(base.localSessionId);
         if (speechBubble != null)
         {
             speechBubble.SetChatBlocked(base.localSessionId);
         }
     }
     return(false);
 }
Esempio n. 9
0
 private bool onSendChatActivityCancel(ChatServiceEvents.SendChatActivityCancel evt)
 {
     if (isSpeechBubbleActive(base.localSessionId))
     {
         WorldSpeechBubble speechBubble = getSpeechBubble(base.localSessionId);
         if (speechBubble != null)
         {
             speechBubble.SetChatInactive();
         }
     }
     return(false);
 }
Esempio n. 10
0
 private void onSpeechBubbleComplete(WorldSpeechBubble speechBubble)
 {
     worldSpeechBubblePool.Unspawn(speechBubble.gameObject);
     speechBubble.OnCompleteEvent -= onSpeechBubbleComplete;
     activeSpeechBubbles.Remove(speechBubble.SessionId);
 }
Esempio n. 11
0
    private void setSpeechBubbleScale(WorldSpeechBubble bubble, Transform avatarTransform)
    {
        float magnitude = (avatarTransform.position - cameraTransform.position).magnitude;

        bubble.transform.GetChild(0).transform.localScale = DEFAULT_BUBBLE_SCALE * (1f - (magnitude - DefaultDistance) * ScaleFactor);
    }
Esempio n. 12
0
 private void onChatComplete(WorldSpeechBubble bubble)
 {
     speechBubble.OnCompleteEvent -= onChatComplete;
     IndicatorAnimator.SetTrigger("Open");
     speechBubble = null;
 }