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; }
// 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(); }
private void AddResolutionsToDropdown() { //Save all of the available resolutions when the scene loads up. m_Resolutions = Screen.resolutions; //clear all the preset options in the dropdown so there is a clean slate m_ResolutionDropdown.ClearOptions(); //Create a list of type strings List <string> resolutionOptions = new List <string>(); //Loop through the resolutions array and add the resolutions to the list as strings for (int i = 0; i < m_Resolutions.Length; i++) { string resolutionOption = m_Resolutions[i].width + " x " + m_Resolutions[i].height; resolutionOptions.Add(resolutionOption); //if the resolution index in the array is equal to the default resolution of the monitor if (m_Resolutions[i].width == Screen.currentResolution.width && m_Resolutions[i].height == Screen.currentResolution.height) { //Our variable will equal that resolution defaultResolution = i; } } //add these string type resolutions to the dropdown m_ResolutionDropdown.AddOptions(resolutionOptions); }
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(); }
private void PopulateYears() { int earliestYear = 2010; var list = Enumerable.Range(earliestYear, DateTime.Today.Year - earliestYear + 1).OrderByDescending(x => x).Select(x => x.ToString()).ToList(); dropdownYears.AddOptions(list); }
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 }
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(); }
void Start() { // Fullscreen toggleFullscreen.isOn = Screen.fullScreen; // Resolutions dropdownResolution.ClearOptions(); List <string> options = new List <string>(); foreach (Resolution res in Screen.resolutions) { float aspect = (float)res.width / (float)res.height; float minAspect = 16f / 9f; Debug.Log($"{res.width}x{res.height}: {aspect >= minAspect}"); if (aspect >= minAspect) { string option = res.width + "x" + res.height; if (!options.Contains(option)) { options.Add(option); } } } dropdownResolution.AddOptions(options); dropdownResolution.value = options.IndexOf(Screen.width + "x" + Screen.height); // Audio audioSlider.value = AudioManager.Instance.GetVolume(); audioSlider.onValueChanged.AddListener(UpdateAudioVolume); }
void Start() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); Debug.Log(resolutions.Length); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " * " + resolutions[i].height; options.Add(option); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResolutionIndex = i; //make the current resolution value is the same value in the drop down box } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); // show the resolution value in box }
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(); }
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(); }
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() { dropdown = GameObject.Find("Alignment_Dropdown").GetComponent <TMPro.TMP_Dropdown>(); controller = GameObject.Find("UI_Controller").GetComponent <WUI_Component>(); dropdown.AddOptions(alignment); Debug.Log(dropdown == null); }
private void Start() { offscreenPosition = SettingsPanel.rect.width; SettingsPanel.anchoredPosition = new Vector2(offscreenPosition, 0); LoadSettings(); resolutions = Screen.resolutions.Distinct().ToList(); ResolutionDropdown.ClearOptions(); List <string> options = new List <string>(); int currentindex = 0; Debug.Log($"Screen size: {Screen.width} x {Screen.height}"); Debug.Log($"Screen resolution {Screen.currentResolution}"); for (int i = 0; i < resolutions.Count; i++) { int _width = resolutions[i].width; int _height = resolutions[i].height; string option = _width + " x " + _height; options.Add(option); if (_width == width && _height == height) { currentindex = i; } } ResolutionDropdown.AddOptions(options); ResolutionDropdown.value = currentindex; }
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(); }
void Start() { resolutions = Screen.resolutions.Distinct().ToArray(); string[] strRes = new string[resolutions.Length]; for (int i = resolutions.Length - 1; i >= 0; i--) { strRes[i] = resolutions[i].width.ToString() + "x" + resolutions[i].height.ToString(); } if (PlayerPrefs.GetInt("IsFullScreen") == 1) { curIsFullscreen = true; } else { curIsFullscreen = false; } fScreen.isOn = curIsFullscreen; curRes = resolutions[PlayerPrefs.GetInt("Resolution")]; Screen.SetResolution(curRes.width, curRes.height, curIsFullscreen); dropdown.ClearOptions(); dropdown.AddOptions(strRes.ToList()); }
private void Start() { SetRenderDistance(3); resolutions = Screen.resolutions; List <TMPro.TMP_Dropdown.OptionData> l = new List <TMPro.TMP_Dropdown.OptionData>(); foreach (Resolution r in resolutions) { l.Add(new TMPro.TMP_Dropdown.OptionData(r.width + " x " + r.height)); } resDropdown.AddOptions(l); List <TMPro.TMP_Dropdown.OptionData> w = new List <TMPro.TMP_Dropdown.OptionData>(); foreach (string s in QualitySettings.names) { w.Add(new TMPro.TMP_Dropdown.OptionData(s)); } if (qualityDropdown.options != null) { qualityDropdown.options.Clear(); } qualityDropdown.AddOptions(w); qualityDropdown.value = QualitySettings.GetQualityLevel(); }
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 PopulateCategories() { iconCategories = new List <string>(iconLoader.EnumerateCategories()); categoryDropdown.AddOptions(iconCategories); categoryDropdown.value = 0; PopulateGrid(); categoryDropdown.onValueChanged.AddListener(i => PopulateGrid()); }
void PopulateVideoList() //Takes the array of VideoClips from the VideoController script and adds the name of each clip to the drop down list. { foreach (VideoClip v in vc.videos) { videoNames.Add(v.name); } dropdown.AddOptions(videoNames); }
private void OnEnable() { dropdown = GetComponent <TMPro.TMP_Dropdown>(); dropdown.ClearOptions(); var names = new List <string>(); PlayerContainer.contents.ForEach(item => names.Add(item.name)); dropdown.AddOptions(names); }
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 }
private void Start() { masterSlider.value = AudioManager.instance.MasterVolumePercent; musicSlider.value = AudioManager.instance.MusicVolumePercent; sfxSlider.value = AudioManager.instance.SFXVolumePercent; 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); // Loading player settings if (PlayerPrefs.HasKey("quality")) { qualityDropdown.value = PlayerPrefs.GetInt("quality"); } else { qualityDropdown.value = qualityDropdown.options.Count - 1; } if (PlayerPrefs.HasKey("fullscreen")) { fullscreenToggle.isOn = PlayerPrefs.GetInt("fullscreen") == 1 ? true : false; } else { fullscreenToggle.isOn = true; ToggleFullscreen(true); } if (PlayerPrefs.HasKey("resolution")) { currentResolutionIndex = PlayerPrefs.GetInt("resolution"); } resolutionDropdown.value = currentResolutionIndex; SetResolution(currentResolutionIndex); resolutionDropdown.RefreshShownValue(); }
private void Awake() { if (DropDown == null) { DropDown = this.GetComponent <TMPro.TMP_Dropdown>(); } DropDown.AddOptions(GetOptions()); }
// Start is called before the first frame update void Start() { List <string> resolutionList = new List <string>(); Resolution[] resolutions = Screen.resolutions; foreach (Resolution resolution in resolutions) { string resolutionText = resolution.width + " x " + resolution.height; resolutionList.Add(resolutionText); } dropResolution.AddOptions(resolutionList); }
void AprilResolution() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> tmp = MakeResolutions(); string screenRes = Screen.currentResolution.width + "x" + Screen.currentResolution.height; int currentResolution = 0; for (int i = 0; i < tmp.Count; i++) { string test = tmp[i]; if (test.Equals(screenRes)) { currentResolution = i; } } resolutionDropdown.AddOptions(tmp); resolutionDropdown.value = currentResolution; resolutionDropdown.RefreshShownValue(); }
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].Equals(Screen.currentResolution)) { currentResolutionIndex = i; } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); float mainVolume; float ambienceVolume; float soundsVolume; audioMixer.GetFloat("volumeMaster", out mainVolume); audioMixer.GetFloat("volumeAmbience", out ambienceVolume); audioMixer.GetFloat("volumeSounds", out soundsVolume); mainVolumeSlider.value = mainVolume; ambienceVolumeSlider.value = ambienceVolume; soundsVolumeSlider.value = soundsVolume; lookSensitivitySlider.value = GameManager.Instance.lookSensitivity; // Post processing PostProcessVolume volume = FindObjectOfType <PostProcessVolume>().GetComponent <PostProcessVolume>(); volume.profile.TryGetSettings(out motionBlur); volume.profile.TryGetSettings(out depthOfField); volume.profile.TryGetSettings(out grain); }
/// <summary> /// Fait des trucs (A SUPPRIMER) /// </summary> void Start() { // Dropdown Personnage dropdownPersonnages.options.Clear(); dropdownPersonnages.AddOptions(PersonnageGestion.RetournerPersonnages_String()); if (dropdownPersonnages.options.Count == 0) { dropdownPersonnages.captionText.text = "Aucun Personnage disponible !"; } // Dropdown Rôle dropdownRoles.options.Clear(); dropdownRoles.AddOptions(RoleGestion.RetournerRole_String()); if (dropdownRoles.options.Count == 0) { dropdownRoles.captionText.text = "Aucun Rôle disponible !"; } // Test Partie partie = new Partie(); partie.joueurs.Add(new Joueur(J1, new Personnage_BartCassidy(), new Role_Sherif())); partie.joueurs.Add(new Joueur(J2, new Personnage_BlackJack(), new Role_Renegat())); partie.joueurs.Add(new Joueur(J3, new Personnage_BlackJack(), new Role_HorsLaLoi())); partie.TrouverJoueur(J2).main.Add(new Carte_Effet_Bang()); partie.TrouverJoueur(J2).main.Add(new Carte_Arme()); SetText(); // Test Automatisation dropdownJoueurActif.options.Clear(); dropdownJoueurCible.options.Clear(); dropdownJoueurActif.AddOptions(new List <string>() { J1, J2, J3 }); dropdownJoueurCible.AddOptions(new List <string>() { J1, J2, J3 }); }