diff --git a/Content.Client/Administration/UI/AdminMenuWindow.xaml.cs b/Content.Client/Administration/UI/AdminMenuWindow.xaml.cs
index f3aa2572f2f..d5c43e2a500 100644
--- a/Content.Client/Administration/UI/AdminMenuWindow.xaml.cs
+++ b/Content.Client/Administration/UI/AdminMenuWindow.xaml.cs
@@ -3,38 +3,57 @@
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
-namespace Content.Client.Administration.UI
+namespace Content.Client.Administration.UI;
+
+[GenerateTypedNameReferences]
+public sealed partial class AdminMenuWindow : DefaultWindow
{
- [GenerateTypedNameReferences]
- public sealed partial class AdminMenuWindow : DefaultWindow
+ public event Action? OnDisposed;
+
+ public AdminMenuWindow()
+ {
+ MinSize = new Vector2(650, 250);
+ Title = Loc.GetString("admin-menu-title");
+ RobustXamlLoader.Load(this);
+ MasterTabContainer.SetTabTitle((int) TabIndex.Admin, Loc.GetString("admin-menu-admin-tab"));
+ MasterTabContainer.SetTabTitle((int) TabIndex.Adminbus, Loc.GetString("admin-menu-adminbus-tab"));
+ MasterTabContainer.SetTabTitle((int) TabIndex.Atmos, Loc.GetString("admin-menu-atmos-tab"));
+ MasterTabContainer.SetTabTitle((int) TabIndex.Round, Loc.GetString("admin-menu-round-tab"));
+ MasterTabContainer.SetTabTitle((int) TabIndex.Server, Loc.GetString("admin-menu-server-tab"));
+ MasterTabContainer.SetTabTitle((int) TabIndex.PanicBunker, Loc.GetString("admin-menu-panic-bunker-tab"));
+ /*
+ * TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
+ */
+ MasterTabContainer.SetTabTitle((int) TabIndex.BabyJail, Loc.GetString("admin-menu-baby-jail-tab"));
+ MasterTabContainer.SetTabTitle((int) TabIndex.Players, Loc.GetString("admin-menu-players-tab"));
+ MasterTabContainer.SetTabTitle((int) TabIndex.Objects, Loc.GetString("admin-menu-objects-tab"));
+ MasterTabContainer.OnTabChanged += OnTabChanged;
+ }
+
+ private void OnTabChanged(int tabIndex)
{
- public event Action? OnDisposed;
+ var tabEnum = (TabIndex)tabIndex;
+ if (tabEnum == TabIndex.Objects)
+ ObjectsTabControl.RefreshObjectList();
+ }
- public AdminMenuWindow()
- {
- MinSize = new Vector2(650, 250);
- Title = Loc.GetString("admin-menu-title");
- RobustXamlLoader.Load(this);
- MasterTabContainer.SetTabTitle(0, Loc.GetString("admin-menu-admin-tab"));
- MasterTabContainer.SetTabTitle(1, Loc.GetString("admin-menu-adminbus-tab"));
- MasterTabContainer.SetTabTitle(2, Loc.GetString("admin-menu-atmos-tab"));
- MasterTabContainer.SetTabTitle(3, Loc.GetString("admin-menu-round-tab"));
- MasterTabContainer.SetTabTitle(4, Loc.GetString("admin-menu-server-tab"));
- MasterTabContainer.SetTabTitle(5, Loc.GetString("admin-menu-panic-bunker-tab"));
- /*
- * TODO: Remove baby jail code once a more mature gateway process is established. This code is only being issued as a stopgap to help with potential tiding in the immediate future.
- */
- MasterTabContainer.SetTabTitle(6, Loc.GetString("admin-menu-baby-jail-tab"));
- MasterTabContainer.SetTabTitle(7, Loc.GetString("admin-menu-players-tab"));
- MasterTabContainer.SetTabTitle(8, Loc.GetString("admin-menu-objects-tab"));
- }
+ protected override void Dispose(bool disposing)
+ {
+ OnDisposed?.Invoke();
+ base.Dispose(disposing);
+ OnDisposed = null;
+ }
- protected override void Dispose(bool disposing)
- {
- OnDisposed?.Invoke();
- base.Dispose(disposing);
- OnDisposed = null;
- }
+ private enum TabIndex
+ {
+ Admin = 0,
+ Adminbus,
+ Atmos,
+ Round,
+ Server,
+ PanicBunker,
+ BabyJail,
+ Players,
+ Objects,
}
}
-
diff --git a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml
index 821389150d6..f4298bbc00f 100644
--- a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml
+++ b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml
@@ -4,18 +4,17 @@
xmlns:co="clr-namespace:Content.Client.UserInterface.Controls">
-
-
-
+
+
+
+
-
-
-
+
-
-
-
+
+
+
diff --git a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs
index 67e0db01eeb..78eefa34628 100644
--- a/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs
+++ b/Content.Client/Administration/UI/Tabs/ObjectsTab/ObjectsTab.xaml.cs
@@ -3,6 +3,7 @@
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Map.Components;
using Robust.Shared.Timing;
@@ -15,17 +16,14 @@ public sealed partial class ObjectsTab : Control
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IGameTiming _timing = default!;
- private readonly List _objects = new();
- private readonly List _selections = new();
- private bool _ascending = false; // Set to false for descending order by default
- private ObjectsTabHeader.Header _headerClicked = ObjectsTabHeader.Header.ObjectName;
private readonly Color _altColor = Color.FromHex("#292B38");
private readonly Color _defaultColor = Color.FromHex("#2F2F3B");
- public event Action? OnEntryKeyBindDown;
+ private bool _ascending;
+ private ObjectsTabHeader.Header _headerClicked = ObjectsTabHeader.Header.ObjectName;
- private readonly TimeSpan _updateFrequency = TimeSpan.FromSeconds(2);
- private TimeSpan _nextUpdate;
+ private readonly List _selections = [];
+ public event Action? OnEntryKeyBindDown;
public ObjectsTab()
{
@@ -38,40 +36,25 @@ public ObjectsTab()
RefreshObjectList(_selections[ev.Id]);
};
- foreach (var type in Enum.GetValues(typeof(ObjectsTabSelection)))
+ foreach (var type in Enum.GetValues())
{
- _selections.Add((ObjectsTabSelection)type!);
- ObjectTypeOptions.AddItem(Loc.GetString($"object-tab-object-type-{((Enum.GetName((ObjectsTabSelection)type))!.ToString().ToLower())}"));
+ _selections.Add(type);
+ ObjectTypeOptions.AddItem(GetLocalizedEnumValue(type));
}
ListHeader.OnHeaderClicked += HeaderClicked;
SearchList.SearchBar = SearchLineEdit;
SearchList.GenerateItem += GenerateButton;
SearchList.DataFilterCondition += DataFilterCondition;
+ SearchList.ItemKeyBindDown += (args, data) => OnEntryKeyBindDown?.Invoke(args, data);
+ RefreshListButton.OnPressed += _ => RefreshObjectList();
- RefreshObjectList();
- // Set initial selection and refresh the list to apply the initial sort order
var defaultSelection = ObjectsTabSelection.Grids;
- ObjectTypeOptions.SelectId((int)defaultSelection); // Set the default selection
- RefreshObjectList(defaultSelection); // Refresh the list with the default selection
-
- // Initialize the next update time
- _nextUpdate = TimeSpan.Zero;
- }
-
- protected override void FrameUpdate(FrameEventArgs args)
- {
- base.FrameUpdate(args);
-
- if (_timing.CurTime < _nextUpdate)
- return;
-
- _nextUpdate = _timing.CurTime + _updateFrequency;
-
- RefreshObjectList();
+ ObjectTypeOptions.SelectId((int) defaultSelection);
+ RefreshObjectList(defaultSelection);
}
- private void RefreshObjectList()
+ public void RefreshObjectList()
{
RefreshObjectList(_selections[ObjectTypeOptions.SelectedId]);
}
@@ -101,6 +84,7 @@ private void RefreshObjectList(ObjectsTabSelection selection)
{
entities.Add((metadata.EntityName, _entityManager.GetNetEntity(uid)));
}
+
break;
}
default:
@@ -111,14 +95,18 @@ private void RefreshObjectList(ObjectsTabSelection selection)
{
var valueA = GetComparableValue(a, _headerClicked);
var valueB = GetComparableValue(b, _headerClicked);
- return _ascending ? Comparer