示例#1
0
    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();
    }
示例#2
0
    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();
    }
示例#4
0
    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;
    }
示例#5
0
    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();
    }
示例#6
0
    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();
    }
示例#7
0
    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();
    }
示例#8
0
    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;
    }
示例#10
0
    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);
    }
示例#11
0
    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;
    }
示例#12
0
    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;
    }
示例#13
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();
    }
示例#14
0
    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();
    }
示例#15
0
    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();
    }
示例#16
0
    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();
    }
示例#17
0
    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();
    }
示例#19
0
    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);
    }
示例#20
0
    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);
    }
示例#21
0
    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();
    }
    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();
    }
示例#23
0
    internal void BindTo(ObservableProperty property)
    {
        bindTarget            = property;
        bindTarget.OnChanged += BindTarget_OnChanged;
        bool wholeNumbers = property.Value.GetType() == typeof(int);

        if (property.Choices != null)
        {
            dropdown.ClearOptions();
            dropdown.AddOptions(property.Choices.ToList());
        }

        BindTarget_OnChanged(bindTarget, null);

        //var propertyType = property.Value.GetType();
        //if (propertyType.IsEnum)
        //{
        //    dropdown.ClearOptions();
        //    dropdown.AddOptions(propertyType.GetEnumNames().ToList());
        //}

        //slider.minValue = System.Convert.ToSingle(property.Min);
        //slider.maxValue = System.Convert.ToSingle(property.Max);
        //slider.wholeNumbers = wholeNumbers;
        //if (wholeNumbers)
        //    slider.value = (int)bindTarget.Value;
        //else
        //    slider.value = (float)bindTarget.Value;
    }
示例#24
0
    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();
    }
示例#25
0
    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());
    }
示例#26
0
    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();
    }
示例#27
0
    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;
    }
示例#28
0
    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();
    }
示例#29
0
    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();
    }
示例#30
0
    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);
    }