Exemple #1
0
        public void OnChatReceived(ReceiveTextEvent e)
        {
            string author  = e.FromLocalised ?? e.From;
            string content = e.MessageLocalised ?? e.Message;

            _log.LogInformation("Received text: '{content}' from {author}", content, author);
        }
 internal ReceiveTextEvent InvokeEvent(ReceiveTextEvent arg)
 {
     if (_api.ValidateEvent(arg))
     {
         ReceiveText?.Invoke(_api, arg);
     }
     return(arg);
 }
Exemple #3
0
 private void AssertEvent(ReceiveTextEvent @event)
 {
     Assert.NotNull(@event);
     Assert.Equal(DateTime.Parse("2019-08-29T11:36:51Z"), @event.Timestamp);
     Assert.Equal(EventName, @event.Event);
     Assert.Equal("Mawson Dock", @event.From);
     Assert.Equal(MessageChannel.Npc, @event.Channel);
     Assert.Equal("$STATION_NoFireZone_exited;", @event.Message);
     Assert.Equal("Вы вышли из зоны запрета огня", @event.MessageLocalised);
 }
Exemple #4
0
        private void ReceiveTextCallback(ReceiveTextEvent obj)
        {
            var message = new ChatMessage()
            {
                Time    = obj.Timestamp,
                Channel = (ChatChannel)Enum.Parse(typeof(ChatChannel), obj.Channel, true),
                Message = string.IsNullOrEmpty(obj.MessageLocalised) ? obj.Message : obj.MessageLocalised,
                From    = string.IsNullOrEmpty(obj.FromLocalised) ? obj.From : obj.FromLocalised
            };

            _messages.Enqueue(message);
            OnAction("AddChatMessage");

            if (_messages.Count > MaxChatMessages)
            {
                _messages.Dequeue();
            }
        }
Exemple #5
0
 private void ReceiveText(string text)
 {
     ReceiveTextEvent?.Invoke(text);
 }
Exemple #6
0
 internal void InvokeReceiveTextEvent(ReceiveTextEvent arg)
 {
     ReceiveTextEvent?.Invoke(this, arg);
 }
Exemple #7
0
 internal void InvokeReceiveTextEvent(ReceiveTextEvent arg) => ReceiveTextEvent?.Invoke(null, arg);