Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public DebugMonitors(IClientGameTiming gameTiming, IPlayerManager playerManager,
Add(DebugMonitor.System, new DebugSystemPanel { HorizontalAlignment = HAlignment.Left });
Add(DebugMonitor.Input, new DebugInputPanel { HorizontalAlignment = HAlignment.Left });
Add(DebugMonitor.Prof, new LiveProfileViewControl());
Add(DebugMonitor.Version, new DebugVersionPanel(IoCManager.Resolve<IConfigurationManager>()) { HorizontalAlignment = HAlignment.Left });

void Add(DebugMonitor monitor, Control instance)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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;

contents.Text = string.Join('\n', VersionInformationPrinter.GetInformationDump(cfg));
}
}
}
4 changes: 3 additions & 1 deletion Robust.Client/UserInterface/IDebugMonitors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ public enum DebugMonitor
Input,
Bandwidth,
Prof,
System
System,

Version
}
17 changes: 17 additions & 0 deletions Robust.Shared/Utility/VersionInformationPrinter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Robust.Shared.Configuration;

namespace Robust.Shared.Utility;

internal static class VersionInformationPrinter
{
public static string[] GetInformationDump(IConfigurationManager cfg)
{
var buildInfo = GameBuildInformation.GetBuildInfoFromConfig(cfg);

return new[]
{
$"Fork ID: {buildInfo.ForkId}",
$"Version: {buildInfo.Version}",
};
}
}
Loading