private void MakeEffectTypePicker() { VisualElement effectPickerContainer = root.Query <VisualElement>("effect-picker-container").First(); effectDropDown = new PopupField <Type>("Effect Type", EffectTypes, 0, (Type t) => t.Name, (Type t) => t.Name); SelectedType = effectDropDown.value; effectDropDown.RegisterValueChangedCallback(ChangeSelectedType); Button addbuton = new Button(AddEffect) { text = "Add" }; effectDropDown.Add(addbuton); effectPickerContainer.Add(effectDropDown); }
private void MakeEffectTypePicker() { VisualElement effectPickerContainer = root.Query <VisualElement>("effect-picker-container").First(); if (EffectTypes.Count == 0) { effectPickerContainer.Add(CustomVisalElements.HelpBox("Your project does not define any effect types.")); return; } effectDropDown = new PopupField <Type>("Effect Type", EffectTypes, 0, (Type t) => t.Name, (Type t) => t.Name); SelectedEffectType = effectDropDown.value; effectDropDown.RegisterValueChangedCallback(ChangeSelectedEffectType); Button addbuton = new Button(() => Add(EffectsProperty, EffectTypes, _effectStirngParams, SelectedEffectType, false)) { text = "Add" }; effectDropDown.Add(addbuton); effectPickerContainer.Add(effectDropDown); }
private void MakeCostTypePicker() { VisualElement costPickerContainer = root.Query <VisualElement>("cost-picker-container").First(); if (CostTypes.Count == 0) { costPickerContainer.Add(CustomVisalElements.HelpBox("Your project does not define any cost types.")); return; } costDropDown = new PopupField <Type>("Cost Type", CostTypes, 0, (Type t) => t.Name, (Type t) => t.Name); SelectedCostType = costDropDown.value; costDropDown.RegisterValueChangedCallback(ChangeSelectedCostType); Button addbuton = new Button(() => Add(CostsProperty, CostTypes, _costStirngParams, SelectedCostType, true)) { text = "Add" }; costDropDown.Add(addbuton); costPickerContainer.Add(costDropDown); }