public void InitialState() { Clear(); questionText.text = "What would you like this card to do?\n\nChoose an effect from the list below to continue."; Dropdown(true, ReturnType.NONE); Input(false); List <string> options = EffectData.GetAllRootEffects() .Select(effect => effect.name).ToList(); dropdown.ClearOptions(); dropdown.AddOptions(options); }
public void Dropdown(bool active, ReturnType type = ReturnType.NONE) { dropdown.gameObject.SetActive(active); submitSelectionButton.gameObject.SetActive(active); // set appropriate dropdown options with ReturnType List <string> options; // handling for enums string typeString = type.ToString(); if (typeString.StartsWith("ENUM")) { EnumRepesentation enumRepesentation = EnumRepesentation.EnumLookup(typeString); options = enumRepesentation.getNames().ToList(); } else if (type == ReturnType.ROOT_EFFECT) { options = EffectData.GetAllRootEffects() .Select(effect => effect.name).ToList(); } else { options = EffectData.Effects .Where(effect => effect.returnType == type && effect.type != "primitive") .Select(effect => effect.name).ToList(); } // need to check all ancestors for potential placeholders dropdown.ClearOptions(); if (options.Count > 0) { dropdown.AddOptions(options); } else { dropdown.gameObject.SetActive(false); submitSelectionButton.gameObject.SetActive(false); } }