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"); } }
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"); } }
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; } }
public InputOutput() { InitializeComponent(); comboBox1.Items.Clear(); comboBox1.Items.Add(LangManager.GetString("mainForm_inputMode_command_label")); comboBox1.Items.Add(LangManager.GetString("mainForm_inputMode_say_label")); comboBox1.SelectedIndex = 0; ClockConstantController.CreateController("gui_outputUpdate", 1000 / 200); }
private void UDPClientInit(ushort port) { this.client = new UdpClient(new IPEndPoint(IPAddress.Any, port)); this.client.Client.ReceiveBufferSize = int.MaxValue; this.client.Client.SendBufferSize = int.MaxValue; this.client.DontFragment = false; this.client.EnableBroadcast = false; uint IOC_IN = 0x80000000; uint IOC_VENDOR = 0x18000000; uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12; this.client.Client.IOControl((int)SIO_UDP_CONNRESET, new byte[] { Convert.ToByte(false) }, null); ClockConstantController.CreateController("raknetUpdate", UPDATE_TICK); this.client.BeginReceive(this.OnReceive, null); }
public async void OnUpdate() { while (!Server.Instance.IsShutdown()) { ClockConstantController.Start("gui_playerlist"); Player[] players = Server.Instance.GetPlayers(); List <string> list = new List <string>(); List <string> online = new List <string>(); for (int i = 0; i < players.Length; ++i) { if (!string.IsNullOrEmpty(players[i].Name)) { if (!listBox1.Items.Contains(players[i].Name)) { listBox1.Items.Add(players[i].Name); } } list.Add(players[i].Name); } foreach (object obj in listBox1.Items) { online.Add(obj.ToString()); } for (int i = 0; i < online.Count; ++i) { if (!list.Contains(online[i])) { if (listBox1.Items.Contains(online[i])) { listBox1.Items.Remove(online[i]); } } } await ClockConstantController.Stop("gui_playerlist"); } }
public PlayerList() { InitializeComponent(); ClockConstantController.CreateController("gui_playerlist", 2000); }