Пример #1
0
        public string RenderEvent(VMChatEvent evt)
        {
            switch (evt.Type)
            {
            case VMChatEventType.Message:
                return(GameFacade.Strings.GetString("261", "8").Replace("%", evt.Text[0]) + evt.Text[1]);

            case VMChatEventType.MessageMe:
                return(GameFacade.Strings.GetString("261", "9") + evt.Text[1]);

            case VMChatEventType.Join:
                return(GameFacade.Strings.GetString("261", "6").Replace("%", evt.Text[0]));

            case VMChatEventType.Leave:
                return(GameFacade.Strings.GetString("261", "7").Replace("%", evt.Text[0]));

            case VMChatEventType.Arch:
                return("<" + evt.Text[0] + " (" + evt.Text[1] + ")" + "> " + evt.Text[2]);

            case VMChatEventType.Generic:
                return(evt.Text[0]);

            default:
                return("");
            }
        }
Пример #2
0
        public void ReceiveEvent(VMChatEvent evt)
        {
            History.Add(evt);

            //play TTS for this event?
            if (evt.Type == VMChatEventType.Message || evt.Type == VMChatEventType.MessageMe)
            {
                if (GlobalSettings.Default.ChatOnlyEmoji)
                {
                    evt.Text[1] = GameFacade.Emojis.EmojiOnly(evt.Text[1]);
                }

                var ttsmode = GlobalSettings.Default.TTSMode;
                if (ttsmode > 0)
                {
                    if (ttsmode == 2 || (GetChannelInfo(evt.ChannelID).Flags & VMTSOChatChannelFlags.EnableTTS) > 0)
                    {
                        var avatar = Owner.vm.GetAvatarByPersist(evt.SenderUID);
                        if (avatar != null)
                        {
                            var tts    = GetOrCreateTTS();
                            var gender = avatar.GetPersonData(SimAntics.Model.VMPersonDataVariable.Gender) > 0;
                            tts?.Speak(evt.Text[1].Replace('_', ' '), gender, ((VMTSOAvatarState)avatar.TSOState).ChatTTSPitch);
                        }
                    }
                }
            }

            if (History.Count > 100)
            {
                History.RemoveAt(0);
            }
            RenderEvents();
        }
Пример #3
0
 void Vm_OnChatEvent(VMChatEvent evt)
 {
     if (ZoomLevel < 4)
     {
         Title.SetTitle(LotControl.GetLotTitle());
     }
 }
Пример #4
0
 /// <summary>
 /// Signals a chat event to all listeners. (usually a UI)
 /// </summary>
 /// <param name="info">The chat event to pass along.</param>
 public void SignalChatEvent(VMChatEvent evt)
 {
     if (OnChatEvent != null)
     {
         OnChatEvent(evt);
     }
 }
Пример #5
0
 /// <summary>
 /// Signals a chat event to all listeners. (usually a UI)
 /// </summary>
 /// <param name="info">The chat event to pass along.</param>
 public void SignalChatEvent(VMChatEvent evt)
 {
     if (Driver.InResync)
     {
         return;
     }
     OnChatEvent?.Invoke(evt);
 }
Пример #6
0
 public void ReceiveEvent(VMChatEvent evt)
 {
     History.Add(evt);
     if (History.Count > 100)
     {
         History.RemoveAt(0);
     }
     RenderEvents();
 }
Пример #7
0
 private void Vm_OnChatEvent(VMChatEvent evt)
 {
     evt.Visitors = vm.Entities.Count(x => x is VMAvatar && x.PersistID != 0);
     if (evt.Type == VMChatEventType.Message && evt.SenderUID == SelectedSimID)
     {
         evt.Type = VMChatEventType.MessageMe;
     }
     ChatPanel.SetLotName(vm.LotName);
     ChatPanel.ReceiveEvent(evt);
 }
Пример #8
0
 public void ReceiveEvent(VMChatEvent evt)
 {
     if (evt.Type == VMChatEventType.Arch)
     {
         PropertyLog.ReceiveEvent(evt);
     }
     else
     {
         HistoryDialog.ReceiveEvent(evt);
     }
 }
Пример #9
0
        public string CleanUserMessage(string msg, VMChatEvent evt)
        {
            var sanitary = GameFacade.Emojis.EmojiToBB(SanitizeBB(msg));

            if (evt.Channel != null)
            {
                return(evt.Channel.TextColorString + sanitary + "[/color]");
            }
            else
            {
                return(sanitary);
            }
        }
Пример #10
0
 public void ReceiveEvent(VMChatEvent evt)
 {
     if (evt.Type == VMChatEventType.Arch)
     {
         PropertyLog.ReceiveEvent(evt);
     }
     else
     {
         var myAvatar   = vm.GetAvatarByPersist(vm.MyUID);
         var myIgnoring = ((VMTSOAvatarState)myAvatar?.TSOState)?.IgnoredAvatars ?? new HashSet <uint>();
         if (!myIgnoring.Contains(evt.SenderUID))
         {
             HistoryDialog.ReceiveEvent(evt);
         }
     }
 }
Пример #11
0
        public string RenderEvent(VMChatEvent evt)
        {
            var colorBefore   = "[color=lightgray]";
            var avatarColor   = "[color=#" + evt.Color.R.ToString("x2") + evt.Color.G.ToString("x2") + evt.Color.B.ToString("x2") + "][s]";
            var colorAfter    = "[/s][/color]";
            var timestamp     = evt.Timestamp;
            var showTimestamp = GlobalSettings.Default.ChatShowTimestamp;
            var avatar        = avatarColor + evt.Text[0] + colorAfter; //avatar names cannot normally contain bbcode

            switch (evt.Type)
            {
            case VMChatEventType.Message:
                return(((showTimestamp) ? SanitizeBB("[" + timestamp + "] ") : "") + colorBefore + ((evt.Channel == null) ? "" : ("(" + evt.Channel.Name + ") "))
                       + GameFacade.Strings.GetString("261", "8").Replace("%", avatar)
                       + colorAfter + CleanUserMessage(evt.Text[1], evt));

            case VMChatEventType.MessageMe:
                return(((showTimestamp) ? SanitizeBB("[" + timestamp + "] ") : "") + colorBefore + ((evt.Channel == null) ? "" : ("(" + evt.Channel.Name + ") "))
                       + GameFacade.Strings.GetString("261", "9")
                       + colorAfter + CleanUserMessage(evt.Text[1], evt));

            case VMChatEventType.Join:
                return(((showTimestamp) ? SanitizeBB("[" + timestamp + "] ") : "") + colorBefore + GameFacade.Strings.GetString("261", "6").Replace("%", avatar) + colorAfter);

            case VMChatEventType.Leave:
                return(((showTimestamp) ? SanitizeBB("[" + timestamp + "] ") : "") + colorBefore + GameFacade.Strings.GetString("261", "7").Replace("%", avatar) + colorAfter);

            case VMChatEventType.Arch:
                return(((showTimestamp) ? SanitizeBB("[" + timestamp + "] ") : "") + colorBefore + "<" + avatar + " (" + evt.Text[1] + ")" + "> " + evt.Text[2] + colorAfter);

            case VMChatEventType.Debug:
                if (GameFacade.EnableMod)
                {
                    goto case VMChatEventType.Generic;
                }
                else
                {
                    return("");
                }

            case VMChatEventType.Generic:
                return(((showTimestamp) ? SanitizeBB("[" + timestamp + "] ") : "") + colorBefore + CleanUserMessage(evt.Text[0], evt) + colorAfter);

            default:
                return("");
            }
        }
Пример #12
0
        public string RenderEvent(VMChatEvent evt)
        {
            var colorBefore = "[color=lightgray]";
            var avatarColor = "[color=#" + evt.Color.R.ToString("x2") + evt.Color.G.ToString("x2") + evt.Color.B.ToString("x2") + "][s]";
            var colorAfter  = "[/s][/color]";
            var avatar      = avatarColor + evt.Text[0] + colorAfter; //avatar names cannot normally contain bbcode

            switch (evt.Type)
            {
            case VMChatEventType.Message:
                return(colorBefore + ((evt.Channel == null) ? "" : ("(" + evt.Channel.Name + ") "))
                       + GameFacade.Strings.GetString("261", "8").Replace("%", avatar)
                       + colorAfter + CleanUserMessage(evt.Text[1], evt));

            case VMChatEventType.MessageMe:
                return(colorBefore + ((evt.Channel == null) ? "" : ("(" + evt.Channel.Name + ") "))
                       + GameFacade.Strings.GetString("261", "9")
                       + colorAfter + CleanUserMessage(evt.Text[1], evt));

            case VMChatEventType.Join:
                return(colorBefore + GameFacade.Strings.GetString("261", "6").Replace("%", avatar) + colorAfter);

            case VMChatEventType.Leave:
                return(colorBefore + GameFacade.Strings.GetString("261", "7").Replace("%", avatar) + colorAfter);

            case VMChatEventType.Arch:
                return(colorBefore + "<" + avatar + " (" + evt.Text[1] + ")" + "> " + evt.Text[2] + colorAfter);

            case VMChatEventType.Generic:
            case VMChatEventType.Debug:
                return(colorBefore + GameFacade.Emojis.EmojiToBB(evt.Text[0]) + colorAfter);

            default:
                return("");
            }
        }
Пример #13
0
 private void Vm_OnChatEvent(VMChatEvent evt)
 {
     evt.Visitors = vm.Entities.Count(x => x is VMAvatar && x.PersistID != 0);
     if (evt.Type == VMChatEventType.Message && evt.SenderUID == SelectedSimID) evt.Type = VMChatEventType.MessageMe;
     ChatPanel.SetLotName(vm.LotName);
     ChatPanel.ReceiveEvent(evt);
 }
Пример #14
0
 /// <summary>
 /// Signals a chat event to all listeners. (usually a UI)
 /// </summary>
 /// <param name="info">The chat event to pass along.</param>
 public void SignalChatEvent(VMChatEvent evt)
 {
     OnChatEvent?.Invoke(evt);
 }
Пример #15
0
 public string RenderEvent(VMChatEvent evt)
 {
     switch (evt.Type)
     {
         case VMChatEventType.Message:
             return GameFacade.Strings.GetString("261", "8").Replace("%", evt.Text[0]) + evt.Text[1];
         case VMChatEventType.MessageMe:
             return GameFacade.Strings.GetString("261", "9") + evt.Text[1];
         case VMChatEventType.Join:
             return GameFacade.Strings.GetString("261", "6").Replace("%", evt.Text[0]);
         case VMChatEventType.Leave:
             return GameFacade.Strings.GetString("261", "7").Replace("%", evt.Text[0]);
         case VMChatEventType.Arch:
             return "<" + evt.Text[0] + " (" + evt.Text[1] + ")" + "> " + evt.Text[2];
         case VMChatEventType.Generic:
             return evt.Text[0];
         default:
             return "";
     }
 }
Пример #16
0
 public void ReceiveEvent(VMChatEvent evt)
 {
     Visitors = evt.Visitors;
     History.Add(evt);
     if (History.Count > 100) History.RemoveAt(0);
     RenderEvents();
 }
Пример #17
0
 public void ReceiveEvent(VMChatEvent evt)
 {
     if (evt.Type == VMChatEventType.Arch) PropertyLog.ReceiveEvent(evt);
     else HistoryDialog.ReceiveEvent(evt);
 }
Пример #18
0
 /// <summary>
 /// Signals a chat event to all listeners. (usually a UI)
 /// </summary>
 /// <param name="info">The chat event to pass along.</param>
 public void SignalChatEvent(VMChatEvent evt)
 {
     if (OnChatEvent != null) OnChatEvent(evt);
 }
Пример #19
0
 public void ReceiveEvent(VMChatEvent evt)
 {
     HistoryDialog.ReceiveEvent(evt);
 }