private void Update() { PixelWidth = Mathf.Max(1, PixelWidth); PixelHeight = Mathf.Max(1, PixelHeight); var camera = GetComponent <Camera>(); if (camera != null) { float actualAspect = camera.aspect * camera.rect.height / camera.rect.width; switch (ScaleMode) { case ScaleModes.BasedOnHeight: PixelWidth = Mathf.RoundToInt(PixelHeight * actualAspect); break; case ScaleModes.BasedOnWidth: PixelHeight = Mathf.RoundToInt(PixelWidth / actualAspect); break; } } if (!Application.isPlaying) { UpdateTexture(false); } if (m_lastWidth != PixelWidth || m_lastHeight != PixelHeight || m_lastColorDepth != ColorDepth || m_lastCustomMaterial != CustomMaterial) { UpdateTexture(); m_lastWidth = PixelWidth; m_lastHeight = PixelHeight; m_lastColorDepth = ColorDepth; m_lastCustomMaterial = CustomMaterial; } if (TargetCameras != null) { foreach (var targetCamera in TargetCameras) { if (targetCamera == null) { continue; } if (targetCamera.targetTexture != m_texture || m_texture == null) { UpdateTexture(); } } } transform.localScale = Vector3.one; transform.position = 99999 * Vector3.down; }
private void LoadSettings() { SelectedScreenResolution = ScreenResolutions.FirstOrDefault(x => x == string.Format("{0}x{1}", SettingsManager.Current.RemoteDesktop_DesktopWidth, SettingsManager.Current.RemoteDesktop_DesktopHeight)); SelectedColorDepth = ColorDepths.FirstOrDefault(x => x == SettingsManager.Current.RemoteDesktop_ColorDepth); RedirectClipboard = SettingsManager.Current.RemoteDesktop_RedirectClipboard; RedirectDevices = SettingsManager.Current.RemoteDesktop_RedirectDevices; RedirectDrives = SettingsManager.Current.RemoteDesktop_RedirectDrives; RedirectPorts = SettingsManager.Current.RemoteDesktop_RedirectPorts; RedirectSmartCards = SettingsManager.Current.RemoteDesktop_RedirectSmartCards; RedirectPrinters = SettingsManager.Current.RemoteDesktop_RedirectPrinters; }
private void LoadSettings() { AdjustScreenAutomatically = SettingsManager.Current.RemoteDesktop_AdjustScreenAutomatically; SelectedScreenResolution = ScreenResolutions.FirstOrDefault(x => x == string.Format("{0}x{1}", SettingsManager.Current.RemoteDesktop_DesktopWidth, SettingsManager.Current.RemoteDesktop_DesktopHeight)); SelectedColorDepth = ColorDepths.FirstOrDefault(x => x == SettingsManager.Current.RemoteDesktop_ColorDepth); EnableCredSspSupport = SettingsManager.Current.RemoteDesktop_EnableCredSspSupport; AuthenticationLevel = SettingsManager.Current.RemoteDesktop_AuthenticationLevel; RedirectClipboard = SettingsManager.Current.RemoteDesktop_RedirectClipboard; RedirectDevices = SettingsManager.Current.RemoteDesktop_RedirectDevices; RedirectDrives = SettingsManager.Current.RemoteDesktop_RedirectDrives; RedirectPorts = SettingsManager.Current.RemoteDesktop_RedirectPorts; RedirectSmartCards = SettingsManager.Current.RemoteDesktop_RedirectSmartCards; RedirectPrinters = SettingsManager.Current.RemoteDesktop_RedirectPrinters; }