Adds a cvar for server rules (#8365)

Co-authored-by: Veritius <veritiusgaming@gmail.com>
Co-authored-by: ike709 <ike709@github.com>
This commit is contained in:
ike709
2022-05-23 14:43:09 -05:00
committed by GitHub
parent f9bdb66ec8
commit 0b15db1120
3 changed files with 18 additions and 5 deletions

View File

@@ -1,9 +1,10 @@
using Robust.Client.AutoGenerated;
using System.IO;
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Configuration;
namespace Content.Client.Info;
@@ -11,13 +12,16 @@ namespace Content.Client.Info;
public sealed partial class RulesControl : BoxContainer
{
[Dependency] private readonly IResourceCache _resourceManager = default!;
[Dependency] private readonly IConfigurationManager _cfgManager = default!;
public RulesControl()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
var path = "Server Info/" + _cfgManager.GetCVar(CCVars.RulesFile);
AddChild(new InfoSection(Loc.GetString("ui-rules-header"),
_resourceManager.ContentFileReadAllText($"/Server Info/Rules.txt"), true));
_resourceManager.ContentFileReadAllText(path), true));
}
}