public void SetToEnable(bool enable) { if (enable) { RefreshList(); } else { dropDownList.ClearOptions(); } }
void UpdateResolutions() //TODO: OnResolutionChange event to refresh list for supporting dynamic screen swithing? { var availableResolutions = Screen.resolutions; List <string> options = new List <string>(); int currentResIndex = 0; var currentRes = new Vector2Int(Screen.width, Screen.height); for (int i = 0, len = availableResolutions.Length; i < len; i++) { var tempRes = new Vector2Int(availableResolutions[i].width, availableResolutions[i].height); if (!resolutions.Contains(tempRes)) { resolutions.Add(tempRes); options.Add(tempRes.x + separator + tempRes.y); if (tempRes.Equals(currentRes)) { currentResIndex = resolutions.Count - 1; //Can't use i as index since a new list is built from the original } } } dropdown.ClearOptions(); dropdown.AddOptions(options); dropdown.value = currentResIndex; dropdown.RefreshShownValue(); }
private void RefreshValues() { dropdown.onValueChanged.RemoveListener(OnDropdownValueChanged); dropdown.ClearOptions(); pfxIdValues.Clear(); List <TMPro.TMP_Dropdown.OptionData> data = new List <TMPro.TMP_Dropdown.OptionData>(); data.Add(new TMPro.TMP_Dropdown.OptionData("(none)")); pfxIdValues.Add(null); foreach (ParticleEffectListing listing in pfxSystem.ListAll()) { data.Add(new TMPro.TMP_Dropdown.OptionData(listing.name)); pfxIdValues.Add(listing.id); } dropdown.options = data; string pfxId = (string)editor.data; int index = pfxIdValues.IndexOf(pfxId); if (index < 0) { dropdown.value = 0; } dropdown.onValueChanged.AddListener(OnDropdownValueChanged); }
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() { resolutionsDropdown.ClearOptions(); List <string> resolutionOptions = new List <string>(); int currentResolutionIndex = 0; for (int i = 0; i < resolutions.GetLength(0); i++) { if (resolutions[i, 0] <= Screen.resolutions[Screen.resolutions.Length - 1].width && resolutions[i, 1] <= Screen.resolutions[Screen.resolutions.Length - 1].height) { resolutionOptions.Add(resolutions[i, 0] + " x " + resolutions[i, 1]); if (resolutions[i, 0] == GameManager.instance.gsDataCurrent.resolutionWidth && resolutions[i, 1] == GameManager.instance.gsDataCurrent.resolutionHeight) { currentResolutionIndex = i; } } else { break; } } resolutionsDropdown.AddOptions(resolutionOptions); resolutionsDropdown.value = currentResolutionIndex; resolutionsDropdown.RefreshShownValue(); }
private void UpdateCharactersDropDown() { CharacterPreviewDropdown.ClearOptions(); var itemOptions = PlayerCharacters.Select(pcd => pcd.Name).ToList(); CharacterPreviewDropdown.AddOptions(itemOptions); CharacterPreviewDropdown.onValueChanged.RemoveAllListeners(); CharacterPreviewDropdown.onValueChanged.AddListener(ItemChange); }
protected override void InitializeInternal() { _allSubdivisions = Subdivision.GetAll(); List <string> optionNames = _allSubdivisions.Select( subdivision => string.Format("{0} ({1})", subdivision.Name, subdivision.Description) ).ToList(); SubdivisionDropdown.ClearOptions(); SubdivisionDropdown.AddOptions(optionNames); SubdivisionDropdown.SetValueWithoutNotify(DEFAULT_INDEX); UpdateCurrentSubdivision(DEFAULT_INDEX); }
void Awake() { #if TMP_PRESENT dropdown = GetComponent <TMPro.TMP_Dropdown>(); #else dropdown = GetComponent <UnityEngine.UI.Dropdown>(); #endif dropdown.ClearOptions(); dropdown.AddOptions(new List <string>(QualitySettings.names)); //Convert names array to List and add it to the dropdown dropdown.value = QualitySettings.GetQualityLevel(); dropdown.RefreshShownValue(); dropdown.onValueChanged.AddListener((int _) => OnValueChange(_)); //UI classes use Unity events, requiring delegates (delegate() { OnValueChange(); }) or lambda expressions (() => OnValueChange()). Listeners are not persistent, so no need to unsub }
private void RefreshResolutionDropdown() { if (PlayerPrefs.HasKey(resolutionPrefsKey)) { SetResolutionIndex(PlayerPrefs.GetInt(resolutionPrefsKey)); } RefreshResolutionDropdownItems(); resolutionDropdown.ClearOptions(); resolutionDropdown.AddOptions(resolutionDropdownItems); var dropdownIndex = GetResolutionIndex(); resolutionDropdown.value = dropdownIndex; resolutionDropdown.captionText.text = resolutionDropdownItems[dropdownIndex]; }
void Start() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> options = new List <string>(); for (int i = 0; i < resolutions.Length; i++) //Convertir le tableau en liste { string option = resolutions[i].width + " x " + resolutions[i].height; options.Add(option); } resolutionDropdown.AddOptions(options); }
public void SetTarget(UpgradeValidator validator) { label.text = validator.ValidatorType.ToString(); image.sprite = validator.CurrentObject.GetComponent <SpriteRenderer>().sprite; this.validator = validator; dropdown.ClearOptions(); int i = 0; foreach (var item in validator.ObjectSettings) { var text = validator.ValidatorType.ToString() + " " + i++; var optionData = new TMPro.TMP_Dropdown.OptionData(text); dropdown.onValueChanged.AddListener(UpdateSelection); dropdown.options.Add(optionData); } }
private void RefreshGraphicsQualityDropdown() { if (PlayerPrefs.HasKey(graphicsQualityPrefsKey)) { SetGraphicsQualityIndex(PlayerPrefs.GetInt(graphicsQualityPrefsKey)); } else { SetGraphicsQualityIndex(QualitySettings.GetQualityLevel()); } var list = new List <string>(QualitySettings.names); graphicsQualityDropdown.ClearOptions(); graphicsQualityDropdown.AddOptions(list); var index = GetGraphicsQualityIndex(); graphicsQualityDropdown.value = index; graphicsQualityDropdown.captionText.text = list[index]; SelectNextFrame(graphicsQualityDropdown); }
void RefreshVSyncDropdown() { if (PlayerPrefs.HasKey(vSyncPrefsKey)) { SetVSyncIndex(PlayerPrefs.GetInt(vSyncPrefsKey)); } else { SetVSyncIndex(QualitySettings.vSyncCount); } var list = new List <string>() { "Unlocked", "VSync1", "VSync2" }; vSyncDropdown.ClearOptions(); vSyncDropdown.AddOptions(list); var index = GetVSyncIndex(); vSyncDropdown.value = index; vSyncDropdown.captionText.text = list[index]; SelectNextFrame(vSyncDropdown); }
void UpdateResolutions() //TODO: OnResolutionChange event to refresh list for supporting dynamic screen swithing? { resolutions = Screen.resolutions; List <string> options = new List <string>(); int currentResIndex = 0; Resolution currentRes = Screen.currentResolution; //Fetching refreshrate currentRes.width = Screen.width; //Overwrite width/height with screen values to get correct values in Windowed mode currentRes.height = Screen.height; for (int i = 0, len = resolutions.Length; i < len; i++) { options.Add(resolutions[i].ToString()); if (resolutions[i].Equals(currentRes)) { currentResIndex = i; } } dropdown.ClearOptions(); dropdown.AddOptions(options); dropdown.value = currentResIndex; dropdown.RefreshShownValue(); }
private void Awake() { dropDownList.ClearOptions(); resolutions = new List <Resolution>(); }
private void Start() { _dropdown.ClearOptions(); _dropdown.AddOptions(QualitySettings.names.ToList()); _dropdown.value = QualitySettings.GetQualityLevel(); }
public void SetAllowedValues(BehaviorProperties.EnumAllowedValue[] allowedValues) { this.allowedValues = allowedValues; dropdown.ClearOptions(); dropdown.AddOptions((from v in allowedValues select v.label).ToList()); }