using System.Net; using Mirror; using Mirror.Discovery; /* Documentation: https://mirror-networking.gitbook.io/docs/components/network-discovery API Reference: https://mirror-networking.com/docs/api/Mirror.Discovery.NetworkDiscovery.html */ public struct DiscoveryRequest : NetworkMessage { // Add properties for whatever information you want sent by clients // in their broadcast messages that servers will consume. } public struct DiscoveryResponse : NetworkMessage { // Add properties for whatever information you want the server to return to // clients for them to display or consume for establishing a connection. } public class #SCRIPTNAME# : NetworkDiscoveryBase { #region Server /// /// Reply to the client to inform it of this server /// /// /// Override if you wish to ignore server requests based on /// custom criteria such as language, full server game mode or difficulty /// /// Request coming from client /// Address of the client that sent the request protected override void ProcessClientRequest(DiscoveryRequest request, IPEndPoint endpoint) { base.ProcessClientRequest(request, endpoint); } /// /// Process the request from a client /// /// /// Override if you wish to provide more information to the clients /// such as the name of the host player /// /// Request coming from client /// Address of the client that sent the request /// A message containing information about this server protected override DiscoveryResponse ProcessRequest(DiscoveryRequest request, IPEndPoint endpoint) { return new DiscoveryResponse(); } #endregion #region Client /// /// Create a message that will be broadcasted on the network to discover servers /// /// /// Override if you wish to include additional data in the discovery message /// such as desired game mode, language, difficulty, etc... /// An instance of ServerRequest with data to be broadcasted protected override DiscoveryRequest GetRequest() { return new DiscoveryRequest(); } /// /// Process the answer from a server /// /// /// A client receives a reply from a server, this method processes the /// reply and raises an event /// /// Response that came from the server /// Address of the server that replied protected override void ProcessResponse(DiscoveryResponse response, IPEndPoint endpoint) { } #endregion }