Ejemplo n.º 1
0
        public DebugServer(
            int port,
            string fileServicePathPrefix,
            DebugFileService.ChangedCallback onFileChanged = null)
        {
            if (!HttpListener.IsSupported)
            {
                return;
            }
            callbacks       = new Dictionary <string, OnRequest>();
            requestContexts = new Queue <HttpListenerContext>();
#if UNITY_EDITOR || !UNITY_WEBGL // エディタか、WebGLでない時だけサーバ起動
            listener = new HttpListener();
            listener.Prefixes.Add("http://*:" + port + "/");
            listener.Start();
            listener.BeginGetContext(OnRequestArrival, this);
#endif
            fileService            = new DebugFileService(fileServicePathPrefix);
            fileService.OnChanged += onFileChanged;
        }