1- using System . Linq ;
2- using Content . Client . _Starlight . Managers ;
31using Content . Client . _Starlight . MHelp ;
42using Content . Client . Administration . Managers ;
5- using Content . Client . Administration . Systems ;
6- using Content . Client . Gameplay ;
7- using Content . Client . Lobby ;
8- using Content . Client . Lobby . UI ;
9- using Content . Client . Stylesheets ;
10- using Content . Client . UserInterface . Controls ;
11- using Content . Client . UserInterface . Systems . MenuBar . Widgets ;
123using Content . Shared . Starlight . MHelp ;
134using Content . Shared . Starlight . CCVar ;
145using Content . Shared . Administration ;
15- using Content . Shared . CCVar ;
166using Content . Shared . Input ;
177using JetBrains . Annotations ;
188using Robust . Client . Audio ;
199using Robust . Client . Graphics ;
2010using Robust . Client . Player ;
2111using Robust . Client . UserInterface ;
2212using Robust . Client . UserInterface . Controllers ;
23- using Robust . Client . UserInterface . Controls ;
2413using Robust . Shared . Configuration ;
2514using Robust . Shared . Input . Binding ;
2615using Robust . Shared . Network ;
2716using Robust . Shared . Player ;
2817using Robust . Shared . Utility ;
2918using Content . Shared . _NullLink ;
19+ using Content . Client . Stylesheets ;
3020
3121namespace Content . Client . UserInterface . Systems . Bwoink ;
3222
3323[ UsedImplicitly ]
34- public sealed class MHelpUIController : UIController , IOnSystemChanged < MentorSystem > , IOnStateChanged < GameplayState > , IOnStateChanged < LobbyState >
24+ public sealed class MHelpUIController : UIController , IOnSystemChanged < MentorSystem >
3525{
3626 [ Dependency ] private readonly INullLinkPlayerRolesManager _playerRoles = default ! ;
3727 [ Dependency ] private readonly ISharedNullLinkPlayerRolesReqManager _playerRolesReq = default ! ;
3828 [ Dependency ] private readonly IClientAdminManager _adminManager = default ! ;
3929 [ Dependency ] private readonly IConfigurationManager _config = default ! ;
4030 [ Dependency ] private readonly IPlayerManager _playerManager = default ! ;
4131 [ Dependency ] private readonly IClyde _clyde = default ! ;
42- [ Dependency ] private readonly IUserInterfaceManager _uiManager = default ! ;
32+ [ Dependency ] private readonly StaffHelpUIController _staffhelp = default ! ;
33+ [ Dependency ] private readonly AHelpUIController _aHelp = default ! ;
4334 [ UISystemDependency ] private readonly AudioSystem _audio = default ! ;
4435
4536 private MentorSystem ? _mentorSystem ;
46- private Controls . MenuButton ? GameMHelpButton => UIManager . GetActiveUIWidgetOrNull < GameTopMenuBar > ( ) ? . MHelpButton ;
47- private Button ? LobbyMHelpButton => ( UIManager . ActiveScreen as LobbyGui ) ? . MHelpButton ;
48-
4937 public IMHelpUIHandler ? UIHelper ;
50- private bool _hasUnreadMHelp ;
38+ public bool _hasUnreadMHelp ;
5139 private string ? _mHelpSound ;
5240
5341 public override void Initialize ( )
@@ -59,23 +47,6 @@ public override void Initialize()
5947 _playerRoles . PlayerRolesChanged += OnPlayerStatusUpdated ;
6048 _config . OnValueChanged ( StarlightCCVars . MHelpSound , v => _mHelpSound = v , true ) ;
6149 }
62- public void UnloadButton ( )
63- {
64- if ( GameMHelpButton != null )
65- GameMHelpButton . OnPressed -= MHelpButtonPressed ;
66-
67- if ( LobbyMHelpButton != null )
68- LobbyMHelpButton . OnPressed -= MHelpButtonPressed ;
69- }
70-
71- public void LoadButton ( )
72- {
73- if ( GameMHelpButton != null )
74- GameMHelpButton . OnPressed += MHelpButtonPressed ;
75-
76- if ( LobbyMHelpButton != null )
77- LobbyMHelpButton . OnPressed += MHelpButtonPressed ;
78- }
7950
8051 private void OnPlayerStatusUpdated ( )
8152 {
@@ -84,21 +55,10 @@ private void OnPlayerStatusUpdated()
8455 EnsureUIHelper ( ) ;
8556 }
8657
87- private void MHelpButtonPressed ( BaseButton . ButtonEventArgs obj )
88- {
89- EnsureUIHelper ( ) ;
90- UIHelper ! . ToggleWindow ( ) ;
91- }
92-
9358 public void OnSystemLoaded ( MentorSystem system )
9459 {
9560 _mentorSystem = system ;
9661 _mentorSystem . OnMentoringTextMessageReceived += ReceivedMentoring ;
97-
98- CommandBinds . Builder
99- . Bind ( ContentKeyFunctions . OpenMHelp ,
100- InputCmdHandler . FromDelegate ( _ => ToggleWindow ( ) ) )
101- . Register < MHelpUIController > ( ) ;
10262 }
10363
10464 public void OnSystemUnloaded ( MentorSystem system )
@@ -110,22 +70,6 @@ public void OnSystemUnloaded(MentorSystem system)
11070 _mentorSystem = null ;
11171 }
11272
113- private void SetMHelpPressed ( bool pressed )
114- {
115- if ( GameMHelpButton != null )
116- {
117- GameMHelpButton . Pressed = pressed ;
118- }
119-
120- if ( LobbyMHelpButton != null )
121- {
122- LobbyMHelpButton . Pressed = pressed ;
123- }
124-
125- UIManager . ClickSound ( ) ;
126- UnreadMHelpRead ( ) ;
127- }
128-
12973 private void ReceivedMentoring ( object ? sender , SharedMentorSystem . MHelpTextMessage message )
13074 {
13175 var localPlayer = _playerManager . LocalSession ;
@@ -170,9 +114,6 @@ public void EnsureUIHelper()
170114 UIHelper . OnInputTextChanged += ( ticket , text ) => _mentorSystem ? . SendInputTextUpdated ( ticket , text . Length > 0 ) ;
171115 UIHelper . OnTicketClosed += ticket => _mentorSystem ? . SendCloseTicket ( ticket ) ;
172116 UIHelper . OnTptoPressed += ticket => _mentorSystem ? . SentTpto ( ticket ) ;
173- UIHelper . OnClose += ( ) => SetMHelpPressed ( false ) ;
174- UIHelper . OnOpen += ( ) => SetMHelpPressed ( true ) ;
175- SetMHelpPressed ( UIHelper . IsOpen ) ;
176117 }
177118
178119 public void Open ( )
@@ -202,65 +143,7 @@ public void ToggleWindow()
202143
203144 private void UnreadMHelpReceived ( )
204145 {
205- GameMHelpButton ? . StyleClasses . Add ( StyleClass . Negative ) ;
206- LobbyMHelpButton ? . StyleClasses . Add ( StyleClass . Negative ) ;
207146 _hasUnreadMHelp = true ;
208- }
209-
210- private void UnreadMHelpRead ( )
211- {
212- GameMHelpButton ? . StyleClasses . Remove ( StyleClass . Negative ) ;
213- LobbyMHelpButton ? . StyleClasses . Remove ( StyleClass . Negative ) ;
214- _hasUnreadMHelp = false ;
215- }
216-
217- public void OnStateEntered ( GameplayState state )
218- {
219- if ( GameMHelpButton != null )
220- {
221- GameMHelpButton . OnPressed -= MHelpButtonPressed ;
222- GameMHelpButton . OnPressed += MHelpButtonPressed ;
223- GameMHelpButton . Pressed = UIHelper ? . IsOpen ?? false ;
224-
225- if ( _hasUnreadMHelp )
226- {
227- UnreadMHelpReceived ( ) ;
228- }
229- else
230- {
231- UnreadMHelpRead ( ) ;
232- }
233- }
234- }
235-
236- public void OnStateExited ( GameplayState state )
237- {
238- if ( GameMHelpButton != null )
239- GameMHelpButton . OnPressed -= MHelpButtonPressed ;
240- }
241-
242- public void OnStateEntered ( LobbyState state )
243- {
244- if ( LobbyMHelpButton != null )
245- {
246- LobbyMHelpButton . OnPressed -= MHelpButtonPressed ;
247- LobbyMHelpButton . OnPressed += MHelpButtonPressed ;
248- LobbyMHelpButton . Pressed = UIHelper ? . IsOpen ?? false ;
249-
250- if ( _hasUnreadMHelp )
251- {
252- UnreadMHelpReceived ( ) ;
253- }
254- else
255- {
256- UnreadMHelpRead ( ) ;
257- }
258- }
259- }
260-
261- public void OnStateExited ( LobbyState state )
262- {
263- if ( LobbyMHelpButton != null )
264- LobbyMHelpButton . OnPressed -= MHelpButtonPressed ;
147+ _staffhelp . RefreshAhelpButton ( ) ;
265148 }
266149}
0 commit comments