private void PopulateTags(bool isOpen) { Foldout tagsFoldout = rootVisualElement.Q <Foldout>("TagsFoldout"); tagsFoldout.SetValueWithoutNotify(isOpen); tagsFoldout.Clear(); ListView listView = CreateListViewForTags(); tagsFoldout.Add(listView); List <ScriptableTag> tags = ScriptableSettingsManager.Instance.Tags; for (int i = 0; i < tags.Count; i++) { Toggle toggle = new Toggle(); toggle.text = " " + tags[i].name; int index = i; toggle.RegisterValueChangedCallback(x => OnToggleTag(tags[index], x)); ContextualMenuManipulator manipulator = new ContextualMenuManipulator(x => { x.menu.AppendAction("Delete", y => DeleteTag(tags[index])); }) { target = toggle }; listView.Add(toggle); } listView.style.height = Mathf.Min(tags.Count * 20, 100); Button tagsAdd = rootVisualElement.Q <Button>("TagsAdd"); tagsAdd.clicked -= GoToCreateNewTag; tagsAdd.clicked += GoToCreateNewTag; }
protected override void DoDisplay() { m_StatusFoldOut = new Foldout { text = L10n.Tr("Status"), name = k_StatusFoldOutName, classList = { k_FoldoutClass } }; foreach (var status in k_Statuses) { var toggle = new Toggle(status) { name = status.ToLower(), classList = { k_ToggleClass } }; toggle.RegisterValueChangedCallback(evt => { if (evt.newValue) { foreach (var t in m_StatusFoldOut.Children().OfType <Toggle>()) { if (t == toggle) { continue; } t.SetValueWithoutNotify(false); } } UpdateFiltersIfNeeded(); }); m_StatusFoldOut.Add(toggle); } m_Container.Add(m_StatusFoldOut); }
private Foldout CreateSettingTagsFoldout(ref Foldout tagsFoldout, ScriptableObject value, bool isOpen) { if (tagsFoldout == null) { tagsFoldout = new Foldout(); } tagsFoldout.SetValueWithoutNotify(isOpen); tagsFoldout.Clear(); ListView listView = CreateListViewForTags(); tagsFoldout.Add(listView); List <ScriptableTag> tags = ScriptableSettingsManager.Instance.Tags; for (int j = 0; j < tags.Count; j++) { Toggle toggle = new Toggle { text = tags[j].name }; int index = j; toggle.SetValueWithoutNotify(tags[index].Elements.Contains(value)); toggle.RegisterValueChangedCallback(x => OnSettingsTagToggle(value, tags[index], x)); listView.Add(toggle); } listView.style.height = Mathf.Min(tags.Count * 20, 100); return(tagsFoldout); }
public override VisualElement CreatePropertyGUI(SerializedProperty property) { var container = new VisualElement(); var foldout = new Foldout { text = property.displayName }; var objField = new ObjectField("Reference") { objectType = typeof(Entity), allowSceneObjects = false }; var mValue = property.FindPropertyRelative("mValue"); if (mValue == null) { return(container); } objField.BindProperty(mValue); foldout.Add(new VariablePopup <SharedEntity>(property)); foldout.Add(objField); container.Add(foldout); return(container); }
private VisualElement CreateShaderProperties(ShaderProgramPerfInfo info) { Foldout fold = new Foldout(); fold.text = "Shader Property"; fold.name = "ShaderInfo"; var val = new string[2, 6]; val[0, 0] = "Has uniform computation"; val[0, 1] = "Has side-effects"; val[0, 2] = "Modifies coverage"; val[0, 3] = "Use late ZS test"; val[0, 4] = "Use late ZS update"; val[0, 5] = "Read color buffer"; val[1, 0] = info.hasUniformComputation.ToString(); val[1, 1] = info.hasSideEffects.ToString(); val[1, 2] = info.modifisCoverage.ToString(); val[1, 3] = info.useLateZSTest.ToString(); val[1, 4] = info.useLateZSUpdate.ToString(); val[1, 5] = info.readColorBuffer.ToString(); fold.Add(CreateTableView(val)); return(fold); }
public static Foldout Foldout <TProperty, TContainer, TValue>(TProperty property, ref TContainer container, ref TValue value, InspectorContext context, string name = null) where TProperty : IProperty <TContainer, TValue> { var hasTooltip = property.Attributes?.HasAttribute <TooltipAttribute>() ?? false; var propertyName = property.GetName(); var foldout = new Foldout { name = propertyName, text = name ?? propertyName, bindingPath = propertyName, tooltip = hasTooltip ? property.Attributes.GetAttribute <TooltipAttribute>().Tooltip : string.Empty, }; GuiConstructFactory.SetTooltip(property, foldout); if (!context.GetParent(out var parent)) { return(foldout); } if (property.IsContainer) { parent.Add(foldout); context.PushParent(foldout); } return(foldout); }
private void AddLinkChoiceUI(DialogueBranch branchA, DialogueBranch branchB, Foldout linksFoldout, int linkIndex) { if (linksFoldout == null) { Debug.LogError("AddLinkUI failed with null parent."); return; } if (branchB.id != branchA.id) { // add a link choice //linkPrefabVS.CloneTree(linkPrefab.parent); //Button linkButton = blockUI.Query("LinkPrefab").Last() as Button; Button linkButton = new Button(); linksFoldout.Query("unity-content").First().Add(linkButton); linkButton.text = "[" + branchB.id + "]"; if (linkButton != null) { int nextID = branchB.id; string nextSpeech = branchB.speech; linkButton.clicked += () => { OnLinkClicked(linksFoldout, dialogueDatam, branchA, linkIndex, nextID, nextSpeech); }; } } }
private VisualElement CreateFoldout(SerializedProperty property) { property = property.Copy(); var foldout = new Foldout() { text = property.localizedDisplayName }; foldout.value = property.isExpanded; foldout.bindingPath = property.propertyPath; foldout.name = "Foldout:" + property.propertyPath; var endProperty = property.GetEndProperty(); property.NextVisible(true); // Expand the first child. do { if (SerializedProperty.EqualContents(property, endProperty)) { break; } var field = new PropertyField(property); field.m_ParentPropertyField = this; field.name = "PropertyField:" + property.propertyPath; if (field == null) { continue; } foldout.Add(field); }while (property.NextVisible(false)); // Never expand children. return(foldout); }
public SimulatorControlPanel(VisualElement rootElement, DeviceInfo deviceInfo, SystemInfoSimulation systemInfoSimulation, ScreenSimulation screenSimulation, ApplicationSimulation applicationSimulation, SimulationPlayerSettings playerSettings, SimulatorSerializationStates states) { m_RootElement = rootElement; m_DeviceSpecifications = new SimulatorDeviceSpecificationsUI(m_RootElement.Q <Foldout>("device-specifications"), deviceInfo, systemInfoSimulation); m_SimulatorScreenSettings = new SimulatorScreenSettingsUI(m_RootElement.Q <Foldout>("screen-settings"), deviceInfo, screenSimulation, playerSettings); m_SimulatorApplicationSettings = new SimulatorApplicationSettingsUI(m_RootElement.Q <Foldout>("application-settings"), applicationSimulation, states); m_SimulatorExtensions = new SimulatorExtensions(); foreach (var extension in m_SimulatorExtensions.Extensions) { var foldout = new Foldout() { text = extension.extensionTitle, value = false }; foldout.AddToClassList("unity-device-simulator__control-panel_foldout"); m_RootElement.Add(foldout); m_ExtensionFoldouts.Add(extension.GetType().ToString(), foldout); if (states != null && states.extensions.TryGetValue(extension.GetType().ToString(), out var serializedExtension)) { JsonUtility.FromJsonOverwrite(serializedExtension, extension); } extension.OnExtendDeviceSimulator(foldout); } }
protected override VisualElement Repaint(SerializedProperty property) { var container = new Foldout() { text = property.displayName }; var typeName = property.FindPropertyRelative("typeName"); var memberName = property.FindPropertyRelative("memberName"); var operatorName = property.FindPropertyRelative("operatorName"); container.Add(CreateTypePopup(typeName)); container.Add(CreatePropertyPopup(memberName, typeName.stringValue)); var propertyInfo = GetProperty(typeName.stringValue, memberName.stringValue); var operators = Operators; if (propertyInfo?.PropertyType.IsNumeric() == false) { operators = operators.Take(1).ToList(); operatorName.stringValue = operators.First(); property.serializedObject.ApplyModifiedProperties(); property.serializedObject.Update(); } container.Add(CreateOperatorPopup(operatorName, operators)); container.Add(CreateValueField(property, propertyInfo)); return(container); }
public JointField(Asset asset, SerializedProperty property, Asset.Metric metric) { m_Asset = asset; m_Property = property; m_Metric = metric; Foldout foldout = new Foldout { text = "Joints" }; foldout.AddToClassList("jointToggle"); foldout.value = property.isExpanded; Add(foldout); foldout.RegisterValueChangedCallback(evt => ToggleListVisibility()); Add(m_ListView); m_ListView.AddToClassList("jointsListView"); m_ListView.style.display = property.isExpanded ? DisplayStyle.Flex : DisplayStyle.None; Rebuild(); RegisterCallback <AttachToPanelEvent>(OnAttachToPanel); RegisterCallback <DetachFromPanelEvent>(OnDetachFromPanel); focusable = true; m_ForceDisabled = false; }
public TreeViewItem(EditorEditorWindow editor, VisualElement element) { var visualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>(string.Format(EditorEditorWindow.BasePath, "Styles/Editor/TreeViewItem.uxml")); root = visualTree.CloneTree(); this.editor = editor; targetElement = element; itemHandler = root.Q <Button>("dragHandler"); expandToggle = root.Q <Foldout>("expandChildren"); nameLabel = root.Q <Label>("elementName"); childContainer = root.Q <VisualElement>("container"); dropDisplayLine = childContainer.Q <VisualElement>("dropLine"); var type = targetElement.GetType(); root.Q <Label>("elementType").text = type.Name; UpdateDisplay(); expandToggle.value = false; SetVisible(childContainer, false); RegisterEvents(); }
private void AddNewSingleEntryToFoldout(Foldout foldout, string entryText = "") { var newIncludeNameStartsWithVisualElement = new VisualElement(); newIncludeNameStartsWithVisualElement.style.flexDirection = new StyleEnum <FlexDirection>(FlexDirection.Row); var newIncludeNameStartsWithTextField = new TextField { value = entryText }; newIncludeNameStartsWithTextField.style.flexGrow = 1; var newIncludeNameStartsWithButton = new Button() { text = "X" }; newIncludeNameStartsWithButton.style.borderTopLeftRadius = 0; newIncludeNameStartsWithButton.style.borderTopRightRadius = 0; newIncludeNameStartsWithButton.style.borderBottomRightRadius = 0; newIncludeNameStartsWithButton.style.borderBottomLeftRadius = 0; newIncludeNameStartsWithButton.clickable.clicked += () => RemoveVisualElementFromFoldout( newIncludeNameStartsWithVisualElement, foldout); newIncludeNameStartsWithVisualElement.Add(newIncludeNameStartsWithButton); newIncludeNameStartsWithVisualElement.Add(newIncludeNameStartsWithTextField); foldout.Add(newIncludeNameStartsWithVisualElement); }
private void DrawProxyEntries(Foldout foldout) { using (new EditorHelper.Horizontal()) { EditorGUILayout.LabelField("Proxy entries", GUILayout.Width(128), GUILayout.ExpandWidth(false)); if (EditorHelper.MiniButton("Add", 64)) { entries.Add(new ImpactProxyEntry()); } } using (new EditorHelper.IndentPadding(20)) { int indexToRemove = -1; for (int index = 0; index < entries.Count; index++) { ImpactProxyEntry entry = entries[index]; entry.OnGUI( foldout, "ProxyEntries." + index, proxies, poolOfCharacterGroupId, poolOfWeaponVisualId, poolOfWeaponName ); if (entry.IsRemoved) { indexToRemove = index; } } if (indexToRemove != -1) { entries.RemoveAt(indexToRemove); } } }
private VisualElement CreateFoldout(SerializedProperty property) { property = property.Copy(); Foldout e = new Foldout(); e.text = "TEST FOLDOUT"; e.value = property.isExpanded; e.bindingPath = property.propertyPath; e.name = "unity-foldout-" + property.propertyPath; Label label = e.Q <Toggle>((string)null, Foldout.toggleUssClassName).Q <Label>((string)null, Toggle.textUssClassName); label.bindingPath = property.propertyPath; SerializedProperty endProperty = property.GetEndProperty(); property.NextVisible(true); while (!SerializedProperty.EqualContents(property, endProperty)) { PropertyField propertyField = new PropertyField(property); propertyField.name = "unity-property-field-" + property.propertyPath; if (propertyField != null) { e.Add((VisualElement)propertyField); } if (!property.NextVisible(false)) { break; } } return((VisualElement)e); }
public ExposedDelegateEditor(UtilityAIActionEditor utilityAIActionEditor, ExposedDelegate exposedDelegate) { this.utilityAIActionEditor = utilityAIActionEditor; this.exposedDelegate = exposedDelegate; VisualTreeAsset visualTree = AssetDatabase.LoadAssetAtPath <VisualTreeAsset>("Assets/UtilityAI/Scripts/Editor/Exposed Delegate Editor/ExposedDelegateEditor.uxml"); visualTree.CloneTree(this); StyleSheet stylesheet = AssetDatabase.LoadAssetAtPath <StyleSheet>("Assets/UtilityAI/Scripts/Editor/Exposed Delegate Editor/ExposedDelegateEditor.uss"); this.styleSheets.Add(stylesheet); this.AddToClassList("exposedDelegateEditor"); Button btnAddDelegateEntry = this.Query <Button>("btnAddNewMethod").First(); btnAddDelegateEntry.BringToFront(); btnAddDelegateEntry.clickable.clicked += AddDelegateEntry; Button btnRemoveAllDelegateEntries = this.Query <Button>("btnRemoveAllMethods").First(); btnRemoveAllDelegateEntries.BringToFront(); btnRemoveAllDelegateEntries.clickable.clicked += RemoveAllDelegateEntries; delegateEntriesList = this.Query <Foldout>("delegateEntries"); delegateEntriesList.Query <Toggle>().First().AddToClassList("delegateEntryFoldout"); delegateEntriesContainer = delegateEntriesList.Query <VisualElement>("delegateEntriesContainer").First(); UpdateDelegateEntries(); }
public VisualElement Draw( object source, Type type, string label = "", Action <object> onValueChanged = null) { var title = string.IsNullOrEmpty(label) ? "content" : label; if (source == null) { title = $"{title} [EMPTY]"; } var container = new Foldout() { text = title, value = false, style = { paddingLeft = 4, color = new StyleColor(Color.black), backgroundColor = new StyleColor(new Color(0.5f, 0.5f, 0.5f)) } }; #if ODIN_INSPECTOR container.Add(new IMGUIContainer(() => source.DrawOdinPropertyInspector())); #endif return(container); }
private void RebuildDetails() { CustomDetailRoot.Clear(); DefaultLabel.Clear(); var bifurcationsProp = CommandItem.CommandProperty.GetChildProperty("bifurcations"); var count = bifurcationsProp.GetProperty().arraySize; for (int i = 0; i < count; i++) { var bifurcationBox = new VisualElement(); var item = bifurcationsProp.GetArrayElementAt(i); var labelProp = item.GetChildProperty("label").GetProperty(); var a = new Foldout(); a.text = $"「{labelProp.stringValue}」"; // new Label($"「{labelProp.stringValue}」"); var toggle = a.Q <Toggle>(); toggle.style.marginBottom = 0f; a.style.marginTop = 10f; toggle.style.backgroundColor = new Color(0, 0, 0, 0.5f); bifurcationBox.Add(a); DefaultLabel.Add(a); var l = new CommandListView(CommandItem.ParentList, item.GetChildProperty("commandList.commands")); a.Add(l); CustomDetailRoot.Add(bifurcationBox); } }
private void OnEnable() { rootVisualElement.styleSheets.Add(Resources.Load <StyleSheet>("ItemEditor_DatabaseView_Style")); ItemDatabase itemDatabase = AssetDatabase.LoadAssetAtPath("Assets/Scripts/Inventory/Objects/ItemDatabase.asset", typeof(ItemDatabase)) as ItemDatabase; rootVisualElement.Clear(); var visualTree = Resources.Load <VisualTreeAsset>(databaseViewerPath); visualTree.CloneTree(rootVisualElement); VisualElement fieldContainer = rootVisualElement.Q(name: "item-object-field-container"); Foldout itemFoldOut = rootVisualElement.Q(name: "item-foldout") as Foldout; var objectFieldTemplate = Resources.Load <VisualTreeAsset>(objectFieldTemplatePath); foreach (BaseItem item in itemDatabase.items) { VisualElement itemObject = objectFieldTemplate.CloneTree(); ObjectField itemObjectField = itemObject.Q(name: "item-object-field") as ObjectField; itemObjectField.objectType = typeof(BaseItem); itemObjectField.value = item; itemObjectField.label = item.itemName; itemFoldOut.Add(itemObject); } }
public static VisualElement CreateScenarioEndingList(SerializedProperty listProperty, string label, bool useHeader = false) { var list = new Foldout { text = label }; var endingList = ((ScenarioEnding[])Enum.GetValues(typeof(ScenarioEnding))).ToList(); listProperty.arraySize = endingList.Count; listProperty.serializedObject.ApplyModifiedProperties(); for (var i = 0; i < endingList.Count; i++) { VisualElement listElem; if (useHeader) { list.Add(new Label(endingList[i].ToDisplayName()) { style = { unityFontStyleAndWeight = new StyleEnum <FontStyle>(FontStyle.Bold) } }); listElem = new PropertyField(listProperty.GetArrayElementAtIndex(i)); } else { listElem = new PropertyField(listProperty.GetArrayElementAtIndex(i), endingList[i].ToDisplayName()); } list.Add(listElem); } return(list); }
public override VisualElement CreateInspectorGUI() { var root = new VisualElement(); root.Add(new PropertyField(serializedObject.FindProperty("scenarioName"))); root.Add(new PropertyField(serializedObject.FindProperty("icon"))); root.Add(UITools.CreateScenarioEndingList(serializedObject.FindProperty("midwayBackgrounds"), "Scenario midway backgrounds")); root.Add(UITools.CreateScenarioEndingList(serializedObject.FindProperty("endBackgrounds"), "Scenario ending backgrounds")); root.Add(UITools.CreateScenarioEndingList(serializedObject.FindProperty("endingMessages"), "Ending messages", true)); var audioFoldout = new Foldout { text = "Music" }; audioFoldout.Add(new PropertyField(serializedObject.FindProperty("neutralMusic"))); audioFoldout.Add(new PropertyField(serializedObject.FindProperty("negativeMusic"))); audioFoldout.Add(new PropertyField(serializedObject.FindProperty("positiveMusic"))); root.Add(audioFoldout); root.Add(new PostList(serializedObject.FindProperty("posts"), serializedObject)); return(root); }
public static Foldout Foldout <TProperty, TContainer, TValue>( TProperty property, ref TContainer container, ref TValue value, InspectorVisitorContext visitorContext) where TProperty : IProperty <TContainer, TValue> { var propertyName = property.GetName(); var foldout = new Foldout { name = propertyName, bindingPath = propertyName, }; if (property.Attributes?.HasAttribute <InspectorNameAttribute>() ?? false) { foldout.text = property.Attributes.GetAttribute <InspectorNameAttribute>().displayName; } else { foldout.text = propertyName; } SetTooltip(property.Attributes, foldout); visitorContext.Parent.contentContainer.Add(foldout); return(foldout); }
public VisualElement GetVisualElement() { VisualElement visualElement = new VisualElement(); m_NameElement = new Foldout(); m_NameElement.Add(visualElement); visualElement.Add(GetSwapVisualElement()); visualElement.Add(GetNameFieldVisualElement()); visualElement.Add(GeDescriptionFieldVisualElement()); VisualElement actionsElement = new Foldout { text = "Actions" }; actionsElement.Add(GetShapeActionsListVisualElement()); actionsElement.Add(new ValidatorField(m_Stage.NoConflictsBetweenShapeActionsValidator)); actionsElement.Add(GetCreateShapeActionVisualElement()); visualElement.Add(actionsElement); visualElement.Add(GetDeleteStageVisualElement()); m_NameElement.AddToClassList("container"); UpdateName(); return(m_NameElement); }
public static bool BeginFold(int bit, string label) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Space(3); EditorGUI.indentLevel++; Foldout fold = Foldout.Get(bit); bool foldState = EditorGUI.Foldout( EditorGUILayout.GetControlRect(), fold.state, label, true); fold.state = foldState; EditorGUI.indentLevel--; if (foldState) { GUILayout.Space(5); } EditorGUILayout.BeginHorizontal(); GUILayout.Space(1); EditorGUILayout.BeginVertical(); return(foldState); }
//!Definiuje UI części zwijanej. private void foldoutSetup() { foldout = new Foldout(); foldout.value = false; choiceName = new TextField(); choiceName.label = "Choice title:"; makesChoice = new Toggle(); makesChoice.text = "Makes a choice?"; makesChoice.value = true; charismaField = new TextField(); deceptionField = new TextField(); thoughtfulnessField = new TextField(); charismaField.label = "Charisma requirement:"; deceptionField.label = "Deception requirement:"; thoughtfulnessField.label = "Thoughtfulness requirement:"; foldout.contentContainer.Add(makesChoice); foldout.contentContainer.Add(choiceName); narrativePathCheckboxesSetup(); foldout.contentContainer.Add(charismaField); foldout.contentContainer.Add(deceptionField); foldout.contentContainer.Add(thoughtfulnessField); foldout.SetEnabled(false); }
private VisualElement CreateFoldout(SerializedProperty property) { property = property.Copy(); var foldout = new Foldout(); bool hasCustomLabel = !string.IsNullOrEmpty(label); foldout.text = hasCustomLabel ? label : property.localizedDisplayName; foldout.value = property.isExpanded; foldout.bindingPath = property.propertyPath; foldout.name = "unity-foldout-" + property.propertyPath; // Get Foldout label. var foldoutToggle = foldout.Q <Toggle>(className: Foldout.toggleUssClassName); var foldoutLabel = foldoutToggle.Q <Label>(className: Toggle.textUssClassName); if (hasCustomLabel) { foldoutLabel.text = foldout.text; } else { foldoutLabel.bindingPath = property.propertyPath; foldoutLabel.SetProperty(foldoutTitleBoundLabelProperty, true); } m_ChildrenContainer = foldout; RefreshChildrenProperties(property, false); return(foldout); }
public void Refresh() { m_ScrollView.Clear(); var l = AssetDatabase.GetAllAssetPaths() .Where(p => p.StartsWith("Assets/Examples/Editor/PrefabExplorer") && p.EndsWith("prefab")).ToList(); l.Sort(); foreach (string path in l) { var image = new Image() { style = { width = TextureSize, height = TextureSize }, userData = path }; var f = new Foldout() { text = path, value = false, viewDataKey = path // this makes sure to restore expanded state after domain reload }; f.Add(image); m_ScrollView.Add(f); } }
public SimulatorApplicationSettingsUI(Foldout rootElement, ApplicationSimulation applicationSimulation) { m_RootElement = rootElement; m_ApplicationSimulation = applicationSimulation; InitUI(); }
private void DoLabelsDisplay() { m_LabelsFoldOut = new Foldout { text = L10n.Tr("Labels"), name = k_LabelsFoldOutName, classList = { k_FoldoutClass } }; var i = 0; foreach (var label in m_Labels) { var toggle = new Toggle(L10n.Tr(label)) { name = label, classList = { k_ToggleClass } }; toggle.RegisterValueChangedCallback(evt => { if (evt.newValue) { // Uncheck Unlabeled if checked m_StatusFoldOut.Q <Toggle>(PageFilters.k_UnlabeledStatus.ToLower()).value = false; } UpdateFiltersIfNeeded(); }); m_LabelsFoldOut.Add(toggle); if (++i > k_MaxDisplayLabels) { UIUtils.SetElementDisplay(toggle, false); } } m_LabelsFoldOut.Query <Label>().ForEach(UIUtils.TextTooltipOnSizeChange); m_Container.Add(m_LabelsFoldOut); }
private void UpdateData(string text) { this.container.Clear(); var lines = text.Split('\n'); Foldout foldout = null; for (int i = 0; i < lines.Length; ++i) { var line = lines[i]; if (line.StartsWith("### ") == true) { // Begin Q-A var v = new Foldout(); v.value = false; v.text = line.Substring(4); this.container.Add(v); foldout = v; } else if (foldout != null) { if (line.Trim().Length > 0) { var match = System.Text.RegularExpressions.Regex.Match(line, "<answer>(.*?)</answer>"); var val = match.Groups[1].Value; var label = new Label(); label.AddToClassList("answer"); label.text = val; foldout.Add(label); } } } }
public FoldoutList( string title, float indentation, bool unfolded ) : base() { m_indentationAmount = indentation; m_foldout = new Foldout( title, unfolded ); m_foldout.SetWidth( 100.0f, MetricsUnits.Percentage ); m_content = new Control(); m_content.SetWidth( 100.0f, MetricsUnits.Percentage ); m_content.AddDecorator( new StackContent( StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow ) ); m_content.AddDecorator( new FitContent( false, true, false, true ) ); AddChild( m_foldout ); AddChild( m_content ); AddDecorator( new StackContent( StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow ) ); AddDecorator( new FitContent( false, true, false, true ) ); m_foldout.ValueChange += FoldoutValueChange; SetFoldState( unfolded ); }