Пример #1
0
        public static void Patch()
        {
            MCUServices.Logger.Info("Started patching " + QuickLogger.GetAssemblyVersion());

            // Patch in new items
            var booster = new BioReactorBooster();

            booster.Patch();

            var reactor = new CyBioReactor(booster);

            reactor.Patch();

            // Apply Harmony patches
            var harmony = new Harmony("com.morecyclopsupgrades.psmod");

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            // Register with MoreCyclopsUpgrades
            MCUServices.Register.AuxCyclopsManager <BioAuxCyclopsManager>((SubRoot cyclops) => new BioAuxCyclopsManager(cyclops));
            MCUServices.Register.CyclopsCharger <BioChargeHandler>((SubRoot cyclops) => new BioChargeHandler(booster.TechType, cyclops));
            MCUServices.Register.CyclopsUpgradeHandler((SubRoot cyclops) => new BioBoosterUpgradeHandler(booster.TechType, cyclops));
            MCUServices.Register.PdaIconOverlay(booster.TechType, (uGUI_ItemIcon icon, InventoryItem upgradeModule) => new BoosterOverlay(icon, upgradeModule));

            // Register config for display
            CyBioReactorDisplayHandler.Config = OptionsPanelHandler.Main.RegisterModOptions <CyBioConfig>();

            MCUServices.Logger.Info("Finished Patching");
        }
Пример #2
0
        public static void Patch()
        {
            try
            {
                QuickLogger.Info("Started patching " + QuickLogger.GetAssemblyVersion());
#if DEBUG
                QuickLogger.DebugLogsEnabled = true;
#else
                QuickLogger.DebugLogsEnabled = false;
#endif
                var booster = new BioReactorBooster();
                booster.Patch();

                var reactor = new CyBioReactor(booster);
                reactor.Patch();

                var harmony = HarmonyInstance.Create("com.morecyclopsupgrades.psmod");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                MCUServices.Register.AuxCyclopsManager <BioAuxCyclopsManager>((SubRoot cyclops) =>
                {
                    return(new BioAuxCyclopsManager(cyclops, booster.TechType, reactor.TechType));
                });

                MCUServices.Register.CyclopsCharger <BioChargeHandler>((SubRoot cyclops) =>
                {
                    return(new BioChargeHandler(booster.TechType, cyclops));
                });

                MCUServices.Register.CyclopsUpgradeHandler((SubRoot cyclops) =>
                {
                    return(new BioBoosterUpgradeHandler(booster.TechType, cyclops));
                });

                MCUServices.Register.PdaIconOverlay(booster.TechType, (uGUI_ItemIcon icon, InventoryItem upgradeModule) =>
                {
                    return(new BoosterOverlay(icon, upgradeModule));
                });

                QuickLogger.Info("Finished Patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }