コード例 #1
0
        private GameApplication()
        {
            Terrain           = new TerrainApplication();
            ConnectionManager = new ConnectionManagerApplication();
            SocketController  = new SocketControllerApplication("127.0.0.1", 8080);
            //registra comunicação com o terreno
            foreach (var action in Terrain.SocketMessageTypes)
            {
                SocketController.RegisterMessageType(action);
            }

            var updateChunksProcess = new ApplicationThread(100);

            //update thread event
            updateChunksProcess.OnRun += (obj) =>
            {
                string error;
                if (!Terrain.UpdateChunks(out error))
                {
                    Log(error);
                }
            };
            updateThreads.Add(updateChunksProcess);


            var updateBlocksProcess = new ApplicationThread(100);

            //update thread event
            updateBlocksProcess.OnRun += (obj) =>
            {
                string error;
                if (!Terrain.UpdateBlocks(out error))
                {
                    Log(error);
                }
            };
            updateThreads.Add(updateBlocksProcess);

            var updateApplication = new ApplicationThread(100);

            //update thread event
            updateApplication.OnRun += (obj) =>
            {
                string error;
                if (!Terrain.UpdateBlocks(out error))
                {
                    Log(error);
                }
            };
            updateThreads.Add(updateApplication);
        }
コード例 #2
0
        public GameApplication()
        {
            Terrain          = new TerrainApplication();
            SocketController = new SocketControllerApplication("127.0.0.1", 8080);

            foreach (var action in Terrain.SocketMessageTypes)
            {
                SocketController.RegisterMessageType(action);
            }

            var updateApplication = new ApplicationThread(100);

            //update thread event
            updateApplication.OnRun += (obj) =>
            {
                string updateError;
                if (!Update(out updateError))
                {
                    Log(updateError);
                }
            };
            updateThreads.Add(updateApplication);
        }