// Start is called before the first frame update void Start() { roundsSelectorDropdown.ClearOptions(); roundsSelectorDropdown.AddOptions(roundCountOptions.Select(o => new TMP_Dropdown.OptionData(o.ToString())).ToList()); RoundsCount = roundCountOptions[0]; }
private void Awake() { var array = Enum.GetValues(typeof(MidiSendType)); var list = (from object item in array select item.ToString()).ToList(); midiTypeDropdown.ClearOptions(); midiTypeDropdown.AddOptions(list); }
private void Awake() { Dropdown.ClearOptions(); string[] enumstring = Enum.GetNames(typeof(ItemSortType)); List <string> m_enum = new List <string>(enumstring); Dropdown.AddOptions(m_enum); }
private void Start() { colorDD.ClearOptions(); List <string> colors = StatesColorExtends.ToList(); colorDD.AddOptions(colors); colorDD.SetValueWithoutNotify((int)states.color); }
private void InitializeDropdown() { _intervalList = new List <int>(); if (dropdownInterval) { dropdownInterval.ClearOptions(); var dt = Time.fixedDeltaTime; float dt_inv = 1.0f / dt; var elem_list = new List <float>(); elem_list.Add(0.1f); // 1/10 elem_list.Add(0.2f); // 1/5 elem_list.Add(0.5f); // 1/2 elem_list.Add(1.0f); // 1/1 elem_list.Add(1.5f); // 2/1 elem_list.Add(2.0f); // 2/1 int default_index = 0; var drop_menu = new List <string>(); foreach (var t in elem_list) { _intervalList.Add((int)Math.Round(t * dt_inv)); if (t == 0.5f) { default_index = drop_menu.Count; } drop_menu.Add(t.ToString() + " [s]"); } dropdownInterval.AddOptions(drop_menu); dropdownInterval.value = default_index; } _widthList = new List <int>(); _widthList.Add(0); _widthList.Add(1); _widthList.Add(2); _widthList.Add(3); _widthList.Add(4); _widthList.Add(5); if (dropdownWidth) { dropdownWidth.ClearOptions(); var drop_menu = new List <string>(); foreach (var w in _widthList) { drop_menu.Add(w.ToString()); } dropdownWidth.AddOptions(drop_menu); dropdownWidth.value = 1; } }
private void StartingSettings() { if (PlayerPrefs.HasKey(MODEL_DETAILS)) { modelDetailsDropdown.value = PlayerPrefs.GetInt(MODEL_DETAILS); } if (PlayerPrefs.HasKey(CAMERA_MODE)) { cameraDropdown.value = PlayerPrefs.GetInt(CAMERA_MODE); } if (PlayerPrefs.HasKey(VOLUME)) { volumeSlider.value = PlayerPrefs.GetFloat(VOLUME); } if (Screen.fullScreen == true) { if (PlayerPrefs.GetInt(LANGUAGE) == 0) { fullscreenButtonText.text = "Window mode"; } else if (PlayerPrefs.GetInt(LANGUAGE) == 1) { fullscreenButtonText.text = "Modo Ventana"; } } else { if (PlayerPrefs.GetInt(LANGUAGE) == 0) { fullscreenButtonText.text = "FullScreen Mode"; } else if (PlayerPrefs.GetInt(LANGUAGE) == 1) { fullscreenButtonText.text = "Pantalla Completa"; } } 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); //dropdowns can't use arrays, so i make a list and iterate it. resolutionDropdown.value = currentResolutionIndex; resolutionDropdown.RefreshShownValue(); }
void Start() { GameController.Instance.LoadSettings(); if (GameController.Instance.UserSettings[UserSetting.VOLUME] as float? != null) { userVolume = (float)GameController.Instance.UserSettings[UserSetting.VOLUME]; volumeSlide.value = userVolume; SetVolume(userVolume); } if (GameController.Instance.UserSettings[UserSetting.QUALITY] as int? != null && (int)GameController.Instance.UserSettings[UserSetting.QUALITY] < QualitySettings.names.Length) { qualityIndex = (int)GameController.Instance.UserSettings[UserSetting.QUALITY]; qualityDrop.value = qualityIndex; SetQuality(qualityIndex); } else { qualityIndex = QualitySettings.GetQualityLevel(); qualityDrop.value = qualityIndex; SetQuality(qualityIndex); } if (GameController.Instance.UserSettings[UserSetting.FULLSCREEN] as bool? != null) { fullscreen = (bool)GameController.Instance.UserSettings[UserSetting.FULLSCREEN]; flexiFullscreen.GetComponent <Toggle>().isOn = fullscreen; SetFullScreen(fullscreen); } resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); List <string> resStrings = new List <string>(); for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + "x" + resolutions[i].height; //Using as Resolution? let's it be cast to null if a garbage value is in the user setting if ((GameController.Instance.UserSettings[UserSetting.RESOLUTION] as Resolution?) != null && ((Resolution)GameController.Instance.UserSettings[UserSetting.RESOLUTION]).width == resolutions[i].width && ((Resolution)GameController.Instance.UserSettings[UserSetting.RESOLUTION]).height == resolutions[i].height) { selectedRes = i; resolution = resolutions[i]; } resStrings.Add(option); } resolutionDropdown.AddOptions(resStrings); resolutionDropdown.value = selectedRes; }
private void InitGraphicsQuality() { string[] qualityNames = QualitySettings.names; graphicsQualityDropdown.ClearOptions(); graphicsQualityDropdown.AddOptions(new List <string>(qualityNames)); graphicsQualityDropdown.value = QualitySettings.GetQualityLevel(); graphicsQualityDropdown.RefreshShownValue(); }
// Use this for initialization void Start() { business = player.business; for (short x = 0; x < business.employeesInfo.Count; x++) { newEmployee(business.employeesInfo[x].name, x, business.employeesInfo[x].workingIn); } currentlySelected = -1; //set up the diffrent displayes businessInfo[0].SetText(business.servingName); businessInfo[1].SetText(business.customerServed.ToString()); businessInfo[2].SetText(getWage(player.playerEmployee.wage)); businessInfo[3].SetText(business.happiness + "%"); businessInfo[4].SetText(player.percentEffect + "%"); for (short x = 0; x < 4; x++) { business.workStations[x].progressText = workInfo[x]; upDateAmount(x, null); if (business.workStations[x].type == 2 || business.workStations[x].type == 3) { needsCustomers = x; } } upDateTitles(); //set up the work background runDropdown.ClearOptions(); List <string> options = new List <string>(); for (int x = 0; x < 4; x++) { options.Add(business.workStations[x].name); } runDropdown.AddOptions(options); runDropdown.value = player.playerEmployee.workingIn; runDropdown.RefreshShownValue(); businessInfo[5].SetText("0:00 AM"); timeAm_Pm = false; timeAmount = 0; foreach (menuIteams menuIteam in business.businessList[0].menuIteams) { menuIteam.ingredientsList = new ingredients[menuIteam.ingredients.Length]; for (short x = 0; x < menuIteam.ingredients.Length; x++) { foreach (ingredients ingredient in business.ingredientList) { if (ingredient.name == menuIteam.ingredients[x]) { menuIteam.ingredientsList[x] = ingredient; } } } } }
void Awake() { m_LocalizerDropdown.ClearOptions(); m_LocalizerDropdown.AddOptions(new List <string>() { "v1.10", "v1.11" }); m_LocalizerDropdown.SetValueWithoutNotify(localizer); }
public void setup() { dropdown.ClearOptions(); dropdown.AddOptions(new List <string>() { "" }); dropdown.AddOptions(DeckUtilities.getAllDeckNames()); }
private void InitResolution() { screenResolutions = Screen.resolutions.Where(resolution => resolution.refreshRate == 60).Reverse().ToArray(); screenResolutionDropdown.ClearOptions(); var options = screenResolutions.Select(resolution => new TMP_Dropdown.OptionData(resolution.ToString())) .ToList(); screenResolutionDropdown.AddOptions(options); }
private IEnumerator UpdateLanguage() { yield return(new WaitForSecondsRealtime(1f)); m_languageDropdown.ClearOptions(); PopulateLanguages(); m_languageDropdown.RefreshShownValue(); }
// Load Decks in the DropDown public void LoadDecks() { // Clear Dropdown deckPicker.ClearOptions(); List <TMP_Dropdown.OptionData> decks_list_drop = new List <TMP_Dropdown.OptionData>(); List <string> deck_paths_list; switch (deckController.my_deck.Faction) { case "NR": deck_paths_list = deckController.NRDecks; break; case "NF": deck_paths_list = deckController.NFDecks; break; case "SC": deck_paths_list = deckController.SCDecks; break; case "M": deck_paths_list = deckController.MDecks; break; default: deck_paths_list = deckController.NRDecks; break; } myDecks.Clear(); myPaths.Clear(); // Add decks to options and to global deck list foreach (string path in deck_paths_list) { Deck auxdeck = deckController.LoadDeckFromPath(path); TMP_Dropdown.OptionData dropItem = new TMP_Dropdown.OptionData(auxdeck.Name); myDecks.Add(auxdeck); myPaths.Add(path); decks_list_drop.Add(dropItem); } deckPicker.AddOptions(decks_list_drop); // Reload the first deck just in case if (deck_paths_list.Count > 0) { deckCollection.OnDeckChange(myDecks[0], myPaths[0]); } else { // Clear the collection (my_deck is empty at this point: Cleared from UpdateSelectedFaction) deckCollection.OnDeckChange(deckController.my_deck, Path.Combine(Application.streamingAssetsPath, "__empty__.json")); } InitializeDeck(); }
public void ClearDropDown() { dropdown.ClearOptions(); List <string> temp = new List <string> (); temp.Add("Other"); dropdown.AddOptions(temp); dropdown.value = 0; }
// Start is called before the first frame update void Awake() { emptyOption = new List <string> { "----------Select A File----------" }; previousSaves.ClearOptions(); previousSaves.AddOptions(emptyOption); oldFileNames = DatabaseManager.GetPreviousSaveNames(); if (oldFileNames.Count > 0) { previousSaves.AddOptions(oldFileNames); } else { previousSaves.options[0].text = "No Previous Save Files"; } }
public void OpenLocationListMenu() { searchingPanel.SetActive(true); if (locationsNamesList.options.Count < MapScript.Instance.LocationsList.Length) { locationsNamesList.ClearOptions(); locationsNamesList.AddOptions(MapScript.Instance.LocationNames); } }
private void PrepQuality() { _qualities = QualitySettings.names; QualityDropdown.ClearOptions(); QualityDropdown.AddOptions(_qualities.ToList()); QualityDropdown.value = QualitySettings.GetQualityLevel(); QualityDropdown.RefreshShownValue(); }
// Start is called before the first frame update void Awake() { //Initiate form to fit current settings _fullscreenToggle.isOn = Screen.fullScreen; _tutorialToggle.isOn = InterScene.toggleTutorial; float volMasterValue; float volMusicValue; float volSoundEffectValue; bool volMaster = _mixer.GetFloat("VolMaster", out volMasterValue); bool volMusic = _mixer.GetFloat("VolMusic", out volMusicValue); bool volSoundEffect = _mixer.GetFloat("VolSoundEffect", out volSoundEffectValue); //Set sound to saved sound file for each channel if (volMaster) { _masterVolumeSlider.value = volumeDBToPercent(volMasterValue); } else { volMasterValue = 100; } if (volMusic) { _musicVolumeSlider.value = volumeDBToPercent(volMusicValue); } else { volMusicValue = 100; } if (volSoundEffect) { _soundEffectVolumeSlider.value = volumeDBToPercent(volSoundEffectValue); } else { volSoundEffectValue = 100; } int currentResolution = 0; resolutions = Screen.resolutions; List <string> options = new List <string>(); //Initiate possible resolutions for the dropdown for (int i = 0; i < resolutions.Length; i++) { options.Add(resolutions[i].width + " X " + resolutions[i].height + " @" + resolutions[i].refreshRate + "Hz"); if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height) { currentResolution = i; } } _resolutionDropdown.ClearOptions(); _resolutionDropdown.AddOptions(options); _resolutionDropdown.value = currentResolution; }
private static void InitializeDropdown(TMP_Dropdown dropdown, List <string> options, int value, UnityAction <int> onChange) { dropdown.ClearOptions(); dropdown.AddOptions(options); dropdown.RefreshShownValue(); dropdown.value = value; dropdown.onValueChanged.AddListener(onChange); }
private void OnValidate() { if (data != null) { name = data.name; dropdown.ClearOptions(); dropdown.AddOptions(new List <string>(data.names)); } }
public override void Setup() { base.Setup(); RepeatDropDown.ClearOptions(); var options = Enum.GetNames(typeof(ERepeatType)).ToList(); RepeatDropDown.AddOptions(options); RepeatDropDown.RefreshShownValue(); }
void Start() { if (AudioManager.Instance != null) { 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 Start() { resolutions = Screen.resolutions; resolutionDropdown.ClearOptions(); 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); //Si no hay resolución guardada se pone por defecto en 1920 x 1080 if (!PlayerPrefs.HasKey(AppPlayerPrefKeys.RESOLUTION) && resolutions[i].width == 1920 && resolutions[i].height == 1080) { PlayerPrefs.SetInt(AppPlayerPrefKeys.RESOLUTION, i); } } resolutionDropdown.AddOptions(options); resolutionDropdown.value = PlayerPrefs.GetInt(AppPlayerPrefKeys.RESOLUTION); resolutionDropdown.RefreshShownValue(); //Si no hay ajuste guardado se pone por defecto en fullscreen if (!PlayerPrefs.HasKey(AppPlayerPrefKeys.FULLSCREEN)) { SetFullScreen(true); } else { if (PlayerPrefs.GetInt(AppPlayerPrefKeys.FULLSCREEN) == 0) { SetFullScreen(false); } else { SetFullScreen(true); } } //Valores iniciales calidad if (PlayerPrefs.HasKey(AppPlayerPrefKeys.QUALITY_LEVEL)) { SetQuality(5); } else { SetQuality(PlayerPrefs.GetInt(AppPlayerPrefKeys.QUALITY_LEVEL)); } //Valores iniciales de slider musicSlider.value = Mathf.Clamp(SoundManager.Instance.MusicVolume, 0, 1); sFXSlider.value = Mathf.Clamp(SoundManager.Instance.SfxVolume, 0, 1); }
// run when options is enabled to initialize menu values public void OnOptions() { // get all variables to adjust TMP_Dropdown resolutionDropdownObject = GameObject.Find("ResolutionDropdown").GetComponent <TMP_Dropdown>(); Toggle fullscreenToggleObject = GameObject.Find("FullscreenToggle").GetComponent <Toggle>(); TMP_Dropdown qualityObject = GameObject.Find("GraphicsQualityDropdown").GetComponent <TMP_Dropdown>(); Slider volumeSliderObject = GameObject.Find("VolumeSlider").GetComponent <Slider>(); // set default volume to 30 before checking to get volume float vol = -30; aMixer.GetFloat("volume", out vol); // fill in resolution dropdown Resolution[] resolutions = Screen.resolutions; resOptions = new List <string>(); string screenRes = Screen.width + " x " + Screen.height; // create strings for dropdown for (int i = 0; i < resolutions.Length; i++) { string option = resolutions[i].width + " x " + resolutions[i].height; resOptions.Add(option); } // delete duplicates created in build mode for (int i = 0; i < resOptions.Count; i++) { for (int j = 0; j < resOptions.Count; j++) { if (resOptions[i] == resOptions[j] && i != j) { resOptions.Remove(resOptions[i]); } } } // clear list resolutionDropdownObject.ClearOptions(); // re-fill resolutionDropdownObject.AddOptions(resOptions); // adjust menu items accordingly for (int i = 0; i < resOptions.Count; i++) { if (screenRes == resOptions[i]) { resolutionDropdownObject.value = i; } } fullscreenToggleObject.isOn = Screen.fullScreen; qualityObject.value = QualitySettings.GetQualityLevel(); volumeSliderObject.value = vol; }
void Start() { availableResolutions.ClearOptions(); availableQualities.ClearOptions(); string t = ""; resolutions = Screen.resolutions; qualities = QualitySettings.names; afps = GameObject.FindWithTag("FPSCounter"); foreach (Resolution res in resolutions) { t = res.width.ToString() + 'x' + res.height.ToString(); availableResolutions.options.Add(new TMP_Dropdown.OptionData() { text = t }); } foreach (string i in qualities) { availableQualities.options.Add(new TMP_Dropdown.OptionData() { text = i }); } foreach (GameObject g in tabs) { g.GetComponent <Image>().color = new Color(100, 100, 100, 255); RectTransform rt = g.GetComponentInParent <RectTransform>(); //get the parent rectangle if (rt.GetSiblingIndex() == -1) //if the sibling index is -1, it was the last tab clicked { g.GetComponent <Image>().color = new Color(140, 140, 140, 255); } } availableResolutions.value = 1; availableQualities.value = 1; fullscreenToggle.enabled = false; fpsCounter.enabled = true; afps.SetActive(true); DontDestroyOnLoad(afps); //action listeners availableQualities.onValueChanged.AddListener(delegate { changeGraphicsQuality(availableQualities.value); }); availableResolutions.onValueChanged.AddListener(delegate { changeResolutionQualtiy(availableResolutions.value); }); //check for past saved settings checkForPlayerPref(); }
public void SetupAttackScreen() { if (pm == null) { pm = PlayerManager.instance; } //set attacker name attackerName.text = pm.currentLord.lordName; //set winner message to nothing winnerMessage.text = ""; acceptButton.onClick.RemoveAllListeners(); victoryContinueButton.onClick.RemoveAllListeners(); //set up accept buttons acceptButton.onClick.AddListener(BattleAccepted); victoryContinueButton.onClick.AddListener(VictoryContinueButton); //set up the attacker's info attackerArmies.text = "Armies: " + pm.currentLord.GetArmies(); attackerMessage.text = "Risks Losing:\n" + pm.currentLord.GetLandCount() / 2 + " Land"; //set up the dropdown defenderDropdown.onValueChanged.RemoveAllListeners(); defenderDropdown.value = 0; defenderDropdown.onValueChanged.AddListener(delegate { DefenderDropdownHandler(defenderDropdown); }); defenderDropdown.RefreshShownValue(); //give dropdown it's values defenderDropdown.ClearOptions(); List <string> lordNames = new List <string>(); foreach (AILord lord in pm.GetAILords()) { if (lord.GetLandCount() > 0) { lordNames.Add(lord.lordName); } } foreach (Player lord in pm.GetPlayers()) { if (lord.GetLandCount() > 0 && lord != pm.currentLord) { lordNames.Add(lord.lordName); } } defenderDropdown.AddOptions(lordNames); currentLordSelected = findDefenderLord(defenderDropdown); ResetDefenderMessages(); }
private void Start() { platformIndicator.OnPlatformSet.AddListener(OnPlatformUpdated); //platformIndicator.OnPlatformSetEnum.AddListener(OnPlatformUpdated); platformDropdown.ClearOptions(); platformDropdown.AddOptions(PlatformIndicator.platforms); platformDropdown.onValueChanged.AddListener(UpdatePlatformManually); platformDropdown.value = PlatformIndicator.platforms.FindIndex(p => p.Contains(Application.platform.ToString())); }
void checkMatchNumberInput(string value) { if (value == "" || value.Length > 5) { value = "0"; // So that it still goes through the dropdown disbaling logic } int matchNumber = Int32.Parse(value); if (0 < matchNumber && matchNumber <= Constants.matchTeams.Length) { matchNumber--; // 0-index it List <string> teamOptions = new List <string>(); foreach (int teamNumber in Constants.matchTeams[matchNumber]) { teamOptions.Add(teamNumber.ToString()); } teamDropdown.ClearOptions(); teamDropdown.AddOptions(teamOptions); teamDropdown.interactable = true; leftStartButton.interactable = true; rightStartButton.interactable = true; if (Constants.roleIndex == 0) { Variables.currentMatch = new MatchData(); Variables.currentMatch.matchNumber = matchNumber + 1; } else { Variables.currentLocation = new LocationData(); Variables.currentLocation.matchNumber = matchNumber + 1; } } else { teamDropdown.ClearOptions(); teamDropdown.interactable = false; leftStartButton.interactable = false; rightStartButton.interactable = false; } }
/// <summary> /// Add a new row to the collection of <see cref="buildDebugRow"/> instances. /// </summary> /// <param name="title">Title shown prior to the value, also used to make sure the row is unique.</param> /// <returns></returns> private GameObject AddNewRow(string title) { GameObject newDebugRow = Instantiate(buildDebugRow, listOfDebugLines.transform); debugLines.Add(title, newDebugRow); debugDropdown.ClearOptions(); debugDropdown.AddOptions(new List <string>(debugLines.Keys)); newDebugRow.SetActive(false); return(newDebugRow); }