/// <summary> /// Updates the observing screen status with the current connection status of the VncManager observed. /// and sets the variables needed for the screen to behave properly in case of disconnection. /// </summary> public void UpdateObserver() { // Invert if it has to be shown on screen. _statusOnScreen = !_statusOnScreen; // Update status regarding the client status if (VncManager.GetInstance(true) != null) { _statusOnline = VncManager.GetInstance(true).ConnectionStatus; } // Put placeholder image in case of disconnection. if (!_statusOnline) { _imageRenderer.overrideSprite = defaultSprite; } else if (VncManager.GetInstance(true) != null) { _imageRenderer.overrideSprite = null; _imageRenderer.sprite = VncManager.GetInstance(true).remoteDesktopSprite; } // Deactivate game element if terminal mode is not toggled _imageRenderer.enabled = _statusOnScreen; }
/// <summary> /// Function called on each frame the RemoteDesktopUI is present into the game. /// Polls the state of the object to determine if it should show remote desktop images or not. /// </summary> private void Update() { if (!_statusOnline || !_statusOnScreen) { return; } _imageRenderer.sprite = VncManager.GetInstance(true).remoteDesktopSprite; }
/// <summary> /// Update the color of the UI regarding on the remote server availability. /// </summary> public void UpdateOnlineStatus() { Color color = connectionCircle.color; if (VncManager.GetInstance(true) != null) { connectionCircle.color = VncManager.GetInstance(true).ConnectionStatus ? connectedColor : disconnectedColor; } if (connectionCircle.color != color) { AudioManager.Instance.PlayEffectClip(AudioManager.ConnectionChange); } }