Created Debug Version Panel and Version Info Printer similar to DebugSystemPanel (#5624)

* Created Debug Version Panel and Version Info Printer similar to DebugSystemPanel

* dependency injection

* remove VersionInformationPrinter

* Fix sorting
This commit is contained in:
Andi Lilaj
2025-09-17 09:32:25 +02:00
committed by GitHub
parent 7411ae8138
commit b2ab247b5b
4 changed files with 56 additions and 18 deletions

View File

@@ -1,42 +1,39 @@
using System;
using Robust.Client.GameStates;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Player;
using Robust.Client.Profiling;
using Robust.Client.State;
using Robust.Client.Timing;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Network;
namespace Robust.Client.UserInterface.CustomControls.DebugMonitorControls
{
internal sealed class DebugMonitors : BoxContainer, IDebugMonitors
{
[Dependency] private readonly IClientGameTiming _timing = default!;
[Dependency] private readonly IClientGameStateManager _state = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IClientNetManager _net = default!;
private readonly Control[] _monitors = new Control[Enum.GetNames<DebugMonitor>().Length];
//TODO: Think about a factory for this
public DebugMonitors(IClientGameTiming gameTiming, IPlayerManager playerManager, IEyeManager eyeManager,
IInputManager inputManager, IStateManager stateManager, IClyde displayManager, IClientNetManager netManager,
IMapManager mapManager)
public void Init()
{
Visible = false;
SeparationOverride = 2;
Orientation = LayoutOrientation.Vertical;
Add(DebugMonitor.Fps, new FpsCounter(gameTiming));
Add(DebugMonitor.Fps, new FpsCounter(_timing));
Add(DebugMonitor.Coords, new DebugCoordsPanel());
Add(DebugMonitor.Net, new DebugNetPanel(netManager, gameTiming));
Add(DebugMonitor.Bandwidth, new DebugNetBandwidthPanel(netManager, gameTiming));
Add(DebugMonitor.Time, new DebugTimePanel(gameTiming, IoCManager.Resolve<IClientGameStateManager>()));
Add(DebugMonitor.Frames, new FrameGraph(gameTiming, IoCManager.Resolve<IConfigurationManager>()));
Add(DebugMonitor.Net, new DebugNetPanel(_net, _timing));
Add(DebugMonitor.Bandwidth, new DebugNetBandwidthPanel(_net, _timing));
Add(DebugMonitor.Time, new DebugTimePanel(_timing, _state));
Add(DebugMonitor.Frames, new FrameGraph(_timing, _cfg));
Add(DebugMonitor.Memory, new DebugMemoryPanel());
Add(DebugMonitor.Clyde, new DebugClydePanel { HorizontalAlignment = HAlignment.Left });
Add(DebugMonitor.System, new DebugSystemPanel { HorizontalAlignment = HAlignment.Left });
Add(DebugMonitor.Version, new DebugVersionPanel(_cfg) {HorizontalAlignment = HAlignment.Left});
Add(DebugMonitor.Input, new DebugInputPanel { HorizontalAlignment = HAlignment.Left });
Add(DebugMonitor.Prof, new LiveProfileViewControl());

View File

@@ -0,0 +1,39 @@
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Configuration;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Robust.Client.UserInterface.CustomControls.DebugMonitorControls
{
internal sealed class DebugVersionPanel : PanelContainer
{
public DebugVersionPanel(IConfigurationManager cfg)
{
var contents = new Label
{
FontColorShadowOverride = Color.Black,
};
AddChild(contents);
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(35, 134, 37, 138),
ContentMarginLeftOverride = 5,
ContentMarginRightOverride = 5,
ContentMarginTopOverride = 5,
ContentMarginBottomOverride = 5,
};
MouseFilter = contents.MouseFilter = MouseFilterMode.Ignore;
// Set visible explicitly
Visible = true;
HorizontalAlignment = HAlignment.Left;
VerticalAlignment = VAlignment.Top;
var buildInfo = GameBuildInformation.GetBuildInfoFromConfig(cfg);
contents.Text = $"Fork ID: {buildInfo.ForkId}\nFork Version: {buildInfo.Version}";
}
}
}

View File

@@ -36,5 +36,6 @@ public enum DebugMonitor
Input,
Bandwidth,
Prof,
System
System,
Version
}

View File

@@ -119,8 +119,9 @@ namespace Robust.Client.UserInterface
RootControl.AddChild(DebugConsole);
DebugConsole.SetPositionInParent(RootControl.ModalRoot.GetPositionInParent());
_debugMonitors = new DebugMonitors(_gameTiming, _playerManager, _eyeManager, _inputManager, _stateManager,
_clyde, _netManager, _mapManager);
_debugMonitors = new DebugMonitors();
_rootDependencies.InjectDependencies(_debugMonitors);
_debugMonitors.Init();
DebugConsole.BelowConsole.AddChild(_debugMonitors);
_inputManager.SetInputCommand(EngineKeyFunctions.ShowDebugConsole,