Add admin remarks button to lobby (#31761)

This commit is contained in:
dffdff2423
2024-11-16 00:09:29 -05:00
committed by GitHub
parent 7077b930f2
commit 2c82a2dfc0
6 changed files with 23 additions and 18 deletions

View File

@@ -279,7 +279,7 @@ public sealed class LobbyUIController : UIController, IOnStateEntered<LobbyState
_profileEditor.OnOpenGuidebook += _guide.OpenHelp; _profileEditor.OnOpenGuidebook += _guide.OpenHelp;
_characterSetup = new CharacterSetupGui(EntityManager, _prototypeManager, _resourceCache, _preferencesManager, _profileEditor); _characterSetup = new CharacterSetupGui(_profileEditor);
_characterSetup.CloseButton.OnPressed += _ => _characterSetup.CloseButton.OnPressed += _ =>
{ {

View File

@@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:style="clr-namespace:Content.Client.Stylesheets" xmlns:style="clr-namespace:Content.Client.Stylesheets"
xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
VerticalExpand="True"> VerticalExpand="True">
<Control> <Control>
<PanelContainer Name="BackgroundPanel" /> <PanelContainer Name="BackgroundPanel" />
@@ -10,10 +11,15 @@
<Label Text="{Loc 'character-setup-gui-character-setup-label'}" <Label Text="{Loc 'character-setup-gui-character-setup-label'}"
Margin="8 0 0 0" VAlign="Center" Margin="8 0 0 0" VAlign="Center"
StyleClasses="LabelHeadingBigger" /> StyleClasses="LabelHeadingBigger" />
<Button Name="StatsButton" HorizontalExpand="True" <Button Name="StatsButton" HorizontalExpand="True"
Text="{Loc 'character-setup-gui-character-setup-stats-button'}" Text="{Loc 'character-setup-gui-character-setup-stats-button'}"
StyleClasses="ButtonBig" StyleClasses="ButtonBig"
HorizontalAlignment="Right" /> HorizontalAlignment="Right" />
<cc:CommandButton Name="AdminRemarksButton"
Command="adminremarks"
Text="{Loc 'character-setup-gui-character-setup-adminremarks-button'}"
StyleClasses="ButtonBig" />
<Button Name="RulesButton" <Button Name="RulesButton"
Text="{Loc 'character-setup-gui-character-setup-rules-button'}" Text="{Loc 'character-setup-gui-character-setup-rules-button'}"
StyleClasses="ButtonBig"/> StyleClasses="ButtonBig"/>

View File

@@ -1,6 +1,7 @@
using Content.Client.Info; using Content.Client.Info;
using Content.Client.Info.PlaytimeStats; using Content.Client.Info.PlaytimeStats;
using Content.Client.Resources; using Content.Client.Resources;
using Content.Shared.CCVar;
using Content.Shared.Preferences; using Content.Shared.Preferences;
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.Graphics; using Robust.Client.Graphics;
@@ -8,6 +9,7 @@ using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
namespace Content.Client.Lobby.UI namespace Content.Client.Lobby.UI
@@ -18,28 +20,23 @@ namespace Content.Client.Lobby.UI
[GenerateTypedNameReferences] [GenerateTypedNameReferences]
public sealed partial class CharacterSetupGui : Control public sealed partial class CharacterSetupGui : Control
{ {
private readonly IClientPreferencesManager _preferencesManager; [Dependency] private readonly IClientPreferencesManager _preferencesManager = default!;
private readonly IEntityManager _entManager; [Dependency] private readonly IEntityManager _entManager = default!;
private readonly IPrototypeManager _protomanager; [Dependency] private readonly IPrototypeManager _protomanager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
private readonly Button _createNewCharacterButton; private readonly Button _createNewCharacterButton;
public event Action<int>? SelectCharacter; public event Action<int>? SelectCharacter;
public event Action<int>? DeleteCharacter; public event Action<int>? DeleteCharacter;
public CharacterSetupGui( public CharacterSetupGui(HumanoidProfileEditor profileEditor)
IEntityManager entManager,
IPrototypeManager protoManager,
IResourceCache resourceCache,
IClientPreferencesManager preferencesManager,
HumanoidProfileEditor profileEditor)
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
_preferencesManager = preferencesManager; IoCManager.InjectDependencies(this);
_entManager = entManager;
_protomanager = protoManager;
var panelTex = resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png"); var panelTex = _resourceCache.GetTexture("/Textures/Interface/Nano/button.svg.96dpi.png");
var back = new StyleBoxTexture var back = new StyleBoxTexture
{ {
Texture = panelTex, Texture = panelTex,
@@ -56,7 +53,7 @@ namespace Content.Client.Lobby.UI
_createNewCharacterButton.OnPressed += args => _createNewCharacterButton.OnPressed += args =>
{ {
preferencesManager.CreateCharacter(HumanoidCharacterProfile.Random()); _preferencesManager.CreateCharacter(HumanoidCharacterProfile.Random());
ReloadCharacterPickers(); ReloadCharacterPickers();
args.Event.Handle(); args.Event.Handle();
}; };
@@ -65,6 +62,8 @@ namespace Content.Client.Lobby.UI
RulesButton.OnPressed += _ => new RulesAndInfoWindow().Open(); RulesButton.OnPressed += _ => new RulesAndInfoWindow().Open();
StatsButton.OnPressed += _ => new PlaytimeStatsWindow().OpenCentered(); StatsButton.OnPressed += _ => new PlaytimeStatsWindow().OpenCentered();
_cfg.OnValueChanged(CCVars.SeeOwnNotes, p => AdminRemarksButton.Visible = p, true);
} }
/// <summary> /// <summary>

View File

@@ -2,7 +2,6 @@ using Content.Client.Message;
using Content.Client.UserInterface.Systems.EscapeMenu; using Content.Client.UserInterface.Systems.EscapeMenu;
using Robust.Client.AutoGenerated; using Robust.Client.AutoGenerated;
using Robust.Client.Console; using Robust.Client.Console;
using Robust.Client.State;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;

View File

@@ -1,4 +1,4 @@
ui-lobby-title = Lobby ui-lobby-title = Lobby
ui-lobby-ahelp-button = AHelp ui-lobby-ahelp-button = AHelp
ui-lobby-options-button = Options ui-lobby-options-button = Options
ui-lobby-leave-button = Leave ui-lobby-leave-button = Leave

View File

@@ -1,4 +1,5 @@
character-setup-gui-character-setup-label = Character setup character-setup-gui-character-setup-label = Character setup
character-setup-gui-character-setup-adminremarks-button = Admin Remarks
character-setup-gui-character-setup-stats-button = Stats character-setup-gui-character-setup-stats-button = Stats
character-setup-gui-character-setup-rules-button = Rules character-setup-gui-character-setup-rules-button = Rules
character-setup-gui-character-setup-close-button = Close character-setup-gui-character-setup-close-button = Close