public string[] getToobarTitles() { List <string> props = new List <string>(); for (int i = 0; i < toolbars.Count; i++) { if (toolbars[i] != null) { props.Add(toolbars[i].title); } } return(UMTools.ToArray(props)); }
public string[] getIgnoreProperties(vToolBar toolbar) { List <string> props = new List <string>(); for (int i = 0; i < toolbars.Count; i++) { if (toolbars[i] != null && toolbar != null && toolbar.variables != null) { for (int a = 0; a < toolbars[i].variables.Count; a++) { if (!props.Contains(toolbars[i].variables[a]) && !toolbar.variables.Contains(toolbars[i].variables[a])) { props.Add(toolbars[i].variables[a]); } } } } props.Add("m_Script"); return(UMTools.ToArray(props)); }
protected virtual void OnEnable() { var targetObject = serializedObject.targetObject; var hasAttributeHeader = targetObject.GetType().IsDefined(typeof(UClassHeaderAttribute), true); if (hasAttributeHeader) { var attributes = Attribute.GetCustomAttributes(targetObject.GetType(), typeof(UClassHeaderAttribute), true); if (attributes.Length > 0) { headerAttribute = (UClassHeaderAttribute)attributes[0]; } } skin = Resources.Load("skin") as GUISkin; m_Logo = Resources.Load("icon_v2") as Texture2D; var prop = serializedObject.GetIterator(); if (((UBehaviour)target) != null) { const BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance; List <string> events = new List <string>(); toolbars = new List <vToolBar>(); var toolbar = new vToolBar(); toolbar.title = "Default"; toolbars.Add(toolbar); var index = 0; while (prop.NextVisible(true)) { var fieldInfo = targetObject.GetType().GetField(prop.name, flags); if (fieldInfo != null) { var toolBarAttributes = fieldInfo.GetCustomAttributes(typeof(UToolbarAttribute), true); if (toolBarAttributes.Length > 0) { var attribute = toolBarAttributes[0] as UToolbarAttribute; var _toolbar = toolbars.Find(tool => tool != null && tool.title == attribute.title); if (_toolbar == null) { toolbar = new vToolBar(); toolbar.title = attribute.title; toolbars.Add(toolbar); index = toolbars.Count - 1; } else { index = toolbars.IndexOf(_toolbar); } } if (index < toolbars.Count) { toolbars[index].variables.Add(prop.name); } if ((UEditorHelper.IsUnityEventyType(fieldInfo.FieldType) && !events.Contains(fieldInfo.Name))) { events.Add(fieldInfo.Name); } } } var nullToolBar = toolbars.FindAll(tool => tool != null && (tool.variables == null || tool.variables.Count == 0)); for (int i = 0; i < nullToolBar.Count; i++) { if (toolbars.Contains(nullToolBar[i])) { toolbars.Remove(nullToolBar[i]); } } ignoreEvents = UMTools.ToArray(events); if (headerAttribute != null) { m_Logo = Resources.Load(headerAttribute.iconName) as Texture2D; } //else headerAttribute = new vClassHeaderAttribute(target.GetType().Name); } }