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)
|
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;
|
public event Action? CameraDisconnect;
|
||||||
|
|
||||||
private string _currentAddress = string.Empty;
|
private string _currentAddress = string.Empty;
|
||||||
|
private bool _isSwitching;
|
||||||
private readonly FixedEye _defaultEye = new();
|
private readonly FixedEye _defaultEye = new();
|
||||||
private readonly Dictionary<string, int> _subnetMap = new();
|
private readonly Dictionary<string, int> _subnetMap = new();
|
||||||
|
|
||||||
@@ -135,27 +136,37 @@ public sealed partial class SurveillanceCameraMonitorWindow : DefaultWindow
|
|||||||
|
|
||||||
private void SetCameraView(IEye? eye)
|
private void SetCameraView(IEye? eye)
|
||||||
{
|
{
|
||||||
|
var eyeChanged = eye != CameraView.Eye || CameraView.Eye == null;
|
||||||
CameraView.Eye = eye ?? _defaultEye;
|
CameraView.Eye = eye ?? _defaultEye;
|
||||||
CameraView.Visible = eye != null;
|
CameraView.Visible = !eyeChanged && !_isSwitching;
|
||||||
CameraViewBackground.Visible = true;
|
|
||||||
CameraDisconnectButton.Disabled = eye == null;
|
CameraDisconnectButton.Disabled = eye == null;
|
||||||
|
|
||||||
if (eye != null)
|
if (eye != null)
|
||||||
{
|
{
|
||||||
|
if (!eyeChanged)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isSwitching = true;
|
||||||
|
CameraViewBackground.Visible = true;
|
||||||
CameraStatus.Text = Loc.GetString("surveillance-camera-monitor-ui-status",
|
CameraStatus.Text = Loc.GetString("surveillance-camera-monitor-ui-status",
|
||||||
("status", Loc.GetString("surveillance-camera-monitor-ui-status-connecting")),
|
("status", Loc.GetString("surveillance-camera-monitor-ui-status-connecting")),
|
||||||
("address", _currentAddress));
|
("address", _currentAddress));
|
||||||
CameraSwitchTimer!();
|
CameraSwitchTimer!();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CameraViewBackground.Visible = true;
|
||||||
CameraStatus.Text = Loc.GetString("surveillance-camera-monitor-ui-status-disconnected");
|
CameraStatus.Text = Loc.GetString("surveillance-camera-monitor-ui-status-disconnected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSwitchTimerComplete()
|
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",
|
CameraStatus.Text = Loc.GetString("surveillance-camera-monitor-ui-status",
|
||||||
("status", Loc.GetString("surveillance-camera-monitor-ui-status-connected")),
|
("status", Loc.GetString("surveillance-camera-monitor-ui-status-connected")),
|
||||||
("address", _currentAddress));
|
("address", _currentAddress));
|
||||||
|
|||||||
Reference in New Issue
Block a user