コード例 #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
    /// <summary>
    /// Send full update to an admin client
    /// </summary>
    public static AdminChatNotifications Send(NetworkConnection adminConn, AdminChatNotificationFullUpdate update)
    {
        AdminChatNotifications msg = new AdminChatNotifications
        {
            IsFullUpdate   = true,
            FullUpdateJson = JsonUtility.ToJson(update)
        };

        msg.SendTo(adminConn);
        return(msg);
    }
コード例 #3
0
		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);
		}
コード例 #4
0
        /// <summary>
        /// Use for initialization of admin chat notifications when the admin logs in
        /// </summary>
        /// <param name="adminConn"></param>
        public void ServerUpdateAdminNotifications(NetworkConnection adminConn)
        {
            var update = new AdminChatNotificationFullUpdate();

            foreach (var n in adminNotification.notifications)
            {
                update.notificationEntries.Add(new AdminChatNotificationEntry
                {
                    Amount       = n.Value,
                    Key          = n.Key,
                    TargetWindow = AdminChatWindow.AdminToAdminChat
                });
            }

            foreach (var n in playerNotification.notifications)
            {
                if (PlayerList.Instance.GetByUserID(n.Key) == null ||
                    PlayerList.Instance.GetByUserID(n.Key).Connection == null)
                {
                    continue;
                }

                update.notificationEntries.Add(new AdminChatNotificationEntry
                {
                    Amount       = n.Value,
                    Key          = n.Key,
                    TargetWindow = AdminChatWindow.AdminPlayerChat
                });
            }

            foreach (var n in prayerNotification.notifications)
            {
                if (PlayerList.Instance.GetByUserID(n.Key) == null ||
                    PlayerList.Instance.GetByUserID(n.Key).Connection == null)
                {
                    continue;
                }

                update.notificationEntries.Add(new AdminChatNotificationEntry
                {
                    Amount       = n.Value,
                    Key          = n.Key,
                    TargetWindow = AdminChatWindow.PrayerWindow
                });
            }

            AdminChatNotifications.Send(adminConn, update);
        }
コード例 #5
0
    /// <summary>
    /// Send notification updates to all admins
    /// </summary>
    public static AdminChatNotifications SendToAll(string notificationKey, AdminChatWindow targetWindow,
                                                   int amt, bool clearAll = false)
    {
        AdminChatNotifications msg = new AdminChatNotifications
        {
            NotificationKey = notificationKey,
            TargetWindow    = targetWindow,
            Amount          = amt,
            ClearAll        = clearAll,
            IsFullUpdate    = false,
            FullUpdateJson  = ""
        };

        msg.SendToAll();
        return(msg);
    }