Skip to content
Draft
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
1 change: 1 addition & 0 deletions Content.Client/Input/ContentContexts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public static void SetupContexts(IInputContextContainer contexts)
ghost.AddFunction(EngineKeyFunctions.MoveRight);
ghost.AddFunction(EngineKeyFunctions.Walk);

common.AddFunction(ContentKeyFunctions.OpenConsentWindow); // DEN - Consent UI
common.AddFunction(ContentKeyFunctions.OpenEntitySpawnWindow);
common.AddFunction(ContentKeyFunctions.OpenSandboxWindow);
common.AddFunction(ContentKeyFunctions.OpenTileSpawnWindow);
Expand Down
2 changes: 2 additions & 0 deletions Content.Client/Lobby/UI/LobbyGui.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
<BoxContainer Orientation="Horizontal" MinSize="0 40" HorizontalAlignment="Right">
<Button Name="AHelpButton" Access="Public" Text="{Loc 'ui-lobby-ahelp-button'}"
StyleClasses="ButtonBig" />
<Button Name="ConsentButton" Access="Public" Text="{Loc 'ui-lobby-consent-button'}"
StyleClasses="ButtonBig" />
<vote:VoteCallMenuButton Name="CallVoteButton" StyleClasses="ButtonBig" />
<Button Name="OptionsButton" Access="Public" StyleClasses="ButtonBig"
Text="{Loc 'ui-lobby-options-button'}" />
Expand Down
1 change: 1 addition & 0 deletions Content.Client/Options/UI/Tabs/KeyRebindTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ void AddToggleCvarCheckBox(string checkBoxName, CVarDef<bool> cvar)
AddButton(ContentKeyFunctions.OpenActionsMenu);
AddButton(ContentKeyFunctions.OpenEmotesMenu);
AddButton(ContentKeyFunctions.ToggleRoundEndSummaryWindow);
AddButton(ContentKeyFunctions.OpenConsentWindow); // DEN - Consent UI
AddButton(ContentKeyFunctions.OpenEntitySpawnWindow);
AddButton(ContentKeyFunctions.OpenSandboxWindow);
AddButton(ContentKeyFunctions.OpenTileSpawnWindow);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@
HorizontalExpand="True"
AppendStyleClass="{x:Static style:StyleClass.ButtonOpenRight}"
/>
<!-- DEN Start: consent UI -->
<ui:MenuButton
Name="ConsentButton"
Access="Internal"
Icon = "{xe:Tex '/Textures/_DEN/Interface/VerbIcons/lewd.svg.64x64.png'}"
BoundKey = "{x:Static is:ContentKeyFunctions.OpenConsentWindow}"
ToolTip="{Loc 'game-hud-open-consent-window-button-tooltip'}"
MinSize="42 64"
HorizontalExpand="True"
AppendStyleClass="{x:Static style:StyleClass.ButtonSquare}"
/>
<!-- DEN End -->
<ui:MenuButton
Name="GuidebookButton"
Access="Internal"
Expand Down
23 changes: 23 additions & 0 deletions Content.Client/_DEN/Consent/Commands/ClientConsentCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Content.Client._DEN.Consent.UI;
using Content.Shared.Administration;
using Robust.Client.UserInterface;
using Robust.Shared.Console;

namespace Content.Client._DEN.Consent.Commands;

[AnyCommand]
public sealed partial class ConsentPrefsCommand : LocalizedCommands
{
[Dependency] private IUserInterfaceManager _ui = null!;

public override string Command => "consentprefs";

public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player == null)
return;

var consentUi = _ui.GetUIController<ConsentUIController>();
consentUi.ToggleWindow();
}
}
136 changes: 136 additions & 0 deletions Content.Client/_DEN/Consent/UI/ConsentUIController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
using Content.Client._DEN.Consent.EntitySystems;
using Content.Client.Gameplay;
using Content.Client.Lobby;
using Content.Client.Lobby.UI;
using Content.Client.UserInterface.Controls;
using Content.Client.UserInterface.Systems.MenuBar.Widgets;
using Content.Shared._DEN.Consent.Managers;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Client.Input;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input.Binding;

namespace Content.Client._DEN.Consent.UI;

[UsedImplicitly]
public sealed partial class ConsentUIController : UIController, IOnSystemChanged<ConsentSystem>, IOnStateChanged<GameplayState>, IOnStateChanged<LobbyState>
{
[Dependency] private IConsentManager _consentManager = null!;
[Dependency] private IInputManager _input = null!;

public bool EverOpened = false;

private ConsentWindow? _window;
private ConsentSystem? _consentSystem;

private MenuButton? GameConsentButton => UIManager.GetActiveUIWidgetOrNull<GameTopMenuBar>()?.ConsentButton;
private Button? LobbyConsentButton => (UIManager.ActiveScreen as LobbyGui)?.ConsentButton;

public void OpenWindow()
{
if (_window == null)
{
_window = new ConsentWindow();
_window.OnOpen += OnOpen;
_window.OnClose += OnClose;
}

if (EverOpened)
_window.Open();
else
_window.OpenCentered();
}

public void CloseWindow()
{
if (_window is null)
return;

_window.OnOpen -= OnOpen;
_window.OnClose -= OnClose;

_window.Close();
}

public void ToggleWindow()
{
if (_window is null or { IsOpen: false })
{
OpenWindow();
return;
}

CloseWindow();
}

private void SetConsentButtonPressed(bool pressed)
{
GameConsentButton?.Pressed = pressed;
LobbyConsentButton?.Pressed = pressed;
}

private void ConsentButtonPressed(BaseButton.ButtonEventArgs args)
{
ToggleWindow();
}

private void OnOpen()
{
EverOpened = true;
SetConsentButtonPressed(true);
}

private void OnClose()
{
SetConsentButtonPressed(false);
}

public void OnStateEntered(GameplayState state)
{
if (GameConsentButton is null)
return;

GameConsentButton.OnPressed += ConsentButtonPressed;
GameConsentButton.Pressed = _window?.IsOpen ?? false;
}

public void OnStateExited(GameplayState state)
{
if (GameConsentButton is null)
return;

GameConsentButton.OnPressed -= ConsentButtonPressed;
}

public void OnStateEntered(LobbyState state)
{
if (LobbyConsentButton is null)
return;

LobbyConsentButton.OnPressed += ConsentButtonPressed;
LobbyConsentButton.Pressed = _window?.IsOpen ?? false;
}

public void OnStateExited(LobbyState state)
{
if (LobbyConsentButton is null)
return;

LobbyConsentButton.OnPressed -= ConsentButtonPressed;
}

public void OnSystemLoaded(ConsentSystem system)
{
_consentSystem = system;
_input.SetInputCommand(ContentKeyFunctions.OpenConsentWindow,
InputCmdHandler.FromDelegate(_ => ToggleWindow()));
}

public void OnSystemUnloaded(ConsentSystem system)
{
_consentSystem = null;
_input.SetInputCommand(ContentKeyFunctions.OpenConsentWindow, null);
}
}
4 changes: 4 additions & 0 deletions Content.Client/_DEN/Consent/UI/ConsentWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls">

</controls:FancyWindow>
18 changes: 18 additions & 0 deletions Content.Client/_DEN/Consent/UI/ConsentWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.Player;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;

namespace Content.Client._DEN.Consent.UI;

[GenerateTypedNameReferences]
public sealed partial class ConsentWindow : FancyWindow
{
[Dependency] private IPlayerManager _player = default!;

public ConsentWindow()
{
RobustXamlLoader.Load(this);
}
}
1 change: 1 addition & 0 deletions Content.Shared/Input/ContentKeyFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static class ContentKeyFunctions
public static readonly BoundKeyFunction RotateObjectCounterclockwise = "RotateObjectCounterclockwise";
public static readonly BoundKeyFunction FlipObject = "FlipObject";
public static readonly BoundKeyFunction ToggleRoundEndSummaryWindow = "ToggleRoundEndSummaryWindow";
public static readonly BoundKeyFunction OpenConsentWindow = "OpenConsentWindow"; // DEN: Consent UI
public static readonly BoundKeyFunction OpenEntitySpawnWindow = "OpenEntitySpawnWindow";
public static readonly BoundKeyFunction OpenSandboxWindow = "OpenSandboxWindow";
public static readonly BoundKeyFunction OpenTileSpawnWindow = "OpenTileSpawnWindow";
Expand Down
5 changes: 4 additions & 1 deletion Resources/Locale/en-US/_DEN/commands/consent.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ cmd-consent-desc = Gets any consents that are different to the default value on
cmd-consent-help = {$command}

cmd-consent-no-different = No different consents; all consents are using their defaults.
cmd-consent-differences = Different consents:\n- {$differentConsents}
cmd-consent-differences = Different consents:\n- {$differentConsents}

cmd-consentprefs-desc = Toggles the consent preferences UI.
cmd-consentprefs-help = {$command}
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_DEN/hud/game-hud.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
game-hud-open-consent-window-button-tooltip = Consent Menu
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_DEN/lobby/lobby-gui.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ui-lobby-consent-button = Consent
3 changes: 3 additions & 0 deletions Resources/Textures/_DEN/Interface/VerbIcons/ATTRIBUTION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
All icons are public domain.

lewd.svg by portfiend (GitHub)
65 changes: 65 additions & 0 deletions Resources/Textures/_DEN/Interface/VerbIcons/lewd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sample:
filter: true
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sample:
filter: true
Loading