Sort ghost warps (#6210)
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -34,11 +36,20 @@ namespace Content.Client.Ghost.UI
|
|||||||
|
|
||||||
private void AddButtonPlayers()
|
private void AddButtonPlayers()
|
||||||
{
|
{
|
||||||
foreach (var (key, value) in Players)
|
var sortedPlayers = new List<(string, EntityUid)>(Players.Count);
|
||||||
|
|
||||||
|
foreach (var (key, player) in Players)
|
||||||
|
{
|
||||||
|
sortedPlayers.Add((player, key));
|
||||||
|
}
|
||||||
|
|
||||||
|
sortedPlayers.Sort((x, y) => string.Compare(x.Item1, y.Item1, StringComparison.Ordinal));
|
||||||
|
|
||||||
|
foreach (var (key, player) in sortedPlayers)
|
||||||
{
|
{
|
||||||
var currentButtonRef = new Button
|
var currentButtonRef = new Button
|
||||||
{
|
{
|
||||||
Text = value,
|
Text = key,
|
||||||
TextAlign = Label.AlignMode.Right,
|
TextAlign = Label.AlignMode.Right,
|
||||||
HorizontalAlignment = HAlignment.Center,
|
HorizontalAlignment = HAlignment.Center,
|
||||||
VerticalAlignment = VAlignment.Center,
|
VerticalAlignment = VAlignment.Center,
|
||||||
@@ -49,7 +60,7 @@ namespace Content.Client.Ghost.UI
|
|||||||
|
|
||||||
currentButtonRef.OnPressed += (_) =>
|
currentButtonRef.OnPressed += (_) =>
|
||||||
{
|
{
|
||||||
var msg = new GhostWarpToTargetRequestEvent(key);
|
var msg = new GhostWarpToTargetRequestEvent(player);
|
||||||
_netManager.SendSystemNetworkMessage(msg);
|
_netManager.SendSystemNetworkMessage(msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -59,7 +70,11 @@ namespace Content.Client.Ghost.UI
|
|||||||
|
|
||||||
private void AddButtonLocations()
|
private void AddButtonLocations()
|
||||||
{
|
{
|
||||||
foreach (var name in Locations)
|
// Server COULD send these sorted but how about we just use the client to do it instead.
|
||||||
|
var sortedLocations = new List<string>(Locations);
|
||||||
|
sortedLocations.Sort((x, y) => string.Compare(x, y, StringComparison.Ordinal));
|
||||||
|
|
||||||
|
foreach (var name in sortedLocations)
|
||||||
{
|
{
|
||||||
var currentButtonRef = new Button
|
var currentButtonRef = new Button
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user