using System; using UnityEngine.Events; namespace Mirror.Cloud.ListServerService { public sealed class ListServer { public readonly IListServerServerApi ServerApi; public readonly IListServerClientApi ClientApi; public ListServer(IListServerServerApi serverApi, IListServerClientApi clientApi) { ServerApi = serverApi ?? throw new ArgumentNullException(nameof(serverApi)); ClientApi = clientApi ?? throw new ArgumentNullException(nameof(clientApi)); } } public interface IListServerServerApi : IBaseApi { /// /// Has a server been added to the list with this connection /// bool ServerInList { get; } /// /// Add a server to the list /// /// void AddServer(ServerJson server); /// /// Update the current server /// /// void UpdateServer(int newPlayerCount); /// /// Update the current server /// /// void UpdateServer(ServerJson server); /// /// Removes the current server /// void RemoveServer(); } public interface IListServerClientApi : IBaseApi { /// /// Called when the server list is updated /// event UnityAction onServerListUpdated; /// /// Get the server list once /// void GetServerList(); /// /// Start getting the server list every interval /// /// void StartGetServerListRepeat(int interval); /// /// Stop getting the server list /// void StopGetServerListRepeat(); } }