예제 #1
0
        private void Start()
        {
            Application.runInBackground = true;

            GeneratedMessageTypes.Initialize();

            NetworkServer.Configure(settings);

            NetworkServer.StartEvent += () =>
            {
                Debug.Log($"Start server id {NetworkServer.HostId}");
                Instantiate(setup);
            };

            NetworkServer.StopEvent          += () => { Debug.Log($"Stop server id {NetworkServer.HostId}"); };
            NetworkServer.NewConnectionEvent += connection =>
            {
                Debug.Log($"New connection from {connection.Ip}");
                //NetworkScene.Spawn(TestPrefab);
            };
            NetworkServer.ConnectionDisconnectEvent += connection =>
            {
                Debug.Log($"{connection.Ip} disconnected");
            };

            NetworkServer.Start(ip, port);

            //WorldUpdater.ConfigureServer(33, 200);

            //StatisticsUI.Show();
        }
예제 #2
0
        private void Start()
        {
            Application.runInBackground = true;

            GeneratedMessageTypes.Initialize();

            NetworkClient.Configure(settings);

            NetworkClient.ConnectEvent += () =>
            {
                Debug.Log("Connected to server");
                Instantiate(setup);
                NetworkClient.Send(new AddPlayer(), 0);
            };

            NetworkClient.DisconnectEvent += () => { Debug.Log("Disconnected from server"); };

            NetworkClient.Connect(ip, port);

            //WorldUpdater.ConfigureClient(200);

            //StatisticsUI.Show();
        }