Example #1
0
        public static bool Connect(string appId)
        {
            Debug.Log("ClientServerSystemManager.CollectAllSystems()");
            ClientServerSystemManager.CollectAllSystems();

            Debug.Log("ReplicatedPrefabMgr.Initialize()");
            ReplicatedPrefabMgr.Initialize();

            ClientServerSystemManager.InitClientSystems();

            Unity.DotsNetKit.Transport.NetworkEndPoint ep = Unity.DotsNetKit.Transport.NetworkEndPoint.Parse("127.0.0.1",
                                                                                                             12345);
            World  clientWorld = ClientServerSystemManager.clientWorld;
            Entity ent         = clientWorld.GetExistingSystem <NetworkStreamReceiveSystem>().Connect(ep);

            // Console.WriteLine("Connecting to server ...");

            return(true);
        }
Example #2
0
        public static void Start(string appId)
        {
            Debug.Log("ClientServerSystemManager.CollectAllSystems()");
            ClientServerSystemManager.CollectAllSystems();

            Debug.Log("ReplicatedPrefabMgr.Initialize()");
            ReplicatedPrefabMgr.Initialize();

            ClientServerSystemManager.InitServerSystems();

            Unity.DotsNetKit.Transport.NetworkEndPoint ep = Unity.DotsNetKit.Transport.NetworkEndPoint.AnyIpv4;
            ep.Port = 12345;
            World serverWorld = ClientServerSystemManager.serverWorld;
            var   nsrs        = serverWorld.GetExistingSystem <NetworkStreamReceiveSystem>();

            nsrs.Listen(ep);

            //Console.WriteLine(string.Format("Server is listening on port ({0})", ep.Port));

            string levelName = "Level1";

            SceneManager.LoadScene(levelName);
            //Console.WriteLine(string.Format("Load level ({0})", levelName));
        }