Fixes issue with camera switching static appearing when it shouldn't be (#10067)
This commit is contained in:
@@ -35,6 +35,6 @@ public sealed class SurveillanceCameraMonitorSystem : EntitySystem
|
||||
|
||||
public void RemoveTimer(EntityUid uid)
|
||||
{
|
||||
EntityManager.RemoveComponent<ActiveSurveillanceCameraMonitorVisualsComponent>(uid);
|
||||
EntityManager.RemoveComponentDeferred<ActiveSurveillanceCameraMonitorVisualsComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public sealed partial class SurveillanceCameraMonitorWindow : DefaultWindow
|
||||
public event Action? CameraDisconnect;
|
||||
|
||||
private string _currentAddress = string.Empty;
|
||||
private bool _isSwitching;
|
||||
private readonly FixedEye _defaultEye = new();
|
||||
private readonly Dictionary<string, int> _subnetMap = new();
|
||||
|
||||
@@ -135,13 +136,20 @@ public sealed partial class SurveillanceCameraMonitorWindow : DefaultWindow
|
||||
|
||||
private void SetCameraView(IEye? eye)
|
||||
{
|
||||
var eyeChanged = eye != CameraView.Eye || CameraView.Eye == null;
|
||||
CameraView.Eye = eye ?? _defaultEye;
|
||||
CameraView.Visible = eye != null;
|
||||
CameraViewBackground.Visible = true;
|
||||
CameraView.Visible = !eyeChanged && !_isSwitching;
|
||||
CameraDisconnectButton.Disabled = eye == null;
|
||||
|
||||
if (eye != null)
|
||||
{
|
||||
if (!eyeChanged)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_isSwitching = true;
|
||||
CameraViewBackground.Visible = true;
|
||||
CameraStatus.Text = Loc.GetString("surveillance-camera-monitor-ui-status",
|
||||
("status", Loc.GetString("surveillance-camera-monitor-ui-status-connecting")),
|
||||
("address", _currentAddress));
|
||||
@@ -149,13 +157,16 @@ public sealed partial class SurveillanceCameraMonitorWindow : DefaultWindow
|
||||
}
|
||||
else
|
||||
{
|
||||
CameraViewBackground.Visible = true;
|
||||
CameraStatus.Text = Loc.GetString("surveillance-camera-monitor-ui-status-disconnected");
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSwitchTimerComplete()
|
||||
{
|
||||
CameraViewBackground.Visible = false;
|
||||
_isSwitching = false;
|
||||
CameraView.Visible = CameraView.Eye != _defaultEye;
|
||||
CameraViewBackground.Visible = CameraView.Eye == _defaultEye;
|
||||
CameraStatus.Text = Loc.GetString("surveillance-camera-monitor-ui-status",
|
||||
("status", Loc.GetString("surveillance-camera-monitor-ui-status-connected")),
|
||||
("address", _currentAddress));
|
||||
|
||||
Reference in New Issue
Block a user