private void Awake() { if (singleton != null) { throw new InvalidOperationException("ZoneMaster script already present on scene, only one allowed"); } singleton = this; handler = new NetworkMessageHandler(); handler.SetHandler <ZcRegisterWorld>(HandleZcRegisterWorld); server = new LidgrenServer(); server.serverDelegate = this; zones = new Dictionary <ulong, ZoneWorldInfo>(); RegisterMessage <ZcRegisterWorld>(HandleZcRegisterWorld); }
private void RegisterMessage <T>(NetworkMessageHandler.MessageHandler msgHandler) where T : Message { client.RegisterMessageType <T>(); handler.SetHandler <T>(msgHandler); }
public void SetMessageHandler <T>(NetworkMessageHandler.MessageHandler handler) where T : Message { UNetworkManager.singleton.RegisterMessage <T>(); handlers.SetHandler <T>(handler); }
public void RegisterClientMessageHandler <T>(NetworkMessageHandler.MessageHandler handler) where T : Message { RegisterMessage <T>(); clientMessageHandler.SetHandler <T>(handler); }
public void RegisterServerMessageHandler <T>(NetworkMessageHandler.MessageHandler handler) where T : Message { RegisterMessage <T>(); serverMessageHandler.SetHandler <T>(handler); }