Example #1
0
        private List <Type> GetMainComponentTypeNames()
        {
            var list    = new List <Type>();
            var typeMap = RuntimeUtil.GetAllTypesDerivedFrom <MainComponent>();

            foreach (var kvp in typeMap)
            {
                var type = kvp;
                if (RuntimeUtil.HasSubclass(type))
                {
                    continue;
                }

                if (type.IsDefined(typeof(ComponentHandlerAttribute), false))
                {
                    var attribute = type.GetAttribute <ComponentHandlerAttribute>();
                    if (attribute != null && attribute.handler != null)
                    {
                        list.Add(type);
                    }
                }
                else
                {
                    list.Add(type);
                }
            }
            list.Sort((a, b) => { return(a.Name.CompareTo(b.Name)); });
            return(list);
        }
Example #2
0
        private List <Type> GetSerieTypeNames()
        {
            var list    = new List <Type>();
            var typeMap = RuntimeUtil.GetAllTypesDerivedFrom <Serie>();

            foreach (var kvp in typeMap)
            {
                var type = kvp;
                if (type.IsDefined(typeof(SerieHandlerAttribute), false))
                {
                    list.Add(type);
                }
            }
            list.Sort((a, b) => { return(a.Name.CompareTo(b.Name)); });
            return(list);
        }
Example #3
0
        private List <Type> GetCovertToSerie(Type serie)
        {
            var list    = new List <Type>();
            var typeMap = RuntimeUtil.GetAllTypesDerivedFrom <Serie>();

            foreach (var kvp in typeMap)
            {
                var type = kvp;
                if (type.IsDefined(typeof(SerieConvertAttribute), false))
                {
                    var attribute = type.GetAttribute <SerieConvertAttribute>();
                    if (attribute != null && attribute.Contains(serie))
                    {
                        list.Add(type);
                    }
                }
            }
            list.Sort((a, b) => { return(a.Name.CompareTo(b.Name)); });
            return(list);
        }
Example #4
0
        public void Init(BaseChart chart, SerializedObject serializedObject, List <SerializedProperty> componentProps)
        {
            Assert.IsNotNull(chart);

            this.chart           = chart;
            m_ComponentsProperty = componentProps;

            Assert.IsNotNull(m_ComponentsProperty);

            m_Editors     = new List <MainComponentBaseEditor>();
            m_EditorTypes = new Dictionary <Type, Type>();

            var editorTypes = RuntimeUtil.GetAllTypesDerivedFrom <MainComponentBaseEditor>()
                              .Where(t => t.IsDefined(typeof(ComponentEditorAttribute), false) && !t.IsAbstract);

            foreach (var editorType in editorTypes)
            {
                var attribute = editorType.GetAttribute <ComponentEditorAttribute>();
                m_EditorTypes.Add(attribute.componentType, editorType);
            }

            RefreshEditors();
        }