Esempio n. 1
0
        public static MyUnifiedChatItem CreatePrivateMessage(string text, DateTime timestamp, long senderId, long targetId, string authorFont = "Blue")
        {
            MyUnifiedChatItem item1 = new MyUnifiedChatItem();

            item1.Text         = text;
            item1.Timestamp    = timestamp;
            item1.Channel      = ChatChannel.Private;
            item1.CustomAuthor = string.Empty;
            item1.SenderId     = senderId;
            item1.TargetId     = targetId;
            item1.AuthorFont   = authorFont;
            return(item1);
        }
Esempio n. 2
0
        public static MyUnifiedChatItem CreateScriptedMessage(string text, DateTime timestamp, string customAuthor, string authorFont = "Blue")
        {
            MyUnifiedChatItem item1 = new MyUnifiedChatItem();

            item1.Text         = text;
            item1.Timestamp    = timestamp;
            item1.Channel      = ChatChannel.GlobalScripted;
            item1.CustomAuthor = string.IsNullOrEmpty(customAuthor) ? string.Empty : customAuthor;
            MyUnifiedChatItem local1 = item1;

            local1.SenderId   = 0L;
            local1.TargetId   = 0L;
            local1.AuthorFont = authorFont;
            return(local1);
        }
Esempio n. 3
0
        public static MyUnifiedChatItem CreateChatbotMessage(string text, DateTime timestamp, long senderId, long targetId = 0L, string customAuthor = null, string authorFont = "Blue")
        {
            MyUnifiedChatItem item1 = new MyUnifiedChatItem();

            item1.Text         = text;
            item1.Timestamp    = timestamp;
            item1.Channel      = ChatChannel.ChatBot;
            item1.CustomAuthor = string.IsNullOrEmpty(customAuthor) ? string.Empty : customAuthor;
            MyUnifiedChatItem local1 = item1;

            local1.SenderId   = senderId;
            local1.TargetId   = targetId;
            local1.AuthorFont = authorFont;
            return(local1);
        }
Esempio n. 4
0
        public void EnqueueMessage(string text, ChatChannel channel, long senderId, long targetId = 0L, DateTime?timestamp = new DateTime?(), string authorFont = "Blue")
        {
            MyUnifiedChatItem item;
            DateTime          utcNow;

            if ((timestamp == null) || (timestamp == null))
            {
                utcNow = DateTime.UtcNow;
            }
            else
            {
                utcNow = timestamp.Value;
            }
            switch (channel)
            {
            case ChatChannel.Global:
            case ChatChannel.GlobalScripted:
                item = MyUnifiedChatItem.CreateGlobalMessage(text, utcNow, senderId, authorFont);
                break;

            case ChatChannel.Faction:
                item = MyUnifiedChatItem.CreateFactionMessage(text, utcNow, senderId, targetId, authorFont);
                break;

            case ChatChannel.Private:
                item = MyUnifiedChatItem.CreatePrivateMessage(text, utcNow, senderId, targetId, authorFont);
                break;

            case ChatChannel.ChatBot:
                item = MyUnifiedChatItem.CreateChatbotMessage(text, utcNow, senderId, targetId, null, authorFont);
                break;

            default:
                item = null;
                break;
            }
            if (item != null)
            {
                this.EnqueueMessage(ref item);
            }
        }
Esempio n. 5
0
        public void EnqueueMessageScripted(string text, string customAuthor, string authorFont = "Blue")
        {
            MyUnifiedChatItem item = MyUnifiedChatItem.CreateScriptedMessage(text, DateTime.UtcNow, customAuthor, authorFont);

            this.EnqueueMessage(ref item);
        }
Esempio n. 6
0
 public void EnqueueMessage(ref MyUnifiedChatItem item)
 {
     this.m_chat.Enqueue(item);
 }