/// <inheritdoc/> protected internal override void Initialize(int layoutIndex) { GUILayout dictionaryLayout = layout.AddLayoutY(layoutIndex); dictionaryGUIField = InspectableDictionaryGUI.Create(context, title, path, property, dictionaryLayout, depth); dictionaryGUIField.IsExpanded = context.Persistent.GetBool(path + "_Expanded"); dictionaryGUIField.OnExpand += x => context.Persistent.SetBool(path + "_Expanded", x); }
/// <inheritdoc/> protected internal override void Initialize(int layoutIndex) { GUILayout dictionaryLayout = layout.AddLayoutY(layoutIndex); dictionaryGUIField = InspectableDictionaryGUI.Create(parent, title, path, property, dictionaryLayout, depth); dictionaryGUIField.IsExpanded = parent.Persistent.GetBool(path + "_Expanded"); dictionaryGUIField.OnExpand += x => parent.Persistent.SetBool(path + "_Expanded", x); }
/// <inheritdoc/> protected override void CreateValueGUI(GUILayoutY layout) { InspectableDictionaryGUI dictParent = (InspectableDictionaryGUI)parent; SerializableProperty property = GetValue <SerializableProperty>(); string entryPath = dictParent.Path + "Value[" + RowIdx + "]"; FieldValue = CreateField(dictParent.Context, "Value", entryPath, 0, Depth + 1, new InspectableFieldLayout(layout), property); }
/// <summary> /// Builds the inspectable dictionary GUI elements. Must be called at least once in order for the contents to /// be populated. /// </summary> /// <param name="context">Context shared by all inspectable fields created by the same parent.</param> /// <param name="title">Label to display on the list GUI title.</param> /// <param name="path">Full path to this property (includes name of this property and all parent properties). /// </param> /// <param name="property">Serializable property referencing a dictionary</param> /// <param name="layout">Layout to which to append the list GUI elements to.</param> /// <param name="depth">Determines at which depth to render the background. Useful when you have multiple /// nested containers whose backgrounds are overlaping. Also determines background style, /// depths divisible by two will use an alternate style.</param> public static InspectableDictionaryGUI Create(InspectableContext context, LocString title, string path, SerializableProperty property, GUILayout layout, int depth = 0) { InspectableDictionaryGUI guiDictionary = new InspectableDictionaryGUI(context, title, path, property, layout, depth); guiDictionary.BuildGUI(); return(guiDictionary); }
/// <inheritdoc/> protected override GUILayoutX CreateKeyGUI(GUILayoutY layout) { keyLayout = layout; InspectableDictionaryGUI dictParent = (InspectableDictionaryGUI)parent; SerializableProperty property = GetKey <SerializableProperty>(); string entryPath = dictParent.Path + "Key[" + RowIdx + "]"; FieldKey = CreateField(dictParent.Context, "Key", entryPath, 0, Depth + 1, new InspectableFieldLayout(layout), property); return(FieldKey.GetTitleLayout()); }
/// <summary> /// Builds the inspectable dictionary GUI elements. Must be called at least once in order for the contents to /// be populated. /// </summary> /// <param name="parent">Parent Inspector this field belongs to.</param> /// <param name="title">Label to display on the list GUI title.</param> /// <param name="path">Full path to this property (includes name of this property and all parent properties). /// </param> /// <param name="property">Serializable property referencing a dictionary</param> /// <param name="layout">Layout to which to append the list GUI elements to.</param> /// <param name="depth">Determines at which depth to render the background. Useful when you have multiple /// nested containers whose backgrounds are overlaping. Also determines background style, /// depths divisible by two will use an alternate style.</param> public static InspectableDictionaryGUI Create(Inspector parent, LocString title, string path, SerializableProperty property, GUILayout layout, int depth = 0) { InspectableDictionaryGUI guiDictionary = new InspectableDictionaryGUI(parent, title, path, property, layout, depth); guiDictionary.BuildGUI(); return guiDictionary; }