Adds a link limit and UI to device list (#11017)
* adds a link limit to device list * locale strings * uhhh what's efcore doing there * adds a UI for device list on the device * merge conflict fixing
This commit is contained in:
@@ -222,6 +222,12 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
|
||||
configurator.ActiveDeviceList = targetUid;
|
||||
Dirty(configurator);
|
||||
_uiSystem.GetUiOrNull(configurator.Owner, NetworkConfiguratorUiKey.Configure)?.Open(actor.PlayerSession);
|
||||
_uiSystem.TrySetUiState(
|
||||
configurator.Owner,
|
||||
NetworkConfiguratorUiKey.Configure,
|
||||
new DeviceListUserInterfaceState(
|
||||
_deviceListSystem.GetDeviceList(configurator.ActiveDeviceList.Value)
|
||||
.Select(v => (v.Key, MetaData(v.Value).EntityName)).ToHashSet()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -287,26 +293,42 @@ public sealed class NetworkConfiguratorSystem : SharedNetworkConfiguratorSystem
|
||||
if (!component.ActiveDeviceList.HasValue)
|
||||
return;
|
||||
|
||||
var result = DeviceListUpdateResult.NoComponent;
|
||||
switch (args.ButtonKey)
|
||||
{
|
||||
case NetworkConfiguratorButtonKey.Set:
|
||||
_deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet<EntityUid>(component.Devices.Values));
|
||||
result = _deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet<EntityUid>(component.Devices.Values));
|
||||
break;
|
||||
case NetworkConfiguratorButtonKey.Add:
|
||||
_deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet<EntityUid>(component.Devices.Values), true);
|
||||
result = _deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet<EntityUid>(component.Devices.Values), true);
|
||||
break;
|
||||
case NetworkConfiguratorButtonKey.Clear:
|
||||
_deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet<EntityUid>());
|
||||
result = _deviceListSystem.UpdateDeviceList(component.ActiveDeviceList.Value, new HashSet<EntityUid>());
|
||||
break;
|
||||
case NetworkConfiguratorButtonKey.Copy:
|
||||
component.Devices = _deviceListSystem.GetDeviceList(component.ActiveDeviceList.Value);
|
||||
UpdateUiState(uid, component);
|
||||
break;
|
||||
return;
|
||||
case NetworkConfiguratorButtonKey.Show:
|
||||
// This should be done client-side.
|
||||
// _deviceListSystem.ToggleVisualization(component.ActiveDeviceList.Value);
|
||||
break;
|
||||
}
|
||||
|
||||
var resultText = result switch
|
||||
{
|
||||
DeviceListUpdateResult.TooManyDevices => Loc.GetString("network-configurator-too-many-devices"),
|
||||
DeviceListUpdateResult.UpdateOk => Loc.GetString("network-configurator-update-ok"),
|
||||
_ => "error"
|
||||
};
|
||||
|
||||
_popupSystem.PopupCursor(Loc.GetString(resultText), Filter.SinglePlayer(args.Session), PopupType.Medium);
|
||||
_uiSystem.TrySetUiState(
|
||||
component.Owner,
|
||||
NetworkConfiguratorUiKey.Configure,
|
||||
new DeviceListUserInterfaceState(
|
||||
_deviceListSystem.GetDeviceList(component.ActiveDeviceList.Value)
|
||||
.Select(v => (v.Key, MetaData(v.Value).EntityName)).ToHashSet()));
|
||||
}
|
||||
|
||||
// hacky solution related to mapping
|
||||
|
||||
Reference in New Issue
Block a user