コード例 #1
0
        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);
        }
コード例 #2
0
    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);
    }
コード例 #3
0
    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);
    }
コード例 #4
0
        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);
        }