public void ServerAddChatRecord(string message, string playerId, string mentorId = "") { if (!serverMentorPlayerChatLogs.ContainsKey(playerId)) { serverMentorPlayerChatLogs.Add(playerId, new List <AdminChatMessage>()); } var entry = new AdminChatMessage { fromUserid = playerId, Message = message }; if (!string.IsNullOrEmpty(mentorId)) { entry.fromUserid = mentorId; entry.wasFromAdmin = true; } serverMentorPlayerChatLogs[playerId].Add(entry); MentorPlayerChatUpdateMessage.SendSingleEntryToMentors(entry, playerId); if (!string.IsNullOrEmpty(mentorId)) { AdminChatNotifications.SendToAll(playerId, AdminChatWindow.MentorPlayerChat, 0, true); } else { AdminChatNotifications.SendToAll(playerId, AdminChatWindow.MentorPlayerChat, 1); } ServerMessageRecording(playerId, entry); }
public static MentorPlayerChatUpdateMessage SendLogUpdateToMentor(NetworkConnection requestee, AdminChatUpdate update, string playerId) { MentorPlayerChatUpdateMessage msg = new MentorPlayerChatUpdateMessage { JsonData = JsonUtility.ToJson(update), PlayerId = playerId }; msg.SendTo(requestee); return(msg); }
public static MentorPlayerChatUpdateMessage SendSingleEntryToMentors(AdminChatMessage chatMessage, string playerId) { AdminChatUpdate update = new AdminChatUpdate(); update.messages.Add(chatMessage); MentorPlayerChatUpdateMessage msg = new MentorPlayerChatUpdateMessage { JsonData = JsonUtility.ToJson(update), PlayerId = playerId }; msg.SendToMentors(); return(msg); }