예제 #1
0
        public void SystemSendWhisper(string userId, string userName, short vipLv, string content)
        {
            if (userId.Equals(LanguageManager.GetLang().SystemUserId.ToString()))
            {
                throw new Exception("不能给系统发私聊");
            }

            var chat = new ChatData
            {
                Version = 0,
                FromUserID = LanguageManager.GetLang().SystemUserId,
                FromUserName = LanguageManager.GetLang().KingName,
                FromUserVip = 0,
                ToUserID = userId.ToInt(),
                ToUserName = userName,
                ToUserVip = vipLv,
                ChatType = ChatType.Whisper,
                Content = content,
                SendDate = DateTime.Now
            };
            SendWhisper(userId.ToInt(), chat);
        }
예제 #2
0
 public void SystemSend(ChatType chatType, string content)
 {
     if (chatType == ChatType.Whisper) return;
     var chat = new ChatData
     {
         Version = NextVersion,
         FromUserID = LanguageManager.GetLang().SystemUserId,
         FromUserName = LanguageManager.GetLang().KingName,
         FromUserVip = 0,
         ToUserID = 0,
         ToUserName = string.Empty,
         ToUserVip = 0,
         ChatType = chatType,
         Content = content,
         SendDate = DateTime.Now
     };
     Send(chat);
 }
예제 #3
0
        public void SendWhisper(GameUser toUser, string content)
        {
            if (_user == null || toUser == null)
            {
                throw new Exception("发送人或接收人为空值");
            }

            _user.ChatDate = DateTime.Now;
            var chat = new ChatData
            {
                Version = 0,
                FromUserID = _user.UserID.ToInt(),
                FromUserName = _user.NickName,
                FromUserVip = (short)_user.VipLv,
                ToUserID = toUser.UserID.ToInt(),
                ToUserName = toUser.NickName,
                ToUserVip = (short)toUser.VipLv,
                ChatType = ChatType.Whisper,
                Content = FilterMessage(content),
                SendDate = DateTime.Now
            };
            SendWhisper(toUser.UserID.ToInt(), chat);
        }
예제 #4
0
 public void SystemGuildSend(ChatType chatType, string content)
 {
     string guildID = string.Empty;
     if (chatType == ChatType.Whisper) return;
     if (!string.IsNullOrEmpty(_user.MercenariesID))
     {
         guildID = _user.MercenariesID;
     }
     var chat = new ChatData
     {
         Version = NextVersion,
         FromUserID = LanguageManager.GetLang().SystemUserId,
         FromUserName = LanguageManager.GetLang().KingName,
         FromUserVip = 0,
         ToUserID = 0,
         ToUserName = string.Empty,
         ToUserVip = 0,
         ChatType = chatType,
         Content = content,
         SendDate = DateTime.Now,
         GuildID = guildID
     };
     Send(chat);
 }
예제 #5
0
 public void Send(ChatType chatType, string content)
 {
     string guildID = string.Empty;
     if (chatType == ChatType.Guild)
     {
         guildID = _user.MercenariesID;
     }
     var chat = new ChatData
     {
         Version = NextVersion,
         FromUserID = _user.UserID.ToInt(),
         FromUserName = _user.NickName,
         FromUserVip = (short)_user.VipLv,
         ToUserID = 0,
         ToUserName = string.Empty,
         ToUserVip = 0,
         ChatType = chatType,
         Content = FilterMessage(content),
         SendDate = DateTime.Now,
         GuildID = guildID,
     };
     if (chatType == ChatType.World)
     {
         _user.ChatDate = DateTime.Now;
     }
     Send(chat);
 }