Launcher info links. (#12781)
This commit is contained in:
committed by
GitHub
parent
083ef009d6
commit
a6045e4538
@@ -1,6 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.Links;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Client.AutoGenerated;
|
||||
@@ -68,7 +67,8 @@ namespace Content.Client.Credits
|
||||
|
||||
// Do not show "become a patron" button on Steam builds
|
||||
// since Patreon violates Valve's rules about alternative storefronts.
|
||||
if (!_cfg.GetCVar(CCVars.BrandingSteam))
|
||||
var linkPatreon = _cfg.GetCVar(CCVars.InfoLinksPatreon);
|
||||
if (!_cfg.GetCVar(CCVars.BrandingSteam) && linkPatreon != "")
|
||||
{
|
||||
Button patronButton;
|
||||
patronsContainer.AddChild(patronButton = new Button
|
||||
@@ -78,7 +78,7 @@ namespace Content.Client.Credits
|
||||
});
|
||||
|
||||
patronButton.OnPressed +=
|
||||
_ => IoCManager.Resolve<IUriOpener>().OpenUri(UILinks.Patreon);
|
||||
_ => IoCManager.Resolve<IUriOpener>().OpenUri(linkPatreon);
|
||||
}
|
||||
|
||||
var first = true;
|
||||
@@ -158,8 +158,13 @@ namespace Content.Client.Credits
|
||||
AddSection(Loc.GetString("credits-window-original-remake-team-section-title"), "OriginalRemake.txt");
|
||||
AddSection(Loc.GetString("credits-window-special-thanks-section-title"), "SpecialThanks.txt", true);
|
||||
|
||||
var linkGithub = _cfg.GetCVar(CCVars.InfoLinksGithub);
|
||||
|
||||
contributeButton.OnPressed += _ =>
|
||||
IoCManager.Resolve<IUriOpener>().OpenUri(UILinks.GitHub);
|
||||
IoCManager.Resolve<IUriOpener>().OpenUri(linkGithub);
|
||||
|
||||
if (linkGithub == "")
|
||||
contributeButton.Visible = false;
|
||||
}
|
||||
|
||||
private sealed class PatronEntry
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
using Content.Client.Changelog;
|
||||
using Content.Client.Credits;
|
||||
using Content.Client.Links;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -19,13 +20,18 @@ namespace Content.Client.Info
|
||||
AddChild(buttons);
|
||||
|
||||
var uriOpener = IoCManager.Resolve<IUriOpener>();
|
||||
var cfg = IoCManager.Resolve<IConfigurationManager>();
|
||||
|
||||
var reportButton = new Button {Text = Loc.GetString("server-info-report-button")};
|
||||
reportButton.OnPressed += args => uriOpener.OpenUri(UILinks.BugReport);
|
||||
var bugReport = cfg.GetCVar(CCVars.InfoLinksBugReport);
|
||||
if (bugReport != "")
|
||||
{
|
||||
var reportButton = new Button {Text = Loc.GetString("server-info-report-button")};
|
||||
reportButton.OnPressed += args => uriOpener.OpenUri(bugReport);
|
||||
buttons.AddChild(reportButton);
|
||||
}
|
||||
|
||||
var creditsButton = new Button {Text = Loc.GetString("server-info-credits-button")};
|
||||
creditsButton.OnPressed += args => new CreditsWindow().Open();
|
||||
buttons.AddChild(reportButton);
|
||||
buttons.AddChild(creditsButton);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using Content.Client.Changelog;
|
||||
using Content.Client.Credits;
|
||||
using Content.Client.Links;
|
||||
using Content.Client.UserInterface.Systems.EscapeMenu;
|
||||
using Content.Shared.CCVar;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -21,25 +22,31 @@ namespace Content.Client.Info
|
||||
AddChild(buttons);
|
||||
|
||||
var uriOpener = IoCManager.Resolve<IUriOpener>();
|
||||
var cfg = IoCManager.Resolve<IConfigurationManager>();
|
||||
|
||||
var rulesButton = new Button() {Text = Loc.GetString("server-info-rules-button")};
|
||||
rulesButton.OnPressed += args => new RulesAndInfoWindow().Open();
|
||||
buttons.AddChild(rulesButton);
|
||||
|
||||
var discordButton = new Button {Text = Loc.GetString("server-info-discord-button")};
|
||||
discordButton.OnPressed += args => uriOpener.OpenUri(UILinks.Discord);
|
||||
AddInfoButton("server-info-discord-button", CCVars.InfoLinksDiscord);
|
||||
AddInfoButton("server-info-website-button", CCVars.InfoLinksWebsite);
|
||||
AddInfoButton("server-info-wiki-button", CCVars.InfoLinksWiki);
|
||||
AddInfoButton("server-info-forum-button", CCVars.InfoLinksForum);
|
||||
|
||||
var websiteButton = new Button {Text = Loc.GetString("server-info-website-button")};
|
||||
websiteButton.OnPressed += args => uriOpener.OpenUri(UILinks.Website);
|
||||
|
||||
var wikiButton = new Button {Text = Loc.GetString("server-info-wiki-button")};
|
||||
wikiButton.OnPressed += args => uriOpener.OpenUri(UILinks.Wiki);
|
||||
var changelogButton = new ChangelogButton();
|
||||
changelogButton.OnPressed += args => UserInterfaceManager.GetUIController<ChangelogUIController>().ToggleWindow();
|
||||
buttons.AddChild(changelogButton);
|
||||
buttons.AddChild(rulesButton);
|
||||
buttons.AddChild(discordButton);
|
||||
buttons.AddChild(websiteButton);
|
||||
buttons.AddChild(wikiButton);
|
||||
|
||||
void AddInfoButton(string loc, CVarDef<string> cVar)
|
||||
{
|
||||
var link = cfg.GetCVar(cVar);
|
||||
if (link == "")
|
||||
return;
|
||||
|
||||
var button = new Button { Text = Loc.GetString(loc) };
|
||||
button.OnPressed += _ => uriOpener.OpenUri(link);
|
||||
buttons.AddChild(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Client.Changelog;
|
||||
using Content.Client.Credits;
|
||||
using Content.Client.Links;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
namespace Content.Client.Links
|
||||
{
|
||||
public static class UILinks
|
||||
{
|
||||
public const string GitHub = "https://github.com/space-wizards/space-station-14/";
|
||||
public const string Patreon = "https://www.patreon.com/spacestation14";
|
||||
|
||||
public const string Discord = "https://discord.ss14.io/";
|
||||
public const string BugReport = "https://github.com/space-wizards/space-station-14/issues/new/choose";
|
||||
public const string Website = "https://spacestation14.io";
|
||||
public const string Wiki = "https://wiki.spacestation14.io";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Info;
|
||||
using Content.Client.Links;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Client.UserInterface.Systems.Info;
|
||||
using Content.Shared.CCVar;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controllers;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Input.Binding;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -20,6 +21,7 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
||||
{
|
||||
[Dependency] private readonly IClientConsoleHost _console = default!;
|
||||
[Dependency] private readonly IUriOpener _uri = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly ChangelogUIController _changelog = default!;
|
||||
[Dependency] private readonly InfoUIController _info = default!;
|
||||
[Dependency] private readonly OptionsUIController _options = default!;
|
||||
@@ -93,9 +95,12 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
||||
|
||||
_escapeWindow.WikiButton.OnPressed += _ =>
|
||||
{
|
||||
_uri.OpenUri(UILinks.Wiki);
|
||||
_uri.OpenUri(_cfg.GetCVar(CCVars.InfoLinksWiki));
|
||||
};
|
||||
|
||||
// Hide wiki button if we don't have a link for it.
|
||||
_escapeWindow.WikiButton.Visible = _cfg.GetCVar(CCVars.InfoLinksWiki) != "";
|
||||
|
||||
CommandBinds.Builder
|
||||
.Bind(EngineKeyFunctions.EscapeMenu,
|
||||
InputCmdHandler.FromDelegate(_ => ToggleWindow()))
|
||||
|
||||
Reference in New Issue
Block a user