Ejemplo n.º 1
0
    private void UpdateClientChat(string message, ChatChannel channels)
    {
        if (string.IsNullOrEmpty(message))
        {
            return;
        }

        trySendingTTS(message);

        if (PlayerManager.LocalPlayerScript == null)
        {
            channels = ChatChannel.OOC;
        }

        if (channels != ChatChannel.None)
        {
            // replace action messages with chat bubble
            if (channels.HasFlag(ChatChannel.Combat) || channels.HasFlag(ChatChannel.Action) || channels.HasFlag(ChatChannel.Examine))
            {
                string cleanMessage = Regex.Replace(message, "<.*?>", string.Empty);
                if (cleanMessage.StartsWith("You"))
                {
                    ChatBubbleManager.ShowAChatBubble(PlayerManager.LocalPlayerScript.transform, Regex.Replace(message, "<.*?>", string.Empty));
                    return;
                }
            }

            ChatUI.Instance.AddChatEntry(message);
        }
    }
Ejemplo n.º 2
0
    private void UpdateClientChat(string message, ChatChannel channels)
    {
        if (string.IsNullOrEmpty(message))
        {
            return;
        }

        trySendingTTS(message);

        if (PlayerManager.LocalPlayerScript == null)
        {
            channels = ChatChannel.OOC;
        }

        if (channels != ChatChannel.None)
        {
            // TODO: remove hardcoded "You" check; chat bubbles should be on their own channel or similar - see issue #5775.

            // replace action messages with chat bubble
            if (channels.HasFlag(ChatChannel.Combat) || channels.HasFlag(ChatChannel.Action) || channels.HasFlag(ChatChannel.Examine))
            {
                string cleanMessage = Regex.Replace(message, "<.*?>", string.Empty);
                if (cleanMessage.StartsWith("You"))
                {
                    ChatBubbleManager.ShowAction(Regex.Replace(message, "<.*?>", string.Empty));
                    return;
                }
            }

            ChatUI.Instance.AddChatEntry(message);
        }
    }
Ejemplo n.º 3
0
 private void Speak(string text)
 {
     //TODO use the actual chat api when it allows it!
     Chat.AddLocalMsgToChat($"<b>{capParrotName} says</b>, \"{text}\"",
                            gameObject.transform.position,
                            gameObject);
     ChatBubbleManager.ShowAChatBubble(gameObject.transform, text);
 }
Ejemplo n.º 4
0
 private void Speak(string text)
 {
     //TODO use the actual chat api when it allows it!
     Chat.AddLocalMsgToChat(
         text,
         gameObject,
         MobName);
     ChatBubbleManager.ShowAChatBubble(gameObject.transform, text);
 }
Ejemplo n.º 5
0
    public bool IsPlayerChatBubble;     //Special flag for finding the correct transform target on players
    //You may have to do something like this if your target does not
    //have a NetworkIdentity on it

    public override void Process()
    {
        LoadNetworkObject(FollowTransform);
        var target = NetworkObject.transform;

        if (IsPlayerChatBubble)
        {
            target = target.GetComponent <PlayerNetworkActions>().chatBubbleTarget;
        }

        ChatBubbleManager.ShowAction(Message);
    }
        public override void Process(NetMessage msg)
        {
            LoadNetworkObject(msg.FollowTransform);
            var target = NetworkObject.transform;

            if (msg.IsPlayerChatBubble)
            {
                target = target.GetComponent <PlayerNetworkActions>().chatBubbleTarget;
            }

            ChatBubbleManager.ShowAChatBubble(target, msg.Message, msg.ChatModifiers);
        }
Ejemplo n.º 7
0
    public bool IsPlayerChatBubble;     //Special flag for finding the correct transform target on players
    //You may have to do something like this if your target does not
    //have a NetworkIdentity on it

    public override IEnumerator Process()
    {
        yield return(WaitFor(FollowTransform));

        var target = NetworkObject.transform;

        if (IsPlayerChatBubble)
        {
            target = target.GetComponent <PlayerNetworkActions>().chatBubbleTarget;
        }

        ChatBubbleManager.ShowAChatBubble(target, Message, ChatModifiers);
    }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     if (!networkClient)
     {
         networkClient = FindObjectOfType <NetworkClient>();
     }
     if (!playerManager)
     {
         playerManager = FindObjectOfType <PlayerManager>();
     }
     if (!chatBubbleManager)
     {
         chatBubbleManager = FindObjectOfType <ChatBubbleManager>();
     }
     inputChatMessage.onSubmit.AddListener(new UnityEngine.Events.UnityAction <string>(SendChatMessage));
     inputChatMessage.onSelect.AddListener(new UnityEngine.Events.UnityAction <string>(OnInputSelect));
     inputChatMessage.onDeselect.AddListener(new UnityEngine.Events.UnityAction <string>(OnInputDeselect));
 }
Ejemplo n.º 9
0
 void Start()
 {
     c = GameManager.Instance.ChatBubbleManager;
     InvokeRepeating("Test", 1f, 3f);
 }
Ejemplo n.º 10
0
 void Awake()
 {
     main = this;
 }