1
- using Content . Client . UserInterface . Controls ;
1
+ using Content . Client . Stylesheets ;
2
+ using Content . Shared . Administration . Notes ;
2
3
using Robust . Client . AutoGenerated ;
4
+ using Robust . Client . UserInterface ;
3
5
using Robust . Client . UserInterface . Controls ;
4
6
using Robust . Client . UserInterface . XAML ;
5
7
using Robust . Shared . Timing ;
8
+ using Robust . Shared . Utility ;
6
9
7
10
namespace Content . Client . Administration . UI . AdminRemarks ;
8
11
9
12
[ GenerateTypedNameReferences ]
10
- public sealed partial class AdminMessagePopupWindow : FancyWindow
13
+ public sealed partial class AdminMessagePopupWindow : Control
11
14
{
12
15
private float _timer = float . MaxValue ;
13
- public float Timer
14
- {
15
- get => _timer ;
16
- set
17
- {
18
- WaitLabel . Text = Loc . GetString ( "admin-notes-message-wait" , ( "time" , MathF . Floor ( value ) ) ) ;
19
- _timer = value ;
20
- }
21
- }
22
16
23
17
public event Action ? OnDismissPressed ;
18
+
24
19
public event Action ? OnAcceptPressed ;
25
20
26
21
public AdminMessagePopupWindow ( )
27
22
{
28
23
RobustXamlLoader . Load ( this ) ;
29
24
25
+ Stylesheet = IoCManager . Resolve < IStylesheetManager > ( ) . SheetSpace ;
26
+
30
27
AcceptButton . OnPressed += OnAcceptButtonPressed ;
31
28
DismissButton . OnPressed += OnDismissButtonPressed ;
32
29
}
33
30
34
- public void SetMessage ( string message )
31
+ public float Timer
35
32
{
36
- MessageLabel . SetMessage ( message ) ;
33
+ get => _timer ;
34
+ private set
35
+ {
36
+ WaitLabel . Text = Loc . GetString ( "admin-notes-message-wait" , ( "time" , MathF . Floor ( value ) ) ) ;
37
+ _timer = value ;
38
+ }
37
39
}
38
40
39
- public void SetDetails ( string adminName , DateTime addedOn )
41
+ public void SetState ( AdminMessageEuiState state )
40
42
{
41
- AdminLabel . Text = Loc . GetString ( "admin-notes-message-admin" , ( "admin" , adminName ) , ( "date" , addedOn ) ) ;
43
+ Timer = ( float ) state . Time . TotalSeconds ;
44
+
45
+ MessageContainer . RemoveAllChildren ( ) ;
46
+
47
+ foreach ( var message in state . Messages )
48
+ {
49
+ MessageContainer . AddChild ( new AdminMessagePopupMessage ( message ) ) ;
50
+ }
51
+
52
+ Description . SetMessage ( FormattedMessage . FromMarkup ( Loc . GetString ( "admin-notes-message-desc" , ( "count" , state . Messages . Length ) ) ) ) ;
42
53
}
43
54
44
55
private void OnDismissButtonPressed ( BaseButton . ButtonEventArgs obj )
45
56
{
46
57
OnDismissPressed ? . Invoke ( ) ;
47
- Close ( ) ;
48
58
}
49
59
50
60
private void OnAcceptButtonPressed ( BaseButton . ButtonEventArgs obj )
51
61
{
52
62
OnAcceptPressed ? . Invoke ( ) ;
53
- Close ( ) ;
54
63
}
55
64
56
65
protected override void FrameUpdate ( FrameEventArgs args )
@@ -70,6 +79,7 @@ protected override void FrameUpdate(FrameEventArgs args)
70
79
else
71
80
{
72
81
AcceptButton . Disabled = false ;
82
+ DismissButton . Disabled = false ;
73
83
}
74
84
}
75
85
}
0 commit comments