internal async void OnUpdate()
        {
            while (!Server.Instance.IsShutdown())
            {
                ClockConstantController.Start("gui_outputUpdate");
                ConcurrentQueue <LoggerInfo> queue = Server.Instance.Logger.GuiLoggerTexts;
                if (queue.Count == 0)
                {
                    await Task.Delay(1000 / 200);

                    continue;
                }
                else
                {
                    LoggerInfo info = null;
                    queue.TryDequeue(out info);
                    if (this.CheckShowOutput(info.Level))
                    {
                        if (!string.IsNullOrEmpty(info.Text))
                        {
                            textBox1.AppendText(info.Text + Environment.NewLine);
                        }
                    }
                }
                await ClockConstantController.Stop("gui_outputUpdate");
            }
        }
Exemple #2
0
        private async void OnUpdate()
        {
            while (!Server.Instance.IsShutdown())
            {
                ClockConstantController.Start("raknetUpdate");

                if (this.receiveDataQueue.Count > 0)
                {
                    ReceiveData data = null;
                    this.receiveDataQueue.TryDequeue(out data);
                    this.HandlePacket(data.Point, data.Data);
                }

                string[] bl = this.blockUsers.Keys.ToArray();
                for (int i = 0; i < bl.Length; ++i)
                {
                    this.blockUsers[bl[i]] -= 1;
                    if (this.blockUsers[bl[i]] <= 0)
                    {
                        int r = 0;
                        this.blockUsers.TryRemove(bl[i], out r);
                    }
                }

                RakNetSession[] sl = this.sessions.Values.ToArray();
                for (int i = 0; i < sl.Length; ++i)
                {
                    sl[i].Update();
                }

                await ClockConstantController.Stop("raknetUpdate");
            }
        }
Exemple #3
0
        private async void Update()
        {
            while (!IsShutdown())
            {
                ClockConstantController.Start("server");
                if (this.mineNETConfig.EnableConsoleInput)
                {
                    this.CommandHandle();
                }

                Player[] players = this.GetPlayers();
                for (int i = 0; i < players?.Length; ++i)
                {
                    players[i].OnUpdate(this.tick);
                }

                World[] worlds = this.worlds.Values.ToArray();
                for (int i = 0; i < worlds.Length; ++i)
                {
                    worlds[i].OnUpdate(this.tick);
                }

                if (this.tick % 20 == 0)
                {
                    this.SendPlayersChunk();
                }
                await ClockConstantController.Stop("server");

                ++this.tick;
            }
        }