Beispiel #1
0
        /// <summary>
        /// Starts the server.
        /// </summary>
        public void Start()
        {
            Loom.Init();
            _listener.Start();
            ThreadPool.QueueUserWorkItem((o) =>
            {
                Debug.Log("Webserver running 1...");

                try {
                    while (_listener.IsListening)
                    {
                        ThreadPool.QueueUserWorkItem((c) =>
                        {
                            var ctx = c as HttpListenerContext;
                            try {
                                byte[] buf = ProcessReponse(ctx);
                                if (buf != null)
                                {
                                    ctx.Response.ContentLength64 = buf.Length;
                                    ctx.Response.OutputStream.Write(buf, 0, buf.Length);
                                }
                            } catch (Exception e) {
                                Console.WriteLine(e);
                                ctx.Response.StatusCode = 500;
                            } finally {
                                // always close the stream
                                ctx.Response.OutputStream.Close();
                            }
                        }, _listener.GetContext());
                    }
                } catch (Exception ex) {
                    Console.WriteLine(ex);
                }
            });
        }
Beispiel #2
0
 private void OnEnable()
 {
     if (Application.isPlaying)
     {
         Loom.Init();
     }
 }
Beispiel #3
0
 void Awake()
 {
     if (Loom.Instance == null)
     {
         Loom.Init();
     }
     ParseObject.RegisterSubclass <GameUser>();
 }
Beispiel #4
0
        //程序入口
        protected virtual void Awake()
        {
            //核心不能销毁
            DontDestroyOnLoad(this.gameObject);

            //线程模块
            Loom.Init();
            //日志模块
            TLogger.Instance.ToString();

            TLogger.Log("基础模块开始初始化.", "MainControl", "Awake - IniMainModules");
            IniMainModules();
            TLogger.Log("基础模块初始化完成.", "MainControl", "Awake - IniMainModules");

            TLogger.Log("边缘模块开始初始化.", "MainControl", "Awake - IniMarginalModules");
            IniMarginalModules();
            TLogger.Log("边缘模块初始化完成.", "MainControl", "Awake - IniMarginalModules");

            TLogger.Log("游戏初始化完成.", "MainControl", "Awake");
        }
Beispiel #5
0
 void Awake()
 {
     Instance = this;
     Loom.Init();
 }