2021-06-21 02:13:54 +02:00
|
|
|
using Content.Client.Changelog;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Client.Credits;
|
|
|
|
|
using Content.Client.Links;
|
2021-02-25 09:50:45 +01:00
|
|
|
using Robust.Client.UserInterface;
|
2019-10-18 14:28:39 +02:00
|
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
using Robust.Shared.Localization;
|
|
|
|
|
using Robust.Shared.Utility;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Client.Info
|
2019-10-18 14:28:39 +02:00
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ServerInfo : BoxContainer
|
2019-10-18 14:28:39 +02:00
|
|
|
{
|
|
|
|
|
private readonly RichTextLabel _richTextLabel;
|
|
|
|
|
|
2020-02-26 16:42:12 +01:00
|
|
|
public ServerInfo()
|
2019-10-18 14:28:39 +02:00
|
|
|
{
|
2021-09-19 19:56:04 +02:00
|
|
|
Orientation = LayoutOrientation.Vertical;
|
|
|
|
|
|
2019-10-18 14:28:39 +02:00
|
|
|
_richTextLabel = new RichTextLabel
|
|
|
|
|
{
|
2021-02-21 12:38:56 +01:00
|
|
|
VerticalExpand = true
|
2019-10-18 14:28:39 +02:00
|
|
|
};
|
|
|
|
|
AddChild(_richTextLabel);
|
|
|
|
|
|
2021-07-18 18:39:31 +02:00
|
|
|
var buttons = new BoxContainer
|
|
|
|
|
{
|
|
|
|
|
Orientation = LayoutOrientation.Horizontal
|
|
|
|
|
};
|
2019-10-18 14:28:39 +02:00
|
|
|
AddChild(buttons);
|
|
|
|
|
|
|
|
|
|
var uriOpener = IoCManager.Resolve<IUriOpener>();
|
|
|
|
|
|
2021-10-03 23:48:29 +02:00
|
|
|
var rulesButton = new Button() { Text = Loc.GetString("server-info-rules-button") };
|
2021-12-09 14:22:49 -08:00
|
|
|
rulesButton.OnPressed += args => new RulesAndInfoWindow().Open();
|
2021-10-03 23:48:29 +02:00
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
var discordButton = new Button {Text = Loc.GetString("server-info-discord-button") };
|
2020-06-14 15:15:07 +02:00
|
|
|
discordButton.OnPressed += args => uriOpener.OpenUri(UILinks.Discord);
|
2019-10-18 14:28:39 +02:00
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
var websiteButton = new Button {Text = Loc.GetString("server-info-website-button") };
|
2020-06-14 15:15:07 +02:00
|
|
|
websiteButton.OnPressed += args => uriOpener.OpenUri(UILinks.Website);
|
2019-10-18 14:28:39 +02:00
|
|
|
|
2022-01-23 18:47:10 +01:00
|
|
|
var wikiButton = new Button {Text = Loc.GetString("server-info-wiki-button") };
|
|
|
|
|
wikiButton.OnPressed += args => uriOpener.OpenUri(UILinks.Wiki);
|
|
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
var reportButton = new Button { Text = Loc.GetString("server-info-report-button") };
|
2020-12-02 08:45:07 +00:00
|
|
|
reportButton.OnPressed += args => uriOpener.OpenUri(UILinks.BugReport);
|
|
|
|
|
|
2021-06-21 02:13:54 +02:00
|
|
|
var creditsButton = new Button { Text = Loc.GetString("server-info-credits-button") };
|
2020-12-02 08:45:07 +00:00
|
|
|
creditsButton.OnPressed += args => new CreditsWindow().Open();
|
|
|
|
|
|
2021-02-25 09:50:45 +01:00
|
|
|
var changelogButton = new ChangelogButton
|
|
|
|
|
{
|
|
|
|
|
HorizontalExpand = true,
|
|
|
|
|
HorizontalAlignment = HAlignment.Right
|
|
|
|
|
};
|
|
|
|
|
|
2021-10-03 23:48:29 +02:00
|
|
|
buttons.AddChild(rulesButton);
|
2019-10-18 14:28:39 +02:00
|
|
|
buttons.AddChild(discordButton);
|
|
|
|
|
buttons.AddChild(websiteButton);
|
2022-01-23 18:47:10 +01:00
|
|
|
buttons.AddChild(wikiButton);
|
2020-12-02 08:45:07 +00:00
|
|
|
buttons.AddChild(reportButton);
|
|
|
|
|
buttons.AddChild(creditsButton);
|
2021-02-25 09:50:45 +01:00
|
|
|
buttons.AddChild(changelogButton);
|
2019-10-18 14:28:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetInfoBlob(string markup)
|
|
|
|
|
{
|
2021-12-20 12:42:42 +01:00
|
|
|
_richTextLabel.SetMessage(FormattedMessage.FromMarkup(markup));
|
2019-10-18 14:28:39 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|