Редирект на вики в правилах (#281)

* Rules wiki redirect

* Better button
This commit is contained in:
Aviu00
2023-08-09 20:20:37 +03:00
committed by Aviu00
parent 1115d62db6
commit 9904daf28a
4 changed files with 46 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
using System.Numerics;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Content.Client.White.Rules;
using Content.Shared.White;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -12,7 +14,11 @@ namespace Content.Client.Info
public sealed class RulesAndInfoWindow : DefaultWindow
{
[Dependency] private readonly IResourceManager _resourceManager = default!;
[Dependency] private readonly RulesManager _rules = default!;
// WD EDIT
// [Dependency] private readonly RulesManager _rules = default!;
[Dependency] private readonly IUriOpener _uri = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
// WD EDIT END
public RulesAndInfoWindow()
{
@@ -31,7 +37,12 @@ namespace Content.Client.Info
TabContainer.SetTabTitle(rulesList, Loc.GetString("ui-info-tab-rules"));
TabContainer.SetTabTitle(tutorialList, Loc.GetString("ui-info-tab-tutorial"));
AddSection(rulesList, _rules.RulesSection());
// WD EDIT
// AddSection(rulesList, _rules.RulesSection());
var rulesWikiSection = new RulesWikiSection();
rulesList.InfoContainer.AddChild(rulesWikiSection);
rulesWikiSection.RulesButton.OnPressed += _ => _uri.OpenUri(_cfg.GetCVar(WhiteCVars.RulesWiki));
// WD EDIT END
PopulateTutorial(tutorialList);
Contents.AddChild(rootContainer);

View File

@@ -0,0 +1,11 @@
<BoxContainer xmlns="https://spacestation14.io"
Orientation="Vertical">
<Label Text="Правила сервера White Dream" StyleClasses="LabelHeading"/>
<BoxContainer Orientation="Vertical">
<Button Name="RulesButton"
StyleClasses="ButtonColorRed"
MinHeight="40"
Text="Открыть правила"
Access="Public"/>
</BoxContainer>
</BoxContainer>

View File

@@ -0,0 +1,14 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.White.Rules;
[GenerateTypedNameReferences]
public sealed partial class RulesWikiSection : BoxContainer
{
public RulesWikiSection()
{
RobustXamlLoader.Load(this);
}
}

View File

@@ -12,6 +12,14 @@ namespace Content.Shared.White;
[CVarDefs]
public sealed class WhiteCVars
{
/*
* Wiki rules
*/
public static readonly CVarDef<string> RulesWiki =
CVarDef.Create("white.wiki_rules", "https://wiki.ss14.su/%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D0%B0",
CVar.SERVER | CVar.REPLICATED);
/*
* Slang
*/