private void InitializeDifficultyDropdown() { GameObject dropdownGameObject = GameObject.FindGameObjectsWithTag(TagConstants.TAG_NAME_PLAYER_PANEL_DIFFICULTY_DROPDOWN) .Where(dropdown => dropdown.transform.parent.gameObject == this.gameObject).First(); Dropdown dropdownComponent = dropdownGameObject.GetComponent <Dropdown>(); dropdownComponent.ClearOptions(); List <string> optionList = new List <string> { DifficultyConstant.EASY_MODE, DifficultyConstant.NORMAL_MODE }; dropdownComponent.AddOptions(optionList); dropdownComponent .onValueChanged .AddListener(delegate { this.AffectDifficulty(dropdownComponent); }); ApplicationUtils.AffectDifficulty(this.OwnerId, optionList.First()); }
private void AffectDifficulty(Dropdown currentDropdown) { ApplicationUtils.AffectDifficulty(this.OwnerId, currentDropdown.options[currentDropdown.value].text); }