Example #1
0
        /// <inheritdoc />
        public TextChatEventArgs CreateChatData <TMessageType>([NotNull] TMessageType incomingChatMessageEventData)
            where TMessageType : ITextMessageContainable, IChatChannelRoutable
        {
            if (incomingChatMessageEventData == null)
            {
                throw new ArgumentNullException(nameof(incomingChatMessageEventData));
            }

            ChatChannelType messageType = incomingChatMessageEventData.ChannelType;

            string renderableMessage = $"<color=#{ComputeColorFromChatType(messageType)}>{ComputeChannelText(messageType)}: {incomingChatMessageEventData.Message}</color>";

            TextChatEventArgs args = new TextChatEventArgs(renderableMessage, messageType);

            args.isFormattedText = true;
            return(args);
        }
Example #2
0
        public void PublishEvent(object sender, [NotNull] TextChatEventArgs eventArgs)
        {
            if (eventArgs == null)
            {
                throw new ArgumentNullException(nameof(eventArgs));
            }

            //We need to handle unformatted text chat events.
            if (eventArgs.isFormattedText)
            {
                OnTextChatMessageRecieved?.Invoke(sender, eventArgs);
            }
            else
            {
                OnTextChatMessageRecieved?.Invoke(sender, FormattedTextChatFactory.CreateChatData(eventArgs));
            }
        }
Example #3
0
        private void PublishTextData(ChatChannelType channelType, IChannelTextMessage args, NetworkEntityGuid guid, string name)
        {
            TextChatEventArgs data = TextDataFactory.CreateChatData(new EntityAssociatedData <VivoxChannelTextMessageChatMessageAdapter>(guid, new VivoxChannelTextMessageChatMessageAdapter(args, channelType)), name);

            MessageRecievedPublisher.PublishEvent(this, data);
        }