Esempio n. 1
0
    public static AdminChatUpdateMessage SendLogUpdateToAdmin(NetworkConnection requestee, AdminChatUpdate update)
    {
        AdminChatUpdateMessage msg =
            new AdminChatUpdateMessage
        {
            JsonData = JsonUtility.ToJson(update),
        };

        msg.SendTo(requestee);
        return(msg);
    }
		public void ServerAddChatRecord(string message, string userId)
		{
			var entry = new AdminChatMessage
			{
				fromUserid = userId,
				Message = message
			};

			serverAdminChatLogs.Add(entry);
			AdminChatUpdateMessage.SendSingleEntryToAdmins(entry);
			AdminChatNotifications.SendToAll(NotificationKey, AdminChatWindow.AdminToAdminChat, 1);
		}
Esempio n. 3
0
    public static AdminChatUpdateMessage SendSingleEntryToAdmins(AdminChatMessage chatMessage)
    {
        AdminChatUpdate update = new AdminChatUpdate();

        update.messages.Add(chatMessage);
        AdminChatUpdateMessage msg =
            new AdminChatUpdateMessage  {
            JsonData = JsonUtility.ToJson(update)
        };

        msg.SendToAdmins();
        return(msg);
    }
		public void ServerGetUnreadMessages(string adminId, int currentCount, NetworkConnection requestee)
		{
			if (!PlayerList.Instance.IsAdmin(adminId)) return;

			if (currentCount >= serverAdminChatLogs.Count)
			{
				return;
			}

			AdminChatUpdate update = new AdminChatUpdate
			{
				messages = serverAdminChatLogs
			};
			AdminChatUpdateMessage.SendLogUpdateToAdmin(requestee, update);
		}
        public void ServerGetUnreadMessages(string adminId, int currentCount, NetworkConnection requestee)
        {
            if (!PlayerList.Instance.IsAdmin(adminId))
            {
                return;
            }

            if (currentCount >= serverAdminChatLogs.Count)
            {
                return;
            }

            foreach (var adminChatChunk in serverAdminChatLogs.ToList().Chunk(100))
            {
                AdminChatUpdate update = new AdminChatUpdate
                {
                    messages = adminChatChunk.ToList()
                };
                AdminChatUpdateMessage.SendLogUpdateToAdmin(requestee, update);
            }
        }