public static AdminInfoUpdateMessage SendFullUpdate(GameObject recipient, Dictionary <uint, AdminInfo> infoEntries) { var update = new AdminInfoUpdate(); foreach (var e in infoEntries) { if (e.Value != null) { update.entries.Add(new AdminInfosEntry { netId = e.Key, infos = e.Value.StringInfo, offset = e.Value.OffsetPosition }); } } AdminInfoUpdateMessage msg = new AdminInfoUpdateMessage { JsonData = JsonUtility.ToJson(update), FullUpdate = true }; msg.SendTo(recipient); return(msg); }
public static AdminInfoUpdateMessage SendEntryToAllAdmins(AdminInfosEntry entry) { AdminInfoUpdateMessage msg = new AdminInfoUpdateMessage { JsonData = JsonUtility.ToJson(entry), FullUpdate = false }; msg.SendToAdmins(); return(msg); }
public static void RequestFullUpdate(string adminId, string adminToken) { var admin = PlayerList.Instance.GetAdmin(adminId, adminToken); if (admin != null) { AdminInfoUpdateMessage.SendFullUpdate(admin, Instance.serverInfos); } else { Logger.Log($"Someone tried to request all admin info overlay entries and failed. " + $"Using adminId: {adminId} and token: {adminToken}"); } }
public static void ServerAddInfoPanel(uint netId, AdminInfo adminInfo) { if (netId == NetId.Empty || netId == NetId.Invalid) { return; } if (Instance.serverInfos.ContainsKey(netId)) { return; } Instance.serverInfos.Add(netId, adminInfo); AdminInfoUpdateMessage.SendEntryToAllAdmins(new AdminInfosEntry { infos = adminInfo.StringInfo, netId = netId, offset = adminInfo.OffsetPosition }); }
public static void RequestFullUpdate(ConnectedPlayer admin) { AdminInfoUpdateMessage.SendFullUpdate(admin.GameObject, Instance.serverInfos); }