Beispiel #1
0
        public static void SendMessage(object message, string userId, ChatToClientType type, bool moreUser = false)
        {
            //构造消息体
            ToClientMessageResult result = new ToClientMessageResult
            {
                msg     = message,
                msgtype = type,
                other   = null
            };

            // 给多个用户发送消息
            if (moreUser)
            {
                hub.Clients.Users(userId.Split(',').ToList()).receiveMessage(result);
            }
            else
            {
                //给单个用户发送消息
                hub.Clients.User(userId).receiveMessage(result);
            }
        }
Beispiel #2
0
        void EventManager_OnChatToClient(string message, UUID fromID, UUID toID, UUID regionID,
                                         uint timestamp, ChatToClientType type)
        {
            if (message == "" || toID == fromID)
            {
                return;
            }

            //Create the log, then pass it to the backend
            ChatMessageLog log = new ChatMessageLog()
            {
                Message     = message,
                ChatType    = type,
                ToAgentID   = toID,
                FromAgentID = fromID,
                RegionID    = regionID,
                Timestamp   = timestamp
            };

            m_backend.LogChatMessage(log);
        }
Beispiel #3
0
        void EventManager_OnChatToClient(string message, UUID fromID, UUID toID, UUID regionID, 
            uint timestamp, ChatToClientType type)
        {
            if (String.IsNullOrEmpty(message) || toID == fromID) return;

            //Create the log, then pass it to the backend
            ChatMessageLog log = new ChatMessageLog()
            {
                Message = message,
                ChatType = type,
                ToAgentID = toID,
                FromAgentID = fromID,
                RegionID = regionID,
                Timestamp = timestamp
            };

            m_backend.LogChatMessage(log);
        }
Beispiel #4
0
 public void TriggerOnChatToClient(string message, UUID fromID, UUID toID,
     UUID regionID, uint timestamp, ChatToClientType type)
 {
     handlerChatToClient = OnChatToClient;
     if (handlerChatToClient != null)
         handlerChatToClient(message, fromID, toID, regionID, timestamp, type);
 }