Пример #1
0
        public static void LoadMods()
        {
            var owmlGo = new GameObject();

            owmlGo.AddComponent <OwmlBehaviour>();
            var owmlConfig        = JsonHelper.LoadJsonObject <OwmlConfig>(ConfigPath);
            var owmlDefaultConfig = JsonHelper.LoadJsonObject <OwmlConfig>(DefaultConfigPath);
            var owmlManifest      = JsonHelper.LoadJsonObject <ModManifest>(ManifestPath);

            if (owmlConfig == null || owmlManifest == null)
            {
                // Everything is wrong and can't write to console...
                return;
            }
            var logger = new ModLogger(owmlConfig, owmlManifest);

            logger.Log("Got config!");
            var console = OutputFactory.CreateOutput(owmlConfig, logger, owmlManifest);

            console.WriteLine("Mod loader has been initialized.");
            var modSorter     = new ModSorter(console);
            var modFinder     = new ModFinder(owmlConfig, console);
            var harmonyHelper = new HarmonyHelper(logger, console);
            var events        = new ModEvents(logger, console, harmonyHelper);
            var inputHandler  = new ModInputHandler(logger, console, harmonyHelper, owmlConfig, events);
            var menus         = new ModMenus(console, events, inputHandler, owmlManifest, owmlConfig, owmlDefaultConfig);
            var owo           = new Owo(modFinder, logger, console, owmlConfig, menus, harmonyHelper, inputHandler, modSorter);

            owo.LoadMods();
        }
Пример #2
0
        public static void LoadMods()
        {
            SecondaryLog($"In {nameof(ModLoader)}.{nameof(LoadMods)}!");
            SecondaryLog("Getting config...");
            var config = GetConfig();

            if (config == null)
            {
                SecondaryLog("Config is null");
                return;
            }
            SecondaryLog("Got config!");
            SecondaryLog("Loading mods...");
            try
            {
                var logger        = new ModLogger(config);
                var console       = new ModConsole(config);
                var harmonyHelper = new HarmonyHelper(logger, console);
                var events        = new ModEvents(harmonyHelper);
                var assets        = new ModAssets(console);
                var helper        = new ModHelper(config, logger, console, events, harmonyHelper, assets);
                var modFinder     = new ModFinder(config);
                var owo           = new Owo(helper, modFinder);
                owo.LoadMods();
                SecondaryLog("Loaded mods");
            }
            catch (Exception ex)
            {
                SecondaryLog("Error while loading mods: " + ex);
            }
        }