private void DrawContent(int windowID) { GUILayout.BeginVertical(); GUI.DragWindow(moveRect); GameEvents.debugEvents = GUILayout.Toggle(GameEvents.debugEvents, "Debug GameEvents", buttonStyle); displayFast = GUILayout.Toggle(displayFast, "Fast debug update", buttonStyle); displayVectors = GUILayout.Toggle(displayVectors, "Display vessel vectors", buttonStyle); if (displayVectors) { GUILayout.Label(vectorText, labelStyle); } displayNTP = GUILayout.Toggle(displayNTP, "Display NTP/Subspace statistics", buttonStyle); if (displayNTP) { GUILayout.Label(ntpText, labelStyle); } displayConnectionQueue = GUILayout.Toggle(displayConnectionQueue, "Display connection statistics", buttonStyle); if (displayConnectionQueue) { GUILayout.Label(connectionText, labelStyle); } displayDynamicTickStats = GUILayout.Toggle(displayDynamicTickStats, "Display dynamic tick statistics", buttonStyle); if (displayDynamicTickStats) { GUILayout.Label(dynamicTickText, labelStyle); } displayRequestedRates = GUILayout.Toggle(displayRequestedRates, "Display requested rates", buttonStyle); if (displayRequestedRates) { GUILayout.Label(requestedRateText, labelStyle); } profiler.samplingEnabled = GUILayout.Toggle(profiler.samplingEnabled, "Record Profiler Samples", buttonStyle); displayVesselRecorder = GUILayout.Toggle(displayVesselRecorder, "Display Vessel Recorder", buttonStyle); if (displayVesselRecorder) { if (!vesselRecorder.active) { if (GUILayout.Button("Start Recording", buttonStyle)) { vesselRecorder.StartRecord(); } if (GUILayout.Button("Playback", buttonStyle)) { vesselRecorder.StartPlayback(); } } else { if (GUILayout.Button("Stop Recording", buttonStyle)) { vesselRecorder.StopRecord(); } if (GUILayout.Button("Cancel Recording", buttonStyle)) { vesselRecorder.CancelRecord(); } } } posistionStatistics.active = GUILayout.Toggle(posistionStatistics.active, "Display Posistional Error", buttonStyle); if (posistionStatistics.active) { if (posistionStatistics.selectedVessel != Guid.Empty) { GUILayout.Label("Posistional Error: " + Math.Round(posistionStatistics.distanceError, 2), labelStyle); GUILayout.Label("Velocity Error: " + Math.Round(posistionStatistics.velocityError, 2), labelStyle); GUILayout.Label("Rotational Error: " + Math.Round(posistionStatistics.rotationError, 2), labelStyle); GUILayout.Label("Update HZ: " + Math.Round(posistionStatistics.updateHz, 2), labelStyle); } else { GUILayout.Label("(no selected vessel)", labelStyle); } } displayVesselTimeDelay = GUILayout.Toggle(displayVesselTimeDelay, "Vessel Delay Settings", buttonStyle); if (displayVesselTimeDelay) { GUILayout.BeginHorizontal(); vesselworkerTimeDelay = GUILayout.TextArea(vesselworkerTimeDelay, textAreaOptions); if (GUILayout.Button("Set", buttonStyle)) { float newDelay = 0f; if (float.TryParse(vesselworkerTimeDelay, out newDelay)) { vesselWorker.delayTime = newDelay; } else { vesselWorker.delayTime = 0f; vesselworkerTimeDelay = "0"; } } GUILayout.EndHorizontal(); } displayMeshStats = GUILayout.Toggle(displayMeshStats, "Mesh statistics", buttonStyle); if (displayMeshStats) { UdpMeshClient udpMesh = networkWorker.GetMesh(); foreach (UdpPeer peer in udpMesh.GetPeers()) { if (peer.guid != UdpMeshCommon.GetMeshAddress()) { string playerName = networkWorker.GetMeshPlayername(peer.guid); if (playerName != null) { GUILayout.Label(playerName + ":", labelStyle); } else { GUILayout.Label(peer.guid + ":", labelStyle); } double latency4 = peer.latency4 / (double)TimeSpan.TicksPerMillisecond; double latency6 = peer.latency6 / (double)TimeSpan.TicksPerMillisecond; double offset = peer.offset / (double)TimeSpan.TicksPerSecond; if (peer.usev4) { GUILayout.Label("V4 Latency: " + Math.Round(latency4, 2) + "ms", labelStyle); } if (peer.usev6) { GUILayout.Label("V6 Latency: " + Math.Round(latency6, 2) + "ms", labelStyle); } if (peer.usev4 || peer.usev6) { GUILayout.Label("Clock offset: " + Math.Round(offset, 2), labelStyle); } else { GUILayout.Label("No contact - using server relay", labelStyle); } } } } displayVesselCache = GUILayout.Toggle(displayVesselCache, "Display vessel cache", buttonStyle); if (displayVesselCache) { GUILayout.Label("Normal:", labelStyle); foreach (KeyValuePair <Guid, Queue <VesselUpdate> > kvp in vesselWorker.vesselUpdateQueue) { if (kvp.Value.Count > 0) { GUILayout.Label(kvp.Key + ": " + kvp.Value.Count, labelStyle); } } GUILayout.Label("Mesh:", labelStyle); foreach (KeyValuePair <Guid, Queue <VesselUpdate> > kvp in vesselWorker.vesselUpdateMeshQueue) { if (kvp.Value.Count > 0) { GUILayout.Label(kvp.Key + ": " + kvp.Value.Count, labelStyle); } } } displayRecycler = GUILayout.Toggle(displayRecycler, "Display recycler", buttonStyle); if (displayRecycler) { GUILayout.Label(recyclerText, labelStyle); } if (GUILayout.Button("Dump recycler", buttonStyle)) { dumpRecycler = true; } GUILayout.EndVertical(); }
private void DrawContent(int windowID) { GUILayout.BeginVertical(); GUI.DragWindow(moveRect); GameEvents.debugEvents = GUILayout.Toggle(GameEvents.debugEvents, "Debug GameEvents", buttonStyle); displayFast = GUILayout.Toggle(displayFast, "Fast debug update", buttonStyle); displayVectors = GUILayout.Toggle(displayVectors, "Display vessel vectors", buttonStyle); if (displayVectors) { GUILayout.Label(vectorText, labelStyle); } displayNTP = GUILayout.Toggle(displayNTP, "Display NTP/Subspace statistics", buttonStyle); if (displayNTP) { GUILayout.Label(ntpText, labelStyle); } displayConnectionQueue = GUILayout.Toggle(displayConnectionQueue, "Display connection statistics", buttonStyle); if (displayConnectionQueue) { GUILayout.Label(connectionText, labelStyle); } displayDynamicTickStats = GUILayout.Toggle(displayDynamicTickStats, "Display dynamic tick statistics", buttonStyle); if (displayDynamicTickStats) { GUILayout.Label(dynamicTickText, labelStyle); } displayRequestedRates = GUILayout.Toggle(displayRequestedRates, "Display requested rates", buttonStyle); if (displayRequestedRates) { GUILayout.Label(requestedRateText, labelStyle); } displayProfilerStatistics = GUILayout.Toggle(displayProfilerStatistics, "Display Profiler Statistics", buttonStyle); if (displayProfilerStatistics) { if (System.Diagnostics.Stopwatch.IsHighResolution) { if (GUILayout.Button("Reset Profiler history", buttonStyle)) { Profiler.updateData = new ProfilerData(); Profiler.fixedUpdateData = new ProfilerData(); Profiler.guiData = new ProfilerData(); } GUILayout.Label("Timer resolution: " + System.Diagnostics.Stopwatch.Frequency + " hz", labelStyle); GUILayout.Label(profilerText, labelStyle); } else { GUILayout.Label("Timer resolution: " + System.Diagnostics.Stopwatch.Frequency + " hz", labelStyle); GUILayout.Label("Profiling statistics unavailable without a high resolution timer"); } } displayVesselRecorder = GUILayout.Toggle(displayVesselRecorder, "Display Vessel Recorder", buttonStyle); if (displayVesselRecorder) { if (!vesselRecorder.active) { if (GUILayout.Button("Start Recording", buttonStyle)) { vesselRecorder.StartRecord(); } if (GUILayout.Button("Playback", buttonStyle)) { vesselRecorder.StartPlayback(); } } else { if (GUILayout.Button("Stop Recording", buttonStyle)) { vesselRecorder.StopRecord(); } if (GUILayout.Button("Cancel Recording", buttonStyle)) { vesselRecorder.CancelRecord(); } } } posistionStatistics.active = GUILayout.Toggle(posistionStatistics.active, "Display Posistional Error", buttonStyle); if (posistionStatistics.active) { if (posistionStatistics.selectedVessel != Guid.Empty) { GUILayout.Label("Posistional Error: " + Math.Round(posistionStatistics.distanceError, 2), labelStyle); GUILayout.Label("Velocity Error: " + Math.Round(posistionStatistics.velocityError, 2), labelStyle); GUILayout.Label("Rotational Error: " + Math.Round(posistionStatistics.rotationError, 2), labelStyle); GUILayout.Label("Update HZ: " + Math.Round(posistionStatistics.updateHz, 2), labelStyle); } else { GUILayout.Label("(no selected vessel)", labelStyle); } } GUILayout.EndVertical(); }