Removes hacky behavior from DeviceListSystem (#11255)

This commit is contained in:
Flipp Syder
2022-09-13 23:09:43 -07:00
committed by GitHub
parent 737002248b
commit ec6cdbd51a
5 changed files with 8 additions and 64 deletions

View File

@@ -55,20 +55,7 @@ public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
private void OnShowPressed(BaseButton.ButtonEventArgs args)
{
if (!args.Button.Pressed)
{
_netConfig.ToggleVisualization(Owner.Owner, false);
return;
}
if (_entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityLifeStage == EntityLifeStage.Initialized)
{
// We're in mapping mode. Do something hacky.
SendMessage(new ManualDeviceListSyncMessage(null, null));
return;
}
_netConfig.ToggleVisualization(Owner.Owner, true);
_netConfig.ToggleVisualization(Owner.Owner, args.Button.Pressed);
}
protected override void UpdateState(BoundUserInterfaceState state)
@@ -86,25 +73,6 @@ public sealed class NetworkConfiguratorBoundUserInterface : BoundUserInterface
}
}
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
{
base.ReceiveMessage(message);
if (_configurationMenu == null
|| _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityLifeStage > EntityLifeStage.Initialized
|| message is not ManualDeviceListSyncMessage cast
|| cast.Device == null
|| cast.Devices == null)
{
return;
}
_netConfig.SetActiveDeviceList(Owner.Owner, cast.Device.Value);
_deviceList.UpdateDeviceList(cast.Device.Value, cast.Devices);
_netConfig.ToggleVisualization(Owner.Owner, true);
_configurationMenu.Show.Pressed = true;
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);