Example #1
0
 private void Speak(string text)
 {
     //TODO use the actual chat api when it allows it!
     Chat.AddLocalMsgToChat(
         text,
         gameObject,
         MobName);
     ShowChatBubbleMessage.SendToNearby(gameObject, text);
 }
    public static ShowChatBubbleMessage SendToNearby(GameObject followTransform, string message, bool isPlayerChatBubble = false,
                                                     ChatModifier chatModifier = ChatModifier.None)
    {
        ShowChatBubbleMessage msg = new ShowChatBubbleMessage
        {
            ChatModifiers      = chatModifier,
            Message            = message,
            FollowTransform    = followTransform.GetComponent <NetworkIdentity>().netId,
            IsPlayerChatBubble = isPlayerChatBubble
        };

        msg.SendToVisiblePlayers(followTransform.transform.position);
        return(msg);
    }
    public void ServerToggleChatIcon(bool turnOn, string message, ChatChannel chatChannel, ChatModifier chatModifier)
    {
        if (!playerScript.pushPull.VisibleState || (playerScript.mind.occupation.JobType == JobType.NULL ||
                                                    playerScript.playerHealth.IsDead || playerScript.playerHealth.IsCrit))
        {
            //Don't do anything with chat icon if player is invisible or not spawned in
            //This will also prevent clients from snooping other players local chat messages that aren't visible to them
            return;
        }

        // Cancel right away if the player cannot speak.
        if ((chatModifier & ChatModifier.Mute) == ChatModifier.Mute)
        {
            return;
        }

        ShowChatBubbleMessage.SendToNearby(gameObject, message, true, chatModifier);
    }