Exemplo n.º 1
0
 /// <summary>
 /// End initialization
 /// </summary>
 protected override void OnBeforeInitialModuleScreenSetAsRoot()
 {
     using var synchronizationProvider = BaseSynchronizationProvider.Create("OnBeforeInitialModuleScreenSetAsRoot_MBOv3");
     if (synchronizationProvider.IsFirstInitialization)
     {
     }
 }
 /// <summary>
 /// Start initialization
 /// </summary>
 protected override void OnSubModuleLoad()
 {
     using var synchronizationProvider = BaseSynchronizationProvider.Create("OnSubModuleLoad_ModLibv3");
     if (synchronizationProvider.IsFirstInitialization)
     {
     }
 }
        /// <summary>
        /// End initialization
        /// </summary>
        protected override void OnBeforeInitialModuleScreenSetAsRoot()
        {
            using var synchronizationProvider = BaseSynchronizationProvider.Create("OnBeforeInitialModuleScreenSetAsRoot_MCMv3");
            if (synchronizationProvider.IsFirstInitialization)
            {
#if DEBUG
                var builder = new DefaultSettingsBuilder("test_v1", "Test Fluent Settings")
                              .SetFormat("xml")
                              .SetFolderName("")
                              .SetSubFolder("")
                              .CreateGroup("Testing 1", groupBuilder => groupBuilder
                                           .AddBool("Check Box", new ProxyRef <bool>(() => _boolValue, o => _boolValue = o), boolBuilder => boolBuilder
                                                    .SetHintText("Test")))
                              .CreateGroup("Testing 2", groupBuilder => groupBuilder
                                           .AddInteger("Integer", 0, 10, new ProxyRef <int>(() => _intValue, o => _intValue = o), integerBuilder => integerBuilder
                                                       .SetHintText("Testing"))
                                           .AddFloatingInteger("Floating Integer", 0, 10, new ProxyRef <float>(() => _floatValue, o => _floatValue = o), floatingBuilder => floatingBuilder
                                                               .SetRequireRestart(true)
                                                               .SetHintText("Test")))
                              .CreateGroup("Testing 3", groupBuilder => groupBuilder
                                           .AddText("Test", new ProxyRef <string>(() => _stringValue, o => _stringValue = o), null));

                var globalSettings = builder.BuildAsGlobal();
                globalSettings.Register();
                globalSettings.Unregister();

                var perCharacterSettings = builder.BuildAsPerCharacter();
                perCharacterSettings.Register();
                perCharacterSettings.Unregister();
#endif
            }
        }
 /// <summary>
 /// End initialization
 /// </summary>
 protected override void OnBeforeInitialModuleScreenSetAsRoot()
 {
     using var synchronizationProvider = BaseSynchronizationProvider.Create("OnBeforeInitialModuleScreenSetAsRoot_ModLibv3");
     if (synchronizationProvider.IsFirstInitialization)
     {
         if (MCMModLibSettings.Instance !.OverrideModLib)
         {
             BaseModLibScreenOverrider.Instance.OverrideModLibScreen();
         }
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Start initialization
        /// </summary>
        protected override void OnSubModuleLoad()
        {
            using var synchronizationProvider = BaseSynchronizationProvider.Create("OnSubModuleLoad_MBOv3");
            if (synchronizationProvider.IsFirstInitialization)
            {
                var harmonyV1 = new Harmony("bannerlord.mcm.mbo.v1.loaderpreventer");
                foreach (var method in SettingsDatabaseV1Patch1.TargetMethods())
                {
                    harmonyV1.Patch(
                        method,
                        prefix: new HarmonyMethod(typeof(SettingsDatabaseV1Patch1), nameof(SettingsDatabaseV1Patch1.Prefix)));
                }

                /*
                 * foreach (var method in MBOptionScreenV1SubModulePatch1.TargetMethods())
                 * {
                 *  harmonyV1.Patch(
                 *      method,
                 *      prefix: new HarmonyMethod(typeof(MBOptionScreenV1SubModulePatch1), nameof(MBOptionScreenV1SubModulePatch1.Prefix)));
                 * }
                 * foreach (var method in MBOptionScreenV1SubModulePatch2.TargetMethods())
                 * {
                 *  harmonyV1.Patch(
                 *      method,
                 *      prefix: new HarmonyMethod(typeof(MBOptionScreenV1SubModulePatch2), nameof(MBOptionScreenV1SubModulePatch2.Prefix)));
                 * }
                 */

                var harmonyV2 = new Harmony("bannerlord.mcm.mbo.v2.loaderpreventer");
                foreach (var method in SettingsDatabaseV2Patch1.TargetMethods())
                {
                    harmonyV2.Patch(
                        method,
                        prefix: new HarmonyMethod(typeof(SettingsDatabaseV2Patch1), nameof(SettingsDatabaseV2Patch1.Prefix)));
                }

                /*
                 * foreach (var method in MBOptionScreenV2SubModulePatch1.TargetMethods())
                 * {
                 *  harmonyV2.Patch(
                 *      method,
                 *      prefix: new HarmonyMethod(typeof(MBOptionScreenV2SubModulePatch1), nameof(MBOptionScreenV2SubModulePatch1.Prefix)));
                 * }
                 * foreach (var method in MBOptionScreenV2SubModulePatch2.TargetMethods())
                 * {
                 *  harmonyV2.Patch(
                 *      method,
                 *      prefix: new HarmonyMethod(typeof(MBOptionScreenV2SubModulePatch2), nameof(MBOptionScreenV2SubModulePatch2.Prefix)));
                 * }
                 */
            }
        }
        protected override void OnSubModuleLoad()
        {
            base.OnSubModuleLoad();

            using var synchronizationProvider = BaseSynchronizationProvider.Create("OnSubModuleLoad_UIv3");
            if (synchronizationProvider.IsFirstInitialization)
            {
                var harmony = new Harmony("bannerlord.mcm.ui.loading");
                harmony.Patch(
                    MBSubModuleBasePatch.OnGauntletUISubModuleSubModuleLoadTargetMethod,
                    postfix: new HarmonyMethod(typeof(MBSubModuleBasePatch), nameof(MBSubModuleBasePatch.OnGauntletUISubModuleSubModuleLoadPostfix)));
                harmony.Patch(
                    MBSubModuleBasePatch.OnSubModuleUnloadedTargetMethod,
                    postfix: new HarmonyMethod(typeof(MBSubModuleBasePatch), nameof(MBSubModuleBasePatch.OnSubModuleUnloadedPostfix)));
                harmony.Patch(
                    MBSubModuleBasePatch.OnBeforeInitialModuleScreenSetAsRootTargetMethod,
                    postfix: new HarmonyMethod(typeof(MBSubModuleBasePatch), nameof(MBSubModuleBasePatch.OnBeforeInitialModuleScreenSetAsRootPostfix)));
            }
        }