private void InterfaceTimer_Tick(object sender, EventArgs e) { try { Text = string.Format("Total: {0}, Real: {1}", Envir.LastCount, Envir.LastRealCount); PlayersLabel.Text = string.Format("Players: {0}", Envir.Players.Count); MonsterLabel.Text = string.Format("Monsters: {0}", Envir.MonsterCount); ConnectionsLabel.Text = string.Format("Connections: {0}", Envir.Connections.Count); while (!MessageLog.IsEmpty) { string message; if (!MessageLog.TryDequeue(out message)) { continue; } LogTextBox.AppendText(message); } while (!DebugLog.IsEmpty) { string message; if (!DebugLog.TryDequeue(out message)) { continue; } DebugLogTextBox.AppendText(message); } while (!ChatLog.IsEmpty) { string message; if (!ChatLog.TryDequeue(out message)) { continue; } ChatLogTextBox.AppendText(message); } ProcessPlayersOnlineTab(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void InterfaceTimer_Tick(object sender, EventArgs e) { try { Text = string.Format("Total: {0}, Real: {1}", Envir.LastCount, Envir.LastRealCount); PlayersLabel.Text = string.Format("Players: {0}", Envir.Players.Count); MonsterLabel.Text = string.Format("Monsters: {0}", Envir.MonsterCount); ConnectionsLabel.Text = string.Format("Connections: {0}", Envir.Connections.Count); if (Settings.Multithreaded && (Envir.MobThreads != null)) { CycleDelayLabel.Text = string.Format("CycleDelays: {0:0000}", Envir.LastRunTime); for (int i = 0; i < Envir.MobThreads.Length; i++) { if (Envir.MobThreads[i] == null) { break; } CycleDelayLabel.Text = CycleDelayLabel.Text + string.Format("|{0:0000}", Envir.MobThreads[i].LastRunTime); } } else { CycleDelayLabel.Text = string.Format("CycleDelay: {0}", Envir.LastRunTime); } while (!MessageLog.IsEmpty) { string message; if (!MessageLog.TryDequeue(out message)) { continue; } LogTextBox.AppendText(message); } while (!DebugLog.IsEmpty) { string message; if (!DebugLog.TryDequeue(out message)) { continue; } DebugLogTextBox.AppendText(message); } while (!ChatLog.IsEmpty) { string message; if (!ChatLog.TryDequeue(out message)) { continue; } ChatLogTextBox.AppendText(message); } ProcessPlayersOnlineTab(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void InterfaceTimer_Tick(object sender, EventArgs e) { try { Text = $"服务器刷新总数: {Envir.LastCount},实际总数: {Envir.LastRealCount}"; PlayersLabel.Text = $"玩家: {Envir.Players.Count}"; MonsterLabel.Text = $"怪物: {Envir.MonsterCount}"; ConnectionsLabel.Text = $"连接: {Envir.Connections.Count}"; if (Settings.Multithreaded && (Envir.MobThreads != null)) { CycleDelayLabel.Text = $"循环延迟: {Envir.LastRunTime:0000}"; for (int i = 0; i < Envir.MobThreads.Length; i++) { if (Envir.MobThreads[i] == null) { break; } CycleDelayLabel.Text = CycleDelayLabel.Text + $"|{Envir.MobThreads[i].LastRunTime:0000}"; } } else { CycleDelayLabel.Text = $"循环延迟: {Envir.LastRunTime}"; } while (!MessageQueue.MessageLog.IsEmpty) { string message; if (!MessageQueue.MessageLog.TryDequeue(out message)) { continue; } LogTextBox.AppendText(message); } while (!MessageQueue.DebugLog.IsEmpty) { string message; if (!MessageQueue.DebugLog.TryDequeue(out message)) { continue; } DebugLogTextBox.AppendText(message); } while (!MessageQueue.ChatLog.IsEmpty) { string message; if (!MessageQueue.ChatLog.TryDequeue(out message)) { continue; } ChatLogTextBox.AppendText(message); } ProcessPlayersOnlineTab(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void InterfaceTimer_Tick(object sender, EventArgs e) { try { Text = string.Format("Total: {0}, Real: {1}", Envir.LastCount, Envir.LastRealCount); PlayersLabel.Text = string.Format("Players: {0}", Envir.Players.Count); MonsterLabel.Text = string.Format("Monsters: {0}", Envir.MonsterCount); ConnectionsLabel.Text = string.Format("Connections: {0}", Envir.Connections.Count); runningTimeLabel.Text = $"Running Time: {Envir.Stopwatch.ElapsedMilliseconds / 1000 / 60 / 60 / 24}d:{Envir.Stopwatch.ElapsedMilliseconds / 1000 / 60 / 60}h:{Envir.Stopwatch.ElapsedMilliseconds / 1000 / 60}m:{Envir.Stopwatch.ElapsedMilliseconds / 1000 % 60}s"; if (Envir.LastRunTime > 200) { CycleDelayLabel.ForeColor = Color.Red; } else { CycleDelayLabel.ForeColor = Color.Black; } if (Settings.Multithreaded && (Envir.MobThreads != null)) { CycleDelayLabel.Text = string.Format("CycleDelays: {0:0000}", Envir.LastRunTime); for (int i = 0; i < Envir.MobThreads.Length; i++) { if (Envir.MobThreads[i] == null) { break; } if (Envir.MobThreads[i].LastRunTime > 200 && CycleDelayLabel.ForeColor != Color.Red) { CycleDelayLabel.ForeColor = Color.Red; } if (CycleDelayLabel.ForeColor != Color.Red) { CycleDelayLabel.ForeColor = Color.Black; } CycleDelayLabel.Text = CycleDelayLabel.Text + string.Format("|{0:0000}", Envir.MobThreads[i].LastRunTime); } } else { CycleDelayLabel.Text = string.Format("CycleDelay: {0}", Envir.LastRunTime); } while (!MessageLog.IsEmpty) { if (!MessageLog.TryDequeue(out string message)) { continue; } LogTextBox.AppendText(message); } while (!DebugLog.IsEmpty) { if (!DebugLog.TryDequeue(out string message)) { continue; } DebugLogTextBox.AppendText(message); } while (!ChatLog.IsEmpty) { if (!ChatLog.TryDequeue(out string message)) { continue; } ChatLogTextBox.AppendText(message); } ProcessPlayersOnlineTab(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }