This commit is contained in:
Pieter-Jan Briers
2020-06-14 15:15:07 +02:00
parent 79ad5fd09e
commit 422f64fed0
14 changed files with 301 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
using Content.Client.UserInterface;
using JetBrains.Annotations;
using Robust.Client.Interfaces.Console;
namespace Content.Client.Commands
{
[UsedImplicitly]
public sealed class CreditsCommand : IConsoleCommand
{
public string Command => "credits";
public string Description => "Opens the credits window";
public string Help => "credits";
public bool Execute(IDebugConsole console, params string[] args)
{
new CreditsWindow().Open();
return false;
}
}
}

View File

@@ -92,6 +92,7 @@ namespace Content.Client.State
};
_lobby.LeaveButton.OnPressed += args => _console.ProcessCommand("disconnect");
_lobby.CreditsButton.OnPressed += args => new CreditsWindow().Open();
UpdatePlayerList();

11
Content.Client/UILinks.cs Normal file
View File

@@ -0,0 +1,11 @@
namespace Content.Client
{
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://discordapp.com/invite/t2jac3p";
public const string Website = "https://spacestation14.io";
}
}

View File

@@ -0,0 +1,219 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Content.Client.UserInterface.Stylesheets;
using Newtonsoft.Json;
using Robust.Client.Credits;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
#nullable enable
namespace Content.Client.UserInterface
{
public sealed class CreditsWindow : SS14Window
{
[Dependency] private readonly IResourceCache _resourceManager = default!;
private static readonly Dictionary<string, int> PatronTierPriority = new Dictionary<string, int>
{
["Nuclear Operative"] = 1,
["Syndicate Agent"] = 2,
["Revolutionary"] = 3
};
public CreditsWindow()
{
IoCManager.InjectDependencies(this);
Title = Loc.GetString("Credits");
var rootContainer = new TabContainer();
var patronsList = new ScrollContainer();
var ss14ContributorsList = new ScrollContainer();
var licensesList = new ScrollContainer();
rootContainer.AddChild(ss14ContributorsList);
rootContainer.AddChild(patronsList);
rootContainer.AddChild(licensesList);
TabContainer.SetTabTitle(patronsList, Loc.GetString("Patrons"));
TabContainer.SetTabTitle(ss14ContributorsList, Loc.GetString("Credits"));
TabContainer.SetTabTitle(licensesList, Loc.GetString("Open Source Licenses"));
PopulatePatronsList(patronsList);
PopulateCredits(ss14ContributorsList);
PopulateLicenses(licensesList);
Contents.AddChild(rootContainer);
CustomMinimumSize = (650, 450);
}
private void PopulateLicenses(ScrollContainer licensesList)
{
var margin = new MarginContainer {MarginLeftOverride = 2, MarginTopOverride = 2};
var vBox = new VBoxContainer();
margin.AddChild(vBox);
foreach (var entry in CreditsManager.GetLicenses().OrderBy(p => p.Name))
{
vBox.AddChild(new Label {StyleClasses = {StyleBase.StyleClassLabelHeading}, Text = entry.Name});
// We split these line by line because otherwise
// the LGPL causes Clyde to go out of bounds in the rendering code.
foreach (var line in entry.License.Split("\n"))
{
vBox.AddChild(new Label {Text = line, FontColorOverride = new Color(200, 200, 200)});
}
}
licensesList.AddChild(margin);
}
private void PopulatePatronsList(Control patronsList)
{
var margin = new MarginContainer {MarginLeftOverride = 2, MarginTopOverride = 2};
var vBox = new VBoxContainer();
margin.AddChild(vBox);
var patrons = ReadJson<PatronEntry[]>("/Credits/Patrons.json");
Button patronButton;
vBox.AddChild(patronButton = new Button
{
Text = "Become a Patron",
SizeFlagsHorizontal = SizeFlags.ShrinkCenter
});
var first = true;
foreach (var tier in patrons.GroupBy(p => p.Tier).OrderBy(p => PatronTierPriority[p.Key]))
{
if (!first)
{
vBox.AddChild(new Control {CustomMinimumSize = (0, 10)});
}
first = false;
vBox.AddChild(new Label {StyleClasses = {StyleBase.StyleClassLabelHeading}, Text = $"{tier.Key}"});
var msg = string.Join(", ", tier.OrderBy(p => p.Name).Select(p => p.Name));
var label = new RichTextLabel();
label.SetMessage(msg);
vBox.AddChild(label);
}
patronButton.OnPressed +=
_ => IoCManager.Resolve<IUriOpener>().OpenUri(UILinks.Patreon);
patronsList.AddChild(margin);
}
private void PopulateCredits(Control contributorsList)
{
Button contributeButton;
var margin = new MarginContainer
{
MarginLeftOverride = 2,
MarginTopOverride = 2
};
var vBox = new VBoxContainer();
margin.AddChild(vBox);
vBox.AddChild(new HBoxContainer
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SeparationOverride = 20,
Children =
{
new Label {Text = "Want to get on this list?"},
(contributeButton = new Button {Text = "Contribute!"})
}
});
var first = true;
void AddSection(string title, string path, bool markup = false)
{
if (!first)
{
vBox.AddChild(new Control {CustomMinimumSize = (0, 10)});
}
first = false;
vBox.AddChild(new Label {StyleClasses = {StyleBase.StyleClassLabelHeading}, Text = title});
var label = new RichTextLabel();
var text = _resourceManager.ContentFileReadAllText($"/Credits/{path}");
if (markup)
{
label.SetMessage(FormattedMessage.FromMarkup(text.Trim()));
}
else
{
label.SetMessage(text);
}
vBox.AddChild(label);
}
AddSection("Space Station 14 Contributors", "GitHub.txt");
AddSection("Space Station 13 Codebases", "SpaceStation13.txt");
AddSection("Original Space Station 13 Remake Team", "OriginalRemake.txt");
AddSection("Special Thanks", "SpecialThanks.txt", true);
contributorsList.AddChild(margin);
contributeButton.OnPressed += _ =>
IoCManager.Resolve<IUriOpener>().OpenUri(UILinks.GitHub);
}
private static IEnumerable<string> Lines(TextReader reader)
{
while (true)
{
var line = reader.ReadLine();
if (line == null)
{
yield break;
}
yield return line;
}
}
private T ReadJson<T>(string path)
{
var serializer = new JsonSerializer();
using var stream = _resourceManager.ContentFileRead(path);
using var streamReader = new StreamReader(stream);
using var jsonTextReader = new JsonTextReader(streamReader);
return serializer.Deserialize<T>(jsonTextReader)!;
}
[JsonObject(ItemRequired = Required.Always)]
private sealed class PatronEntry
{
public string Name { get; set; } = default!;
public string Tier { get; set; } = default!;
}
[JsonObject(ItemRequired = Required.Always)]
private sealed class OpenSourceLicense
{
public string Name { get; set; } = default!;
public string License { get; set; } = default!;
}
}
}

View File

@@ -18,6 +18,7 @@ namespace Content.Client.UserInterface
public Label StartTime { get; }
public Button ReadyButton { get; }
public Button ObserveButton { get; }
public Button CreditsButton { get; }
public Button LeaveButton { get; }
public ChatBox Chat { get; }
public ItemList OnlinePlayerItemList { get; }
@@ -85,6 +86,13 @@ namespace Content.Client.UserInterface
VAlign = Label.VAlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter
}),
(CreditsButton = new Button
{
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
Text = Loc.GetString("Credits"),
StyleClasses = {StyleNano.StyleClassButtonBig},
//GrowHorizontal = GrowDirection.Begin
}),
(LeaveButton = new Button
{
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,

View File

@@ -8,9 +8,6 @@ namespace Content.Client.UserInterface
{
public class ServerInfo : VBoxContainer
{
private const string DiscordUrl = "https://discordapp.com/invite/t2jac3p";
private const string WebsiteUrl = "https://spacestation14.io";
private readonly RichTextLabel _richTextLabel;
public ServerInfo()
@@ -27,10 +24,10 @@ namespace Content.Client.UserInterface
var uriOpener = IoCManager.Resolve<IUriOpener>();
var discordButton = new Button {Text = Loc.GetString("Join us on Discord!")};
discordButton.OnPressed += args => uriOpener.OpenUri(DiscordUrl);
discordButton.OnPressed += args => uriOpener.OpenUri(UILinks.Discord);
var websiteButton = new Button {Text = Loc.GetString("Website")};
websiteButton.OnPressed += args => uriOpener.OpenUri(WebsiteUrl);
websiteButton.OnPressed += args => uriOpener.OpenUri(UILinks.Website);
buttons.AddChild(discordButton);
buttons.AddChild(websiteButton);

View File

@@ -0,0 +1 @@
20kdc, 4dplanner, Acruid, actioninja, AJCM-git, ancientpower, as334, avghdev, BGare, BobdaBiscuit, boiled-water-tsar, Bright0, brndd, CakeQ, CatTheSystem, CC-4477, Centronias, chairbender, clusterfack, Clyybber, collinlunn, ComicIronic, Cyberboss, DamianX, Daracke, deathrat, Decappi, Dezandor, dylanstrategie, fizzle7, Fouin, gbasood, gituhabu, GlassEclipse, h3half, halworsen, harikattar, Hugal31, ike709, Injazz, InquisitivePenguin, JiimBob, johnku1, kalanosh, lzimann, Macoron, metalgearsloth, micheel665, Miniwoffer, Moneyl, N3X15, NickPowers43, nullarmo, Pangogie, partyaddict, patrikturi, PaulRitter, Pireax, PJB3005, ProfanedBane, PrPleGoo, psykzz, Quantomicus, Qustinnus, RednoWCirabrab, RemieRichards, remove32, renodubois, Rockdtben, Rohesie, rok-povsic, SamV522, ScumbagDog, Serkket, ShadowCommander, SignalWalker, Silvertorch5, Soundwavesghost, SpaceManiac, spoogemonster, SweptWasTaken, Szunti, tentekal, thatrandomcanadianguy, theOperand, tkdrg, Tomeno, Tyler-IN, unusualcrow, UristMcDorf, volundr-, wixoaGit, YotaXP, ZelteHonor, ZNixian, Zth--, Zumorica

View File

@@ -0,0 +1,2 @@
For creating and releasing the original remake, which this project is based on:
DrSingh, Edad, Hamshot (Ben Guilbert), Keelin, Nannek (a wanker), Nyxation (Tyler Merta), Ostaf, Supernorn (Adam Riches), Synchronic (Joseph Riches), Tan Teck Weng, Volundr

View File

@@ -0,0 +1 @@
[{"Name":"Acvisy","Tier":"Syndicate Agent"},{"Name":"Arian Jafari","Tier":"Nuclear Operative"},{"Name":"Await Future","Tier":"Syndicate Agent"},{"Name":"Calvin Balke","Tier":"Nuclear Operative"},{"Name":"Crocs Enthusiast .","Tier":"Revolutionary"},{"Name":"Daniel Thompson","Tier":"Revolutionary"},{"Name":"dean","Tier":"Nuclear Operative"},{"Name":"Kyle Hipke","Tier":"Nuclear Operative"},{"Name":"LeoZ","Tier":"Revolutionary"},{"Name":"MetalClone","Tier":"Nuclear Operative"},{"Name":"NetGlitch","Tier":"Syndicate Agent"},{"Name":"Ninja","Tier":"Syndicate Agent"},{"Name":"ThatGuyGW","Tier":"Nuclear Operative"},{"Name":"Tomeno","Tier":"Revolutionary"},{"Name":"Trevor McConnell","Tier":"Nuclear Operative"},{"Name":"Tyler Young","Tier":"Nuclear Operative"}]

View File

@@ -0,0 +1,2 @@
For creating and maintaining this awesome game: Goonstation, /tg/station, Baystation12, CEV-Eris, /vg/station, and countless others.
Many art assets taken from various SS13 codebases under the CC-BY-SA-3.0 license. Goonstation assets licensed under CC-BY-SA-NC-30.

View File

@@ -0,0 +1,3 @@
Exadv1 for creating Space Station 13.
All the uncountable people providing feedback and support throughout the community.
[color=white]You[/color], without whom there'd be no point to all this.

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env pwsh
# TODO: This is definitely gonna stop being accurate when we get above 100 contributors on one of the repos.
$engineJson = (Invoke-WebRequest "https://api.github.com/repos/space-wizards/RobustToolbox/contributors?per_page=100").Content | convertfrom-json
$contentJson = (Invoke-WebRequest "https://api.github.com/repos/space-wizards/space-station-14/contributors?per_page=100").Content | convertfrom-json
if ($engineJson.Count -ge 100)
{
Write-Warning "Engine is reporting 100 contributors. It might not be a complete list due to API pagination!"
}
if ($contentJson.Count -ge 100)
{
Write-Warning "Content is reporting 100 contributors. It might not be a complete list due to API pagination!"
}
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$bad = get-content $(join-path $scriptDir "ignored_github_contributors.txt")
($engineJson).login + ($contentJson).login | select -unique | where { $bad -notcontains $_ } | Sort-object | Join-String -Separator ", "

8
Tools/dump_patrons.ps1 Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env pwsh
param([string]$csvPath)
# Dumps Patreon's CSV download into a JSON file the game reads.
# Have to trim patron names because apparently Patreon doesn't which is quite ridiculous.
Get-content $csvPath | ConvertFrom-Csv -Delimiter "," | select @{l="Name";e={$_.Name.Trim()}},Tier | ConvertTo-Json -Compress

View File

@@ -0,0 +1,3 @@
ZDDM
TYoung86
PJBot