public override void OnGUI(string searchContext) { DrawInfo(); EditorGUILayout.Separator(); EditorGUILayoutUtility.HorizontalLine(2f, 0.95f); for (int i = 0; i < m_settingsItems.Count; i++) { ISettingsItem settingsItem = m_settingsItems[i]; EditorGUILayoutUtility.RichLabelField(string.Format("<b>{0}</b>", settingsItem.Name)); using (new EditorGUI.IndentLevelScope()) { settingsItem.OnGUI(); } if (i < m_settingsItems.Count - 1) { EditorGUILayout.Separator(); EditorGUILayoutUtility.HorizontalLine(1f, 0.85f); } } }
private void Initialize() { m_settingsItems = new List <ISettingsItem>(); List <string> itemKeywords = new List <string>(); // add settings items Type interfaceType = typeof(ISettingsItem); var settingsTypes = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(x => GetLoadableTypes(x)) .Where(x => x.IsClass && interfaceType.IsAssignableFrom(x)); foreach (Type settingsType in settingsTypes) { ISettingsItem settingsItem = Activator.CreateInstance(settingsType) as ISettingsItem; if (settingsItem != null) { m_settingsItems.Add(settingsItem); itemKeywords.AddRange(settingsItem.Keywords); } } foreach (var settingItem in m_settingsItems) { settingItem.OnInitialize(); } keywords = itemKeywords; }
public void AddProperty(Type neuronType, ISettingsItem property) { if (!_neuronSettings.TryGetValue(neuronType, out var properties)) { properties = new Dictionary <string, ISettingsItem>(); _neuronSettings.Add(neuronType, properties); } (properties as Dictionary <string, ISettingsItem>)?.Add(property.Name, property); }