public void ServerAddChatRecord(string message, string playerId, string adminId = "") { if (!serverAdminPlayerChatLogs.ContainsKey(playerId)) { serverAdminPlayerChatLogs.Add(playerId, new List <AdminChatMessage>()); } var entry = new AdminChatMessage { fromUserid = playerId, Message = message }; if (!string.IsNullOrEmpty(adminId)) { entry.fromUserid = adminId; entry.wasFromAdmin = true; } serverAdminPlayerChatLogs[playerId].Add(entry); AdminPlayerChatUpdateMessage.SendSingleEntryToAdmins(entry, playerId); if (!string.IsNullOrEmpty(adminId)) { AdminChatNotifications.SendToAll(playerId, AdminChatWindow.AdminPlayerChat, 0, true); } else { AdminChatNotifications.SendToAll(playerId, AdminChatWindow.AdminPlayerChat, 1); } ServerMessageRecording(playerId, entry); }
public static AdminPlayerChatUpdateMessage SendLogUpdateToAdmin(NetworkConnection requestee, AdminChatUpdate update, string playerId) { AdminPlayerChatUpdateMessage msg = new AdminPlayerChatUpdateMessage { JsonData = JsonUtility.ToJson(update), PlayerId = playerId }; msg.SendTo(requestee); return(msg); }
public static AdminPlayerChatUpdateMessage SendSingleEntryToAdmins(AdminChatMessage chatMessage, string playerId) { AdminChatUpdate update = new AdminChatUpdate(); update.messages.Add(chatMessage); AdminPlayerChatUpdateMessage msg = new AdminPlayerChatUpdateMessage { JsonData = JsonUtility.ToJson(update), PlayerId = playerId }; msg.SendToAdmins(); return(msg); }
public void ServerGetUnreadMessages(string playerId, int currentCount, NetworkConnection requestee) { if (!serverAdminPlayerChatLogs.ContainsKey(playerId)) { serverAdminPlayerChatLogs.Add(playerId, new List <AdminChatMessage>()); } if (currentCount >= serverAdminPlayerChatLogs[playerId].Count) { return; } AdminChatUpdate update = new AdminChatUpdate(); update.messages = serverAdminPlayerChatLogs[playerId].GetRange(currentCount, serverAdminPlayerChatLogs[playerId].Count - currentCount); AdminPlayerChatUpdateMessage.SendLogUpdateToAdmin(requestee, update, playerId); }