private void onResolutionChanged(int value) { string text = resolutionsMenu.captionText.text; if (AvailableResolutions.TryGetValue(text, out var value2) && (Screen.fullScreen || customGraphicsService.TryFitWindowedScreen(value2.width, value2.height))) { DisplayResolutionManager.SetResolution(value2, Screen.fullScreen); } }
public bool TryFitWindowedScreen(int width, int height) { int num = (int)((float)Screen.currentResolution.width * 0.99f); int num2 = (int)((float)Screen.currentResolution.height * 0.94f); int width2 = Math.Min(width, num); int height2 = Math.Min(height, num2); if (width > num || height > num2) { DisplayResolutionManager.SetRawResolution(width2, height2, fullscreen: false); return(false); } return(true); }