private void OnEnable() { options = OptionsBase.LoadFromFile( Paths.GetOptionsFilePath()) as Options; calibratingTouchscreen = true; RefreshRadioButtons(); RefreshSliders(); RefreshInputFields(); stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); bgSource.Play(); }
private void LoadOrCreateOptions() { options = null; try { options = OptionsBase.LoadFromFile( Paths.GetOptionsFilePath()) as Options; } catch (IOException) { options = new Options(); } // Find all resolutions, as well as resolutionIndex. resolutions = new List <Resolution>(); resolutionIndex = -1; for (int i = 0; i < Screen.resolutions.Length; i++) { Resolution r = Screen.resolutions[i]; resolutions.Add(r); if (r.width == options.width && r.height == options.height && r.refreshRate == options.refreshRate) { resolutionIndex = i; } } if (resolutionIndex == -1) { // Restore default resolution. resolutionIndex = resolutions.Count - 1; options.width = resolutions[resolutionIndex].width; options.height = resolutions[resolutionIndex].height; options.refreshRate = resolutions[resolutionIndex].refreshRate; } }