diff --git a/Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs b/Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs index a733186f24ff1a..9ad6d2e0ea564e 100644 --- a/Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs +++ b/Content.Client/Administration/UI/Notes/AdminNotesControl.xaml.cs @@ -87,12 +87,64 @@ private bool NoteClicked(AdminNotesLine line) }; _popup.OnDeletePressed += (noteId, noteType) => NoteDeleted?.Invoke(noteId, noteType); + _popup.OnPopupHide += OnPopupHide; + var box = UIBox2.FromDimensions(UserInterfaceManager.MousePositionScaled.Position, Vector2.One); _popup.Open(box); return true; } + private void OnPopupHide() + { + if (_popup == null || + !Inputs.TryGetValue((_popup.NoteId, _popup.NoteType), out var input)) + { + return; + } + + UpdateNoteLineAlpha(input); + } + + private void NoteMouseEntered(GUIMouseHoverEventArgs args) + { + if (args.SourceControl is not AdminNotesLine line) + return; + + line.Modulate = line.Modulate.WithAlpha(1f); + } + + private void NoteMouseExited(GUIMouseHoverEventArgs args) + { + if (args.SourceControl is not AdminNotesLine line) + return; + + if (_popup?.NoteId == line.Note.Id && _popup.Visible) + return; + + UpdateNoteLineAlpha(line); + } + + private void UpdateNoteLineAlpha(AdminNotesLine input) + { + var timeDiff = DateTime.UtcNow - input.Note.CreatedAt; + float alpha; + if (_noteFreshDays == 0 || timeDiff.TotalDays <= _noteFreshDays) + { + alpha = 1f; + } + else if (_noteStaleDays == 0 || timeDiff.TotalDays > _noteStaleDays) + { + alpha = 0f; + } + else + { + alpha = (float) (1 - Math.Clamp((timeDiff.TotalDays - _noteFreshDays) / (_noteStaleDays - _noteFreshDays), 0, 1)); + } + + input.Modulate = input.Modulate.WithAlpha(alpha); + } + public void SetNotes(Dictionary<(int, NoteType), SharedAdminNote> notes) { foreach (var (key, input) in Inputs) @@ -119,25 +171,17 @@ public void SetNotes(Dictionary<(int, NoteType), SharedAdminNote> notes) input = new AdminNotesLine(_sprites, note); input.OnClicked += NoteClicked; + input.OnMouseEntered += NoteMouseEntered; + input.OnMouseExited += NoteMouseExited; - var timeDiff = DateTime.UtcNow - note.CreatedAt; - float alpha; - if (_noteFreshDays == 0 || timeDiff.TotalDays <= _noteFreshDays) - { - alpha = 1f; - } - else if (_noteStaleDays == 0 || timeDiff.TotalDays > _noteStaleDays) + UpdateNoteLineAlpha(input); + + if (input.Modulate.A == 0) { - alpha = 0f; input.Visible = false; showMoreButtonVisible = true; } - else - { - alpha = (float) (1 - Math.Clamp((timeDiff.TotalDays - _noteFreshDays) / (_noteStaleDays - _noteFreshDays), 0, 1)); - } - input.Modulate = input.Modulate.WithAlpha(alpha); Notes.AddChild(input); Inputs[(note.Id, note.NoteType)] = input; ShowMoreButton.Visible = showMoreButtonVisible; diff --git a/Content.Client/Administration/UI/Notes/AdminNotesLine.xaml.cs b/Content.Client/Administration/UI/Notes/AdminNotesLine.xaml.cs index ebd1ba5061f36d..cca545eb102535 100644 --- a/Content.Client/Administration/UI/Notes/AdminNotesLine.xaml.cs +++ b/Content.Client/Administration/UI/Notes/AdminNotesLine.xaml.cs @@ -1,11 +1,8 @@ using System.Text; -using Content.Client.Resources; using Content.Shared.Administration.Notes; using Content.Shared.Database; using Robust.Client.AutoGenerated; using Robust.Client.GameObjects; -using Robust.Client.Graphics; -using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; @@ -56,7 +53,7 @@ public AdminNotesLine(SpriteSystem sprites, SharedAdminNote note) private void Refresh() { string? iconPath; - if(Note.NoteSeverity is not null) + if (Note.NoteSeverity is not null && !NoteTypeIcons.ContainsKey(Note.NoteType)) SeverityIcons.TryGetValue(Note.NoteSeverity.Value, out iconPath); else NoteTypeIcons.TryGetValue(Note.NoteType, out iconPath); diff --git a/Content.Client/Administration/UI/Notes/AdminNotesLinePopup.xaml.cs b/Content.Client/Administration/UI/Notes/AdminNotesLinePopup.xaml.cs index 7abb985d3595e6..f7c2e91f2402d3 100644 --- a/Content.Client/Administration/UI/Notes/AdminNotesLinePopup.xaml.cs +++ b/Content.Client/Administration/UI/Notes/AdminNotesLinePopup.xaml.cs @@ -53,8 +53,8 @@ public AdminNotesLinePopup(SharedAdminNote note, string playerName, bool showDel DeleteButton.OnPressed += DeletePressed; } - private int NoteId { get; } - private NoteType NoteType { get; } + public int NoteId { get; } + public NoteType NoteType { get; } private TimeSpan? DeleteResetOn { get; set; } private void EditPressed(ButtonEventArgs args) diff --git a/Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs b/Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs index bb75fd37b8b3c6..33bcac2d51ad7d 100644 --- a/Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs +++ b/Content.Client/Administration/UI/Notes/NoteEdit.xaml.cs @@ -239,7 +239,7 @@ private void UpdateSubmitButton() return; } - SubmitButton.Disabled = NoteSeverity == null; + SubmitButton.Disabled = (NoteType != NoteType.Watchlist && NoteType != NoteType.Message) && NoteSeverity == null; } private void ResetSubmitButton() diff --git a/Content.Client/AirlockPainter/AirlockPainterSystem.cs b/Content.Client/AirlockPainter/AirlockPainterSystem.cs deleted file mode 100644 index b0ee4a970da4b9..00000000000000 --- a/Content.Client/AirlockPainter/AirlockPainterSystem.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Content.Shared.AirlockPainter; -using Robust.Client.Graphics; -using Robust.Client.ResourceManagement; -using Robust.Shared.Utility; -using System.Linq; -using Robust.Shared.Serialization.TypeSerializers.Implementations; - -namespace Content.Client.AirlockPainter -{ - public sealed class AirlockPainterSystem : SharedAirlockPainterSystem - { - [Dependency] private readonly IResourceCache _resourceCache = default!; - - public List Entries { get; private set; } = new(); - - public override void Initialize() - { - base.Initialize(); - - foreach (string style in Styles) - { - string? iconPath = Groups - .FindAll(x => x.StylePaths.ContainsKey(style))? - .MaxBy(x => x.IconPriority)?.StylePaths[style]; - if (iconPath == null) - { - Entries.Add(new AirlockPainterEntry(style, null)); - continue; - } - - RSIResource doorRsi = _resourceCache.GetResource(SpriteSpecifierSerializer.TextureRoot / new ResPath(iconPath)); - if (!doorRsi.RSI.TryGetState("closed", out var icon)) - { - Entries.Add(new AirlockPainterEntry(style, null)); - continue; - } - - Entries.Add(new AirlockPainterEntry(style, icon.Frame0)); - } - } - } - - public sealed class AirlockPainterEntry - { - public string Name; - public Texture? Icon; - - public AirlockPainterEntry(string name, Texture? icon) - { - Name = name; - Icon = icon; - } - } -} diff --git a/Content.Client/AirlockPainter/UI/AirlockPainterBoundUserInterface.cs b/Content.Client/AirlockPainter/UI/AirlockPainterBoundUserInterface.cs deleted file mode 100644 index 019718c7b55edf..00000000000000 --- a/Content.Client/AirlockPainter/UI/AirlockPainterBoundUserInterface.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Content.Shared.AirlockPainter; -using Robust.Client.GameObjects; -using Robust.Client.UserInterface.Controls; - -namespace Content.Client.AirlockPainter.UI -{ - public sealed class AirlockPainterBoundUserInterface : BoundUserInterface - { - [ViewVariables] - private AirlockPainterWindow? _window; - - [ViewVariables] - private AirlockPainterSystem? _painter; - - public AirlockPainterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) - { - } - - protected override void Open() - { - base.Open(); - - _window = new AirlockPainterWindow(); - - _painter = EntMan.System(); - - _window.OpenCentered(); - _window.OnClose += Close; - _window.OnSpritePicked = OnSpritePicked; - } - - protected override void UpdateState(BoundUserInterfaceState state) - { - base.UpdateState(state); - - if (_window == null) - return; - - if (_painter == null) - return; - - if (state is not AirlockPainterBoundUserInterfaceState stateCast) - return; - - _window.Populate(_painter.Entries, stateCast.SelectedStyle); - } - - private void OnSpritePicked(ItemList.ItemListSelectedEventArgs args) - { - SendMessage(new AirlockPainterSpritePickedMessage(args.ItemIndex)); - } - } -} diff --git a/Content.Client/AirlockPainter/UI/AirlockPainterWindow.xaml b/Content.Client/AirlockPainter/UI/AirlockPainterWindow.xaml deleted file mode 100644 index 564eccb38fcc5d..00000000000000 --- a/Content.Client/AirlockPainter/UI/AirlockPainterWindow.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - diff --git a/Content.Client/AirlockPainter/UI/AirlockPainterWindow.xaml.cs b/Content.Client/AirlockPainter/UI/AirlockPainterWindow.xaml.cs deleted file mode 100644 index 403b83e9e57cab..00000000000000 --- a/Content.Client/AirlockPainter/UI/AirlockPainterWindow.xaml.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Robust.Client.AutoGenerated; -using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.CustomControls; -using Robust.Client.UserInterface.XAML; - -namespace Content.Client.AirlockPainter.UI -{ - [GenerateTypedNameReferences] - public sealed partial class AirlockPainterWindow : DefaultWindow - { - public Action? OnSpritePicked; - - private List CurrentEntries = new List(); - - public AirlockPainterWindow() - { - RobustXamlLoader.Load(this); - } - - public void Populate(List entries, int selected) - { - // Only clear if the entries change. Otherwise the list would "jump" after selecting an item - if (!CurrentEntries.Equals(entries)) - { - CurrentEntries = entries; - SpriteList.Clear(); - foreach (var entry in entries) - { - SpriteList.AddItem(entry.Name, entry.Icon); - } - } - - // Disable event so we don't send a new event for pre-selected entry and end up in a loop - SpriteList.OnItemSelected -= OnSpritePicked; - SpriteList[selected].Selected = true; - SpriteList.OnItemSelected += OnSpritePicked; - } - } -} diff --git a/Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml b/Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml index 9cec0962039b83..d01454eb7a7a9b 100644 --- a/Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml +++ b/Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml @@ -1,8 +1,8 @@  + SetSize="620 450" + MinSize="620 450">