예제 #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);
        }