]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add admin remarks button to lobby (#31761)
authordffdff2423 <dffdff2423@gmail.com>
Sat, 16 Nov 2024 05:09:29 +0000 (00:09 -0500)
committerGitHub <noreply@github.com>
Sat, 16 Nov 2024 05:09:29 +0000 (23:09 -0600)
Content.Client/Lobby/LobbyUIController.cs
Content.Client/Lobby/UI/CharacterSetupGui.xaml
Content.Client/Lobby/UI/CharacterSetupGui.xaml.cs
Content.Client/Lobby/UI/LobbyGui.xaml.cs
Resources/Locale/en-US/lobby/lobby-gui.ftl
Resources/Locale/en-US/preferences/ui/character-setup-gui.ftl

index 3cf98c98aba590f1131e96c38d4cb6b190f38d98..50a25519988616aaa9a6d57106dda6a580a81ff4 100644 (file)
@@ -279,7 +279,7 @@ public sealed class LobbyUIController : UIController, IOnStateEntered<LobbyState
 
         _profileEditor.OnOpenGuidebook += _guide.OpenHelp;
 
-        _characterSetup = new CharacterSetupGui(EntityManager, _prototypeManager, _resourceCache, _preferencesManager, _profileEditor);
+        _characterSetup = new CharacterSetupGui(_profileEditor);
 
         _characterSetup.CloseButton.OnPressed += _ =>
         {
index f83be2658842c2c9d8871887389d4ed880ac2339..c463987a1feb0edf45dbfaec4dac166ca117c062 100644 (file)
@@ -2,6 +2,7 @@
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
          xmlns:style="clr-namespace:Content.Client.Stylesheets"
+         xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls"
          VerticalExpand="True">
     <Control>
         <PanelContainer Name="BackgroundPanel" />
                 <Label Text="{Loc 'character-setup-gui-character-setup-label'}"
                        Margin="8 0 0 0" VAlign="Center"
                        StyleClasses="LabelHeadingBigger" />
+
                 <Button Name="StatsButton" HorizontalExpand="True"
                         Text="{Loc 'character-setup-gui-character-setup-stats-button'}"
                         StyleClasses="ButtonBig"
                         HorizontalAlignment="Right" />
+                <cc:CommandButton Name="AdminRemarksButton"
+                                  Command="adminremarks"
+                                  Text="{Loc 'character-setup-gui-character-setup-adminremarks-button'}"
+                                  StyleClasses="ButtonBig" />
                 <Button Name="RulesButton"
                         Text="{Loc 'character-setup-gui-character-setup-rules-button'}"
                         StyleClasses="ButtonBig"/>
index 777725b9eda3ddd458e45350a2ea6a49e0090666..457991613249e20d0bb91d59788a12c7dc2db82e 100644 (file)
@@ -1,6 +1,7 @@
 using Content.Client.Info;
 using Content.Client.Info.PlaytimeStats;
 using Content.Client.Resources;
+using Content.Shared.CCVar;
 using Content.Shared.Preferences;
 using Robust.Client.AutoGenerated;
 using Robust.Client.Graphics;
@@ -8,6 +9,7 @@ using Robust.Client.ResourceManagement;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Configuration;
 using Robust.Shared.Prototypes;
 
 namespace Content.Client.Lobby.UI
@@ -18,28 +20,23 @@ namespace Content.Client.Lobby.UI
     [GenerateTypedNameReferences]
     public sealed partial class CharacterSetupGui : Control
     {
-        private readonly IClientPreferencesManager _preferencesManager;
-        private readonly IEntityManager _entManager;
-        private readonly IPrototypeManager _protomanager;
+        [Dependency] private readonly IClientPreferencesManager _preferencesManager = default!;
+        [Dependency] private readonly IEntityManager _entManager = default!;
+        [Dependency] private readonly IPrototypeManager _protomanager = default!;
+        [Dependency] private readonly IResourceCache _resourceCache = default!;
+        [Dependency] private readonly IConfigurationManager _cfg = default!;
 
         private readonly Button _createNewCharacterButton;
 
         public event Action<int>? SelectCharacter;
         public event Action<int>? DeleteCharacter;
 
-        public CharacterSetupGui(
-            IEntityManager entManager,
-            IPrototypeManager protoManager,
-            IResourceCache resourceCache,
-            IClientPreferencesManager preferencesManager,
-            HumanoidProfileEditor profileEditor)
+        public CharacterSetupGui(HumanoidProfileEditor profileEditor)
         {
             RobustXamlLoader.Load(this);
-            _preferencesManager = preferencesManager;
-            _entManager = entManager;
-            _protomanager = protoManager;
+            IoCManager.InjectDependencies(this);
 
-            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
             {
                 Texture = panelTex,
@@ -56,7 +53,7 @@ namespace Content.Client.Lobby.UI
 
             _createNewCharacterButton.OnPressed += args =>
             {
-                preferencesManager.CreateCharacter(HumanoidCharacterProfile.Random());
+                _preferencesManager.CreateCharacter(HumanoidCharacterProfile.Random());
                 ReloadCharacterPickers();
                 args.Event.Handle();
             };
@@ -65,6 +62,8 @@ namespace Content.Client.Lobby.UI
             RulesButton.OnPressed += _ => new RulesAndInfoWindow().Open();
 
             StatsButton.OnPressed += _ => new PlaytimeStatsWindow().OpenCentered();
+
+            _cfg.OnValueChanged(CCVars.SeeOwnNotes, p => AdminRemarksButton.Visible = p, true);
         }
 
         /// <summary>
index 81230130a1dc46f09d3be67cfe3b6bc199aa970d..6471edb6f3792cdade8a20a29084bd3d0b0d5961 100644 (file)
@@ -2,7 +2,6 @@ using Content.Client.Message;
 using Content.Client.UserInterface.Systems.EscapeMenu;
 using Robust.Client.AutoGenerated;
 using Robust.Client.Console;
-using Robust.Client.State;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.XAML;
 
index 6407104163f0905d32c1893ba15cd02981317f39..e7f131e93b020031a38fdef7a74bb5c6ad1b63be 100644 (file)
@@ -1,4 +1,4 @@
-ui-lobby-title = Lobby
+ui-lobby-title = Lobby
 ui-lobby-ahelp-button = AHelp
 ui-lobby-options-button = Options
 ui-lobby-leave-button = Leave
index 325d7cb538dbcd033ca071f17b3fb6aa33806c14..5ca4673f6b1c416121fd7ef43dc9a5ae581ad50f 100644 (file)
@@ -1,4 +1,5 @@
 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-rules-button = Rules
 character-setup-gui-character-setup-close-button = Close
@@ -10,4 +11,4 @@ character-setup-gui-character-picker-button-confirm-delete-button = Confirm
 character-setup-gui-save-panel-title = Unsaved character changes
 character-setup-gui-save-panel-save = Save
 character-setup-gui-save-panel-nosave = Don't save
-character-setup-gui-save-panel-cancel = Cancel
\ No newline at end of file
+character-setup-gui-save-panel-cancel = Cancel