Example #1
0
        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();
        }
Example #2
0
        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();
        }
 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 UpdateCharactersDropDown()
        {
            CharacterPreviewDropdown.ClearOptions();
            var itemOptions = PlayerCharacters.Select(pcd => pcd.Name).ToList();

            CharacterPreviewDropdown.AddOptions(itemOptions);
            CharacterPreviewDropdown.onValueChanged.RemoveAllListeners();
            CharacterPreviewDropdown.onValueChanged.AddListener(ItemChange);
        }
        void Awake()
        {
            List <string> formattedResolutionNames = new List <string>();

            for (int i = 0; i < StaticComponent <VideoSettingsManager> .Instance.GetAllResolutions().Length; i++)
            {
                formattedResolutionNames.Add(FormatResolution(StaticComponent <VideoSettingsManager> .Instance.GetAllResolutions()[i].ToString()));
            }
            dropdown.AddOptions(formattedResolutionNames);
            dropdown.value = StaticComponent <VideoSettingsManager> .Instance.GetCurrentResolution();
        }
        void Awake()
        {
            string[] qualityNames = StaticComponent <VideoSettingsManager> .Instance.GetQualityNames();

            List <string> namesForDropdown = new List <string>();

            for (int i = 0; i < qualityNames.Length; i++)
            {
                namesForDropdown.Add(qualityNames[i]);
            }
            dropdown.AddOptions(namesForDropdown);
            dropdown.value = StaticComponent <VideoSettingsManager> .Instance.GetCurrentQualityLevel();
        }
Example #7
0
        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);
        }
Example #8
0
        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
        }
Example #9
0
        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];
        }
Example #10
0
        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);
        }
Example #11
0
        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);
        }
Example #12
0
        private void OnLocaleInitialized(UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle <LocalizationSettings> oper)
        {
            _locale.AddOptions(LocalizationSettings.AvailableLocales.Locales.Select(x => {
                var result      = x.Identifier.CultureInfo.NativeName;
                var firstLetter = Char.ToUpper(result[0]);
                result          = result.Remove(0, 1);
                result          = firstLetter + result;

                return(result);
            }).ToList());

            string currentLocaleCode = GlobalPreferences.Get <string>("current_locale", null);

            if (currentLocaleCode != null)
            {
                LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales.Find(x => x.Identifier.Code == currentLocaleCode);
            }

            LocalizationChanged(LocalizationSettings.SelectedLocale);
        }
Example #13
0
        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);
        }
Example #14
0
        protected override void Awake()
        {
            base.Awake();

            AddButton(UI.Legacy.PopUpButtonMask.Ok, OnOkClick);
            AddButton(UI.Legacy.PopUpButtonMask.Cancel, OnCancelClick);

            var resolutions            = new List <string>();
            int currentResolutionIndex = 0;
            var currentResolution      = Screen.currentResolution;

            for (int i = 0; i < Screen.resolutions.Length; i++)
            {
                var resolution = Screen.resolutions[i];
                resolutions.Add($"{resolution.width}x{resolution.height}");

                if (currentResolution.width == resolution.width && currentResolution.height == resolution.height)
                {
                    currentResolutionIndex = i;
                }
            }

            _resolutionDropdown.AddOptions(resolutions);
            _qualityDropdown.AddOptions(new List <string>(QualitySettings.names));

            _resolutionDropdown.value = currentResolutionIndex;
            _qualityDropdown.value    = QualitySettings.GetQualityLevel();

            _noFramerateLimitCheckbox.onValueChanged.AddListener(OnNoFramerateLimitValueChanged);
            _framerateLimitSlider.SetMinMax(Constants.MinimumManageableFramerate, Constants.MaximumManageableFramerate);

            _showLightEffectsCheckbox.onValueChanged.AddListener(OnShowLightEffectsValueChanged);
            _ambientLightSlider.SetMinMax(0, 100);

            RevertOptionsBack();
        }
        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();
        }
Example #16
0
 private void Start()
 {
     _dropdown.ClearOptions();
     _dropdown.AddOptions(QualitySettings.names.ToList());
     _dropdown.value = QualitySettings.GetQualityLevel();
 }
Example #17
0
 public void SetAllowedValues(BehaviorProperties.EnumAllowedValue[] allowedValues)
 {
     this.allowedValues = allowedValues;
     dropdown.ClearOptions();
     dropdown.AddOptions((from v in allowedValues select v.label).ToList());
 }