/// <summary> /// ドロップダウンで選択されているものを一つ次に進める /// </summary> public void ForwardDropdown() { int index = _serialPortsDropdown.value + 1; if (index >= _serialPortsDropdown.options.Count) { index = 0; } _serialPortsDropdown.value = index; _serialPortsDropdown.RefreshShownValue(); }
private void Start() { if (Screen.fullScreen) { fullScreenToggle.isOn = true; } else { fullScreenToggle.isOn = false; } resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentRes = 2; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height; options.Add(option); //Debug.Log(Screen.currentResolution); if (Screen.currentResolution.width == resolutions[i].width && Screen.currentResolution.height == resolutions[i].height) { currentRes = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentRes; resolutionDropdown.RefreshShownValue(); }
void Start() { int qualityLevel = QualitySettings.GetQualityLevel(); resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currResolutionIndex; resolutionDropdown.RefreshShownValue(); graphicsDropdown.value = qualityLevel; graphicsDropdown.RefreshShownValue(); }
private void Start() { Screen.fullScreen = fullscreen; resolutions = Screen.resolutions; res.ClearOptions(); List <string> options = new List <string>(); int currentRes = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentRes = i; } } res.AddOptions(options); res.value = currentRes; res.RefreshShownValue(); }
// Start is called before the first frame update private void Start() { resolutions = new List <Resolution>(); resDropdown.ClearOptions(); Resolution[] array = Screen.resolutions; List <string> resolutionStrings = new List <string>(); int curResIndex = 0; for (int i = 0; i < array.Length; i++) { string option = array[i].width + " x " + array[i].height + ", " + array[i].refreshRate + "hz"; if (Mathf.Approximately((float)array[i].width / (float)array[i].height, 16f / 9f)) { resolutionStrings.Add(option); resolutions.Add(array[i]); if (array[i].width == Screen.currentResolution.width && array[i].height == Screen.currentResolution.height) { curResIndex = i; } } } resDropdown.AddOptions(resolutionStrings); resDropdown.value = curResIndex; resDropdown.RefreshShownValue(); }
public void Start() { audioMixer.GetFloat("musicVolume", out float musicValueForSlider); musicSlider.value = musicValueForSlider; audioMixer.GetFloat("sfxVolume", out float sfxValueForSlider); sfxSlider.value = sfxValueForSlider; // Dans la liste de toutes les résolutions supportées par l'écran (qui contient des duplicatas), on choisit des résolutions distinctes en discriminant sur le couple width;height et on rentre le tout dans une liste. availableResolutions = Screen.resolutions.Select(resolution => new Resolution { width = resolution.width, height = resolution.height }).Distinct().ToArray(); resolutionDropDown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < availableResolutions.Length; i++) { string option = availableResolutions[i].width + "x" + availableResolutions[i].height; options.Add(option); if (availableResolutions[i].width == Screen.width && availableResolutions[i].height == Screen.height) { currentResolutionIndex = i; } } resolutionDropDown.AddOptions(options); resolutionDropDown.value = currentResolutionIndex; resolutionDropDown.RefreshShownValue(); Screen.fullScreen = true; }
void Start() { m_Resolutions = Screen.resolutions; m_ResolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentRes = 0; for (int i = 0; i < m_Resolutions.Length; i++) { string option = m_Resolutions[i].width + " x " + m_Resolutions[i].height; options.Add(option); if (m_Resolutions[i].width == Screen.currentResolution.width && m_Resolutions[i].height == Screen.currentResolution.height) { currentRes = i; } } m_ResolutionDropdown.AddOptions(options); m_ResolutionDropdown.value = currentRes; m_ResolutionDropdown.RefreshShownValue(); }
private void Start() { SetFullscreen(true); resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { if ((new[] { 600, 1024, 1920 }).Contains(resolutions[i].width)) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); } if (resolutions[i].width == Screen.width && resolutions[i].height == Screen.height) { currentResolutionIndex = i; } } options.Distinct().ToList(); resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); }
private void Start() { isFullscreen = Screen.fullScreen; resolutions = Screen.resolutions; //store all avalible resolutions on this hardware. resolutionDropdown.ClearOptions(); //convert resolutions to options string list; int currentResolutionIndex = 0; List <string> options = new List <string>(); for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height; if (options.Contains(option) == false) { options.Add(option); } if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); }
void Start() { pause = false; screenResolutions = Screen.resolutions; resolutionsDropdown.ClearOptions(); // making resolutions strings to pass to UI element List <string> resOptions = new List <string>(); int currentResIndex = 0; for (int i = 0; i < screenResolutions.Length; i++) { string option = screenResolutions[i].width + " x " + screenResolutions[i].height; resOptions.Add(option); if (screenResolutions[i].width == Screen.currentResolution.width && screenResolutions[i].height == Screen.currentResolution.height) { currentResIndex = i; } } resolutionsDropdown.AddOptions(resOptions); resolutionsDropdown.value = currentResIndex; resolutionsDropdown.RefreshShownValue(); //to display value }
void Start() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); float vol = 0; audioMixer.GetFloat("Volume", out vol); volumeSlider.value = vol; }
void Start() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); Debug.Log(resolutions[i].width + " x " + resolutions[i].height); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); }
private void FillResolutionsDropDown() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int idx = 0; idx < resolutions.Length; idx++) { string option = resolutions[idx].width + "x" + resolutions[idx].height + " " + resolutions[idx].refreshRate + "Hz"; options.Add(option); if (resolutions[idx].width == Screen.currentResolution.width && resolutions[idx].height == Screen.currentResolution.height) { currentResolutionIndex = idx; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); }
private void Start() { resolutions = Screen.resolutions; resolutionDropDowm.ClearOptions(); int currentResolutionIndex = 0; List <string> options = new List <string>(); for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; if (!options.Contains(option)) { options.Add(option); } if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResolutionIndex = i; } } resolutionDropDowm.AddOptions(options); resolutionDropDowm.value = currentResolutionIndex; resolutionDropDowm.RefreshShownValue(); }
private void ScreenResolutions() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> resOptions = new List <string>(); int currentResIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height; resOptions.Add(option); if (resolutions[i].width == settings.resolution.width && resolutions[i].height == settings.resolution.height) { currentResIndex = i; } } resolutionDropdown.AddOptions(resOptions); resolutionDropdown.value = currentResIndex; resolutionDropdown.RefreshShownValue(); }
private void Start() { GameObject.Find("Slider").GetComponent <Slider>().value = sliderVolume; resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.width && resolutions[i].height == Screen.height) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); qualityDropdown.value = qualityChoice; qualityDropdown.RefreshShownValue(); fullScreenButton.isOn = fullScreenChoice; }
void InitResDropdown() { resolutions = Screen.resolutions; resDropdown.ClearOptions(); List <string> options = new List <string>(); string option = ""; int currentResIndex = 0; int currentIndex = 0; foreach (Resolution res in resolutions) { option = res.width.ToString() + "x" + res.height.ToString(); options.Add(option); option = ""; if (res.width == Screen.currentResolution.width && res.height == Screen.currentResolution.height) { currentResIndex = currentIndex; } currentIndex++; } resDropdown.AddOptions(options); resDropdown.value = currentResIndex; resDropdown.RefreshShownValue(); }
void Awake() { Logo = GameObject.Find("logo"); Start = GameObject.Find("Start"); Exit = GameObject.Find("Exit"); volumeSlider = GameObject.Find("VolumeSlider"); optionsObj = GameObject.Find("Optionsimage"); volumeSlider.SetActive(false); optionsObj.SetActive(false); resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); int currentResolutionIndex = 0; List <string> options = new List <string>(); for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRate + " " + "Hz"; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height && resolutions[i].refreshRate == Screen.currentResolution.refreshRate) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); }
public override void InnerOnShow() { fullscreenToggle.isOn = Screen.fullScreen; resolutions = Screen.resolutions; resDropdown.ClearOptions(); int currentResIndex = 0; List <string> optionList = new List <string>(); for (int i = 0; i < resolutions.Length; i++) { string optionName = resolutions[i].width + " x " + resolutions[i].height + " " + resolutions[i].refreshRate + "Hz"; optionList.Add(optionName); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResIndex = i; } } resDropdown.AddOptions(optionList); resDropdown.value = currentResIndex; resDropdown.RefreshShownValue(); fullscreenToggle.onValueChanged.AddListener(SetFullscreen); resDropdown.onValueChanged.AddListener(SetResolution); }
private void Start() { //gives the resolutions array all available screen resolutions, not including resolutions with different refresh rates resolutions = Screen.resolutions.Select(resolution => new Resolution { width = resolution.width, height = resolution.height }).Distinct().ToArray(); resolutionDropdown.ClearOptions(); //creates a new list of strings List <string> options = new List <string>(); int currResIndex = 0; //adds each resolution from the resolutions array as a string to the options list for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); //if the resolution being added to the options list is equal to the screen's current resolution, it's saved in currResIndex if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currResIndex = i; } } //adds the list of resolution options to the resolution dropdown's options resolutionDropdown.AddOptions(options); // sets the resolution dropdown's value to currResIndex resolutionDropdown.value = currResIndex; //refreshes the resolution dropdown's shown value so it shows the screen's current resolution resolutionDropdown.RefreshShownValue(); }
void Start() { _managerpause = GameObject.Find("Manager").GetComponent <Pause>(); _manager = GameObject.Find("Manager").GetComponent <Manager>(); resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); int currentResolutionIndex = 0; List <string> options = new List <string>(); for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRate + " " + "Hz"; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height && resolutions[i].refreshRate == Screen.currentResolution.refreshRate) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); }
private void OnEnable() { resolutions = Screen.resolutions; List <string> options = new List <string>(); int currentResolutionIndex = 0; int it = 0; foreach (Resolution res in resolutions) { string option = res.width + " x " + res.height; options.Add(option); if (res.width == Screen.currentResolution.width && res.height == Screen.currentResolution.height) { currentResolutionIndex = it; } it++; } resDropdown.AddOptions(options); resDropdown.value = currentResolutionIndex; resDropdown.RefreshShownValue(); }
void Start() { reso = Screen.resolutions; List <string> resoList = new List <string>(); resoDropdown.ClearOptions(); for (int i = 0; i < reso.Length; i++) { if (reso[i].width / reso[i].height == 16 / 9) { string temp = reso[i].width + "X" + reso[i].height; resoList.Add(temp); } if (reso[i].width == Screen.currentResolution.width && reso[i].height == Screen.currentResolution.height) { currentResolutionIndex = i; } } resoDropdown.AddOptions(resoList); resoDropdown.value = currentResolutionIndex; resoDropdown.RefreshShownValue(); xSensSlider.value = PlayerPrefs.GetFloat("X_SENS", 300); ySensSlider.value = PlayerPrefs.GetFloat("Y_SENS", 2f); xSensValue.text = Mathf.Ceil(xSensSlider.value).ToString(); ySensValue.text = Mathf.Ceil(ySensSlider.value * 100f).ToString(); }
public void Start() { GameManager.instance.cameraController.virtualCamera.Follow = lookat; resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); int currentResolutionIndex = 0; List <string> options = new List <string>(); for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); }
private void Start() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.width && resolutions[i].height == Screen.height) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); fullscreenToggle.isOn = Screen.fullScreen; //InvertXToggle.isOn = NGlow.Input.invertX; //InvertYToggle.isOn = NGlow.Input.invertY; //sensitivitySlider.value = NGlow.Input.mouseSens; }
void Awake() { Screen.fullScreenMode = FullScreenMode.ExclusiveFullScreen; //Checking and Populating Resolutions resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.width && resolutions[i].height == Screen.height) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); //Checking Screen Mode for Fullscreen Settings Toggle CheckFullScreen(); }
IEnumerator BuildOptions() { yield return(new WaitForFixedUpdate()); //resolution resolutions = Screen.resolutions; resolutionDropDown.ClearOptions(); List <string> options = new List <string>(); // set dropdown value index and so; value for resolution int currentResoIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResoIndex = i; } } resolutionDropDown.AddOptions(options); resolutionDropDown.value = currentResoIndex; resolutionDropDown.RefreshShownValue(); //graphics quality graphicsDropDown.value = QualitySettings.GetQualityLevel(); graphicsDropDown.captionText.SetText("Graphics Quality"); //max health healths = healthDropdown.options.ToArray(); //set health dropdown value index/ current health value int currentHealthIndex = 0; for (int i = 0; i < healths.Length; i++) { if (healths[i].text == gops.GetMaxHealth().ToString()) { currentHealthIndex = i; } } healthDropdown.value = currentHealthIndex; healthDropdown.RefreshShownValue(); //mouse sensitivity msslider.value = FindObjectOfType <InputController>().mouseSensitivity; msnumber.text = msslider.value.ToString(); //music volume mpslider.value = mpaso.gameObject.GetComponent <MusicPlayer>().GetChosenVolume(); musicnumber.text = TruncateString(mpaso.volume.ToString(), 4); //toggles tutorialToggle.isOn = gops.GetTutorialsEnabled(); uitoggle.isOn = gops.GetUIEnabled(); }
private void SetDefaultResolution() { //set the resolution dropdown to select default resolution m_ResolutionDropdown.value = defaultResolution; //Display the value on screen m_ResolutionDropdown.RefreshShownValue(); }
public void RefreshDropdown() { List <TMPro.TMP_Dropdown.OptionData> dataList = qualityDropdown.options; dataList[0].text = LocalizationManager.singleton.GetLocalizedValue("settings_graph_quality_low"); dataList[1].text = LocalizationManager.singleton.GetLocalizedValue("settings_graph_quality_mid"); dataList[2].text = LocalizationManager.singleton.GetLocalizedValue("settings_graph_quality_high"); qualityDropdown.RefreshShownValue(); }
private void Start() { #region Resolutions resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; if (!options.Contains(option)) { options.Add(option); } if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); #endregion #region Languages languagesDropdown.ClearOptions(); List <string> languagesOptions = new List <string>(); languagesOptions.Add("English"); languagesOptions.Add("Portuguese"); languagesDropdown.AddOptions(languagesOptions); languagesDropdown.value = languageManager.activeLanguage == Languages.ENGLISH ? 0 : 1; languagesDropdown.RefreshShownValue(); #endregion #region Graphics graphicsDropdown.ClearOptions(); List <string> graphicsOptions = new List <string>(); graphicsOptions.Add("Low"); graphicsOptions.Add("Medium"); graphicsOptions.Add("High"); graphicsOptions.Add("Ultra"); graphicsDropdown.AddOptions(graphicsOptions); graphicsDropdown.value = QualitySettings.GetQualityLevel(); graphicsDropdown.RefreshShownValue(); #endregion }