示例#1
0
        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);
        }
示例#2
0
 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);
 }
示例#4
0
 public void RegisterClientMessageHandler <T>(NetworkMessageHandler.MessageHandler handler) where T : Message
 {
     RegisterMessage <T>();
     clientMessageHandler.SetHandler <T>(handler);
 }
示例#5
0
 public void RegisterServerMessageHandler <T>(NetworkMessageHandler.MessageHandler handler) where T : Message
 {
     RegisterMessage <T>();
     serverMessageHandler.SetHandler <T>(handler);
 }