/* * public override void Interact() { * base.Interact(); * interacting = true; * //inputField.ActivateInputField(); * dropDown.Show(); * } */ public override void UpButton() { base.UpButton(); if (dropDown.value > 0) { dropDown.value--; dropDown.RefreshShownValue(); dropDown.Hide(); dropDown.Show(); ScrollToCurrentItem(); } }
void PopulateDropdown(TMP_Dropdown dropdown, List <Guid> optionsList) { string currentVal = dropdown.options[dropdown.value].text; //Debug.Log("current " + currentVal); List <string> options = new List <string>() { "None" }; int match = String.Equals("None", currentVal) ? 0 : -1; for (int i = 0; i < optionsList.Count; i++) { string newString = optionsList[i].ToString(); options.Add(newString); if (String.Equals(newString, currentVal)) { match = i + 1; } } dropdown.ClearOptions(); dropdown.AddOptions(options); dropdown.value = match; if (match == -1) { dropdown.Show(); } }
public void UpdateSelectablesMenu(string position, ObjectsLoader.RoomObject[] optionsIn, Action <int> callback) { //Initialise the Text to say the value of position //selectablesText.text = position; selectableObjects = optionsIn; SelectablesDropOptions.Clear(); foreach (ObjectsLoader.RoomObject s in optionsIn) { Debug.Log(s.type); SelectablesDropOptions.Add(s.type); } //Fetch the Dropdown GameObject the script is attached to selectablesDropdown = GetComponent <TMP_Dropdown>(); //Clear the old options of the Dropdown menu selectablesDropdown.ClearOptions(); //Add the options created in the List above selectablesDropdown.AddOptions(SelectablesDropOptions); // makes fake option selectablesDropdown.options.Add(new TMP_Dropdown.OptionData() { text = "" }); // selects fake option selectablesDropdown.value = selectablesDropdown.GetComponent <TMP_Dropdown>().options.Count - 1; // removes fake option selectablesDropdown.options.RemoveAt(selectablesDropdown.options.Count - 1); //Add listener for when the value of the Dropdown changes, to take action selectablesDropdown.onValueChanged.AddListener(delegate { DropdownValueChanged(selectablesDropdown, callback); }); selectablesDropdown.Show(); }
private void ShowDisplay() { dropdownAttackSkill.gameObject.SetActive(true); dropdownSupportSkill.gameObject.SetActive(true); attackSkillList = new List <string>() { "None" }; supportSkillList = new List <string>() { "None" }; attackSkills = new Dictionary <int, AttackSkill>(); supportSkills = new Dictionary <int, SupportSkill>(); int indexAttack = 1; int indexSupport = 1; for (int i = 0; i < Referee.Instance.CritterPlayer.MoveSet.Length; i++) { if (Referee.Instance.CritterPlayer.MoveSet[i] is AttackSkill) { AttackSkill skill = Referee.Instance.CritterPlayer.MoveSet[i] as AttackSkill; attackSkillList.Add(skill.name); attackSkills.Add(indexAttack++, skill); } else { SupportSkill skill = Referee.Instance.CritterPlayer.MoveSet[i] as SupportSkill; supportSkillList.Add(skill.name); supportSkills.Add(indexSupport++, skill); } } dropdownAttackSkill.AddOptions(attackSkillList); if (attackSkillList.Count <= 1) { dropdownAttackSkill.gameObject.SetActive(false); } else { dropdownAttackSkill.Show(); } dropdownSupportSkill.AddOptions(supportSkillList); if (supportSkillList.Count <= 1) { dropdownSupportSkill.gameObject.SetActive(false); } else { dropdownSupportSkill.Show(); } }
public override void OnSubmit(BaseEventData eventData) { base.OnSubmit(eventData); dropdown.Select(); dropdown.Show(); }
public void ClickDropdownMenu(TMP_Dropdown dropdown) { gameManager.GameState = GameState.DropdownMenu; dropdown.Show(); }