Пример #1
0
        public MySessionComponentBase()
        {
            var type = GetType();
            var attr = (MySessionComponentDescriptor)Attribute.GetCustomAttribute(type, typeof(MySessionComponentDescriptor), false);

            DebugName         = type.Name;
            Priority          = attr.Priority;
            UpdateOrder       = attr.UpdateOrder;
            ObjectBuilderType = attr.ObjectBuilderType;
            ComponentType     = attr.ComponentType;

            if (ObjectBuilderType != MyObjectBuilderType.Invalid)
            {
                MySessionComponentMapping.Map(GetType(), ObjectBuilderType);
            }

            if (ComponentType == null)
            {
                ComponentType = GetType();
            }
            else if (ComponentType == GetType() || ComponentType.IsSubclassOf(GetType()))
            {
                MyLog.Default.Error("Component {0} tries to register itself as a component it does not inherit from ({1}). Ignoring...", GetType(), ComponentType);
                ComponentType = GetType();
            }
        }
Пример #2
0
        public MySessionComponentBase()
        {
            var type = GetType();
            var attr = (MySessionComponentDescriptor)Attribute.GetCustomAttribute(type, typeof(MySessionComponentDescriptor), false);

            DebugName         = type.Name;
            Priority          = attr.Priority;
            UpdateOrder       = attr.UpdateOrder;
            ObjectBuilderType = attr.ObjectBuilderType;

            if (ObjectBuilderType != MyObjectBuilderType.Invalid)
            {
                MySessionComponentMapping.Map(GetType(), ObjectBuilderType);
            }
        }