Esempio n. 1
0
        /// <inheritdoc/>
        public Identifiable Create <T>(Type t, params object[] parameters) where T : Identifiable
        {
            var instance = (T)Activator.CreateInstance(typeof(T), parameters);

            Identifiables.Add(instance);

            instance.Id = -1;

            return(instance);
        }
        // Runs the population code for the mod,
        // registering all objects and populating
        // them
        internal static void PopulateMod()
        {
            // Register extra modules for registration
            foreach (Assembly ass in AppDomain.CurrentDomain.GetAssemblies())
            {
                if (ass.GetName().Name.StartsWith("VikDisk."))
                {
                    RegistryUtils.extraModules.Add(ass);
                }
            }


            // Registers the all game content
            Others.RegisterAll();
            Identifiables.RegisterAll();
            SpawnResources.RegisterAll();
            Gadgets.RegisterAll();
            Upgrades.RegisterAll();
            UIs.RegisterAll();
            Plots.RegisterAll();

            //GordoRegistry.Setup();

            // Adds new commands to the game
            Console.RegisterCommand(new DumperCommand());
            Console.RegisterCommand(new UnlockAllCommand());
            Console.RegisterCommand(new TPCommand());
            Console.RegisterCommand(new DebugModeCommand());

            if (TESTING)
            {
                Console.RegisterCommand(new TestModeCommand());
            }

            // Registers the remaining callback
            CallbackHandler.LateSetup();

            // Runs fixing methods
            GameFixer.FixAtGameLoad();

            // Run Injectors
            foreach (Injector inject in injectors)
            {
                inject.PopulateMod();
            }
        }