Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitelist window #8

Merged
merged 2 commits into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Content.Client/FurryServers/FurryServersWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<ui:FurryServersWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.FurryServers"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="Other Furry Servers..."
MinSize="500 300"
SetSize="500 450">
<ScrollContainer HScrollEnabled="False" Margin="4" VerticalExpand="True" ReturnMeasure="True">
<BoxContainer Orientation="Vertical">
<Label Margin="8 0 0 0" StyleClasses="FurryServersSectionHeader" Align="Center"
Text="BlepStation (LRP)" Name="BlepstationHeader" />
<RichTextLabel Margin="8 8 8 8" Name="BlepstationDescription" />

<Button Name="BlepstationWebsite" Text="Launch Website: BlepStation.com" />
</BoxContainer>
</ScrollContainer>
</ui:FurryServersWindow>
59 changes: 59 additions & 0 deletions Content.Client/FurryServers/FurryServersWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System.Linq;
using Content.Client.Administration.Managers;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Console;
using Robust.Client.ResourceManagement;
using Robust.Shared.Utility;

namespace Content.Client.FurryServers
{
[GenerateTypedNameReferences]
public sealed partial class FurryServersWindow : FancyWindow
{
[Dependency] private readonly IResourceCache _resourceManager = default!;
[Dependency] private readonly IUriOpener _uri = default!;

public FurryServersWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
Stylesheet = IoCManager.Resolve<IStylesheetManager>().SheetSpace;

BlepstationHeader.AddStyleClass(StyleBase.StyleClassLabelHeading);
BlepstationHeader.FontColorOverride = Color.FromHex("#7687f2");

var description = FormattedMessage.FromMarkup(_resourceManager.ContentFileReadAllText($"/FurryServers/Blepstation.txt"));
BlepstationDescription.SetMessage(description);

BlepstationWebsite.OnPressed += _ =>
{
_uri.OpenUri("https://blepstation.com");
};
}

protected override void Opened()
{
base.Opened();
}
}

[UsedImplicitly, AnyCommand]
public sealed class FurryServersCommand : IConsoleCommand
{
public string Command => "furry";
public string Description => "Shows list of furry space station 14 servers";
public string Help => "Usage: furry";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<FurryServersUIController>().OpenWindow();
}
}
}
4 changes: 4 additions & 0 deletions Content.Client/Info/LinkBanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public LinkBanner()
};
buttons.AddChild(guidebookButton);

var furryServersButton = new Button() { Text = "More Furry Servers" };
furryServersButton.OnPressed += args => UserInterfaceManager.GetUIController<FurryServersUIController>().ToggleWindow();
buttons.AddChild(furryServersButton);

var changelogButton = new ChangelogButton();
changelogButton.OnPressed += args => UserInterfaceManager.GetUIController<ChangelogUIController>().ToggleWindow();
buttons.AddChild(changelogButton);
Expand Down
14 changes: 13 additions & 1 deletion Content.Client/MainMenu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Robust.Shared.Network;
using Robust.Shared.Utility;
using UsernameHelpers = Robust.Shared.AuthLib.UsernameHelpers;
using Content.Client.UserInterface.Systems.WhitelistWindow;

namespace Content.Client.MainMenu
{
Expand Down Expand Up @@ -176,7 +177,18 @@ private void ParseAddress(string address, out string ip, out ushort port)

private void _onConnectFailed(object? _, NetConnectFailArgs args)
{
_userInterfaceManager.Popup(Loc.GetString("main-menu-failed-to-connect",("reason", args.Reason)));
// This assumes whitelist related disconnect will contain the text 'whitelist' which is probably a fair
// assumption. More ideally, disconnect reasons would send across an enum or something, but that looks to
// be in engine code, perhaps.
if (args.Reason.ToUpper().Contains("WHITELIST"))
{
// Whitelist specialized popup that shows application link for the whitelist
_userInterfaceManager.GetUIController<WhitelistDenialUIController>().OpenWindow(args.Reason);
} else {
// Generic popup
_userInterfaceManager.Popup(Loc.GetString("main-menu-failed-to-connect",("reason", args.Reason)));
}

_netManager.ConnectFailed -= _onConnectFailed;
_setConnectingState(false);
}
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/EscapeMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<Button Access="Public" Name="RulesButton" Text="{Loc 'ui-escape-rules'}" />
<Button Access="Public" Name="GuidebookButton" Text="{Loc 'ui-escape-guidebook'}" />
<Button Access="Public" Name="WikiButton" Text="{Loc 'ui-escape-wiki'}" />
<Button Access="Public" Name="FurryServersButton" Text="More Furry Servers" />
<Button Access="Public" Name="DisconnectButton" Text="{Loc 'ui-escape-disconnect'}" />
<Button Access="Public" Name="QuitButton" Text="{Loc 'ui-escape-quit'}" />
</BoxContainer>
Expand Down
5 changes: 5 additions & 0 deletions Content.Client/Stylesheets/StyleNano.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,11 @@ public StyleNano(IResourceCache resCache) : base(resCache)
.Prop(Label.StylePropertyFont, notoSans10),
// ---

// Furry Servers - Very Large Label for section headers
Element<Label>().Class("FurryServersSectionHeader")
.Prop(Label.StylePropertyFont, notoSansBold20),
// ---

// Different Background shapes ---
Element<PanelContainer>().Class(ClassAngleRect)
.Prop(PanelContainer.StylePropertyPanel, BaseAngleRect)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
[Dependency] private readonly InfoUIController _info = default!;
[Dependency] private readonly OptionsUIController _options = default!;
[Dependency] private readonly GuidebookUIController _guidebook = default!;
[Dependency] private readonly FurryServersUIController _furryServers = default!;

private Options.UI.EscapeMenu? _escapeWindow;

Expand Down Expand Up @@ -98,6 +99,12 @@ public void OnStateEntered(GameplayState state)
_uri.OpenUri(_cfg.GetCVar(CCVars.InfoLinksWiki));
};

_escapeWindow.FurryServersButton.OnPressed += _ =>
{
CloseEscapeWindow();
_furryServers.ToggleWindow();
};

_escapeWindow.GuidebookButton.OnPressed += _ =>
{
_guidebook.ToggleGuidebook();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Content.Client.FurryServers;
using JetBrains.Annotations;
using Robust.Client.State;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.ResourceManagement;

namespace Content.Client.UserInterface.Systems.EscapeMenu;

[UsedImplicitly]
public sealed class FurryServersUIController : UIController
{
private FurryServersWindow _furryServersWindow = default!;

public void OpenWindow()
{
EnsureWindow();

_furryServersWindow.OpenCentered();
_furryServersWindow.MoveToFront();
}

private void EnsureWindow()
{
if (_furryServersWindow is { Disposed: false })
return;

_furryServersWindow = UIManager.CreateWindow<FurryServersWindow>();
}

public void ToggleWindow()
{
EnsureWindow();

if (_furryServersWindow.IsOpen)
{
_furryServersWindow.Close();
}
else
{
OpenWindow();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ui:WhitelistDenialWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Systems.WhitelistWindow.Controls"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="Whitelist Required"
MinSize="400 170"
SetSize="400 230">
<ScrollContainer HScrollEnabled="False" Margin="4" VerticalExpand="True" ReturnMeasure="True">
<BoxContainer Orientation="Vertical">
<RichTextLabel Margin="8 0 0 0" Name="DenialReason" />
<Button Margin="8 10 0 0" Name="WhitelistApplyButton" Text="Apply for whitelist" />
<PanelContainer Margin="8 10 0 0" StyleClasses="LowDivider" />
<Button Margin="8 20 0 0" Name="FurryServersButton" Text="Or check out other Furry SS14 Servers" />
</BoxContainer>
</ScrollContainer>
</ui:WhitelistDenialWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using System.Linq;
using Content.Client.Administration.Managers;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Console;
using Robust.Client.ResourceManagement;
using Robust.Shared.Utility;
using Content.Client.UserInterface.Systems.EscapeMenu;

namespace Content.Client.UserInterface.Systems.WhitelistWindow.Controls
{
[GenerateTypedNameReferences]
public sealed partial class WhitelistDenialWindow : FancyWindow
{
[Dependency] private readonly IResourceCache _resourceManager = default!;
[Dependency] private readonly IUriOpener _uri = default!;

public WhitelistDenialWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
Stylesheet = IoCManager.Resolve<IStylesheetManager>().SheetSpace;

WhitelistApplyButton.OnPressed += _ =>
{
_uri.OpenUri("https://discord.gg/ZZYNpq5KBJ"); // Floof discord link
};

FurryServersButton.OnPressed += _ =>
{
UserInterfaceManager.GetUIController<FurryServersUIController>().ToggleWindow();
};
}


protected override void Opened()
{
base.Opened();
}

public void SetDenialMessage(string denial)
{
DenialReason.SetMessage(denial);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Content.Client.Options.UI;
using JetBrains.Annotations;
using Robust.Client.UserInterface.Controllers;
using Robust.Shared.Console;
using Content.Client.UserInterface.Systems.WhitelistWindow.Controls;

namespace Content.Client.UserInterface.Systems.WhitelistWindow;

[UsedImplicitly]
public sealed class WhitelistDenialUIController : UIController
{
public override void Initialize()
{
}
private WhitelistDenialWindow _whitelistDenialWindow = default!;

private void EnsureWindow()
{
if (_whitelistDenialWindow is { Disposed: false })
return;

_whitelistDenialWindow = UIManager.CreateWindow<WhitelistDenialWindow>();
}

public void OpenWindow(string denialMessage)
{
EnsureWindow();

_whitelistDenialWindow.SetDenialMessage(denialMessage);

_whitelistDenialWindow.OpenCentered();
_whitelistDenialWindow.MoveToFront();
}
}
10 changes: 10 additions & 0 deletions Resources/FurryServers/Blepstation.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Looking for faster paced rounds that are more focused on gameplay? Check out our friends at [italic]BlepStation[/italic], a furry server with unique content and features. (Adults/18+ Only)

• Furry kinks & species.
• Shorter, [bold]gameplay-focused[/bold] rounds.
• Low role timer requirements.
• [bold]LRP[/bold] -- Simple rules, less serious vibe.
• Based on vanilla upstream (but also brings back popular removed mechanics like cloning, vehicles, list inventory, etc).
• No whitelist requirement.

Check out the website for more information! We hope to play with you soon :)
Loading