/// <summary>
        /// Register all object builders in game assemblies and loads serializers. This function must be called after links to assemblies in MyPlugins are set!
        /// Returns false if assembly links are not set. Only MyPlugins.UserAssembly can be null.
        /// </summary>
        public static bool RegisterAssembliesAndLoadSerializers()
        {
            m_objectFactory.RegisterFromAssembly(Assembly.GetExecutingAssembly());
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed
            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.GameObjectBuildersAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);

            LoadSerializers();
            return(Assembly.GetExecutingAssembly() != null && MyPlugins.SandboxAssembly != null &&
                   MyPlugins.GameAssembly != null && MyPlugins.GameObjectBuildersAssembly != null);
        }
Ejemplo n.º 2
0
        static MyObjectBuilderSerializer()
        {
            Serializer = TypeModel.Create();
            Serializer.AutoAddMissingTypes     = true;
            Serializer.UseImplicitZeroDefaults = false;

            m_objectFactory = new MyObjectFactory <MyObjectBuilderDefinitionAttribute, MyObjectBuilder_Base>();

            m_objectFactory.RegisterFromAssembly(Assembly.GetExecutingAssembly());
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed
            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);

            LoadSerializers();
        }
 public static void RegisterFromAssembly(Assembly assembly)
 {
     m_objectFactory.RegisterFromAssembly(assembly);
 }