Table of Contents

Class DelayedSubModuleManager

Namespace
Bannerlord.ButterLib.DelayedSubModule
Assembly
Bannerlord.ButterLib.dll

Allows you to inject your own code into the load / unload sequence of other modules without specifying them directly as a dependency in 'SubModule.xml'.

public static class DelayedSubModuleManager
Inheritance
DelayedSubModuleManager
Inherited Members

Remarks

Supported methods are: 'OnSubModuleLoad', 'OnSubModuleUnloaded', 'OnBeforeInitialModuleScreenSetAsRoot', 'OnGameStart', 'OnGameEnd'. The basic loading order still applies, so while you can technically subscribe to the 'OnSubModuleLoad' methods of the already loaded modules, it won't affect them as they will be executed before. The delegate passed will still be executed.

Methods

Register(Type)

Registers a module to be a target of the DelayedSubModuleManager.

public static void Register(Type subModule)

Parameters

subModule Type

The exact type of the SubModule to be registered.

Register(Type, int, string[]?, string[]?)

Registers a module to be a target of the DelayedSubModuleManager Harmony patching.

public static void Register(Type subModule, int priority, string[]? before, string[]? after)

Parameters

subModule Type

The exact type of the SubModule to be patched.

priority int

The HarmonyLib.HarmonyPriority that would be assigned to the patches that would be made.

before string[]

A list of HarmonyLib.Harmony.Ids that should come after the patches that would be made.

after string[]

A list of HarmonyLib.Harmony.Ids that should come before the patches that would be made.

Register<TSubModule>()

Registers a module to be a target of the DelayedSubModuleManager.

public static void Register<TSubModule>() where TSubModule : MBSubModuleBase

Type Parameters

TSubModule

The exact type of the SubModule to be registered.

Register<TSubModule>(int, string[]?, string[]?)

Registers a module to be a target of the DelayedSubModuleManager Harmony patching.

public static void Register<TSubModule>(int priority, string[]? before, string[]? after) where TSubModule : MBSubModuleBase

Parameters

priority int

The HarmonyLib.HarmonyPriority that would be assigned to the patches that would be made.

before string[]

A list of HarmonyLib.Harmony.Ids that should come after the patches that would be made.

after string[]

A list of HarmonyLib.Harmony.Ids that should come before the patches that would be made.

Type Parameters

TSubModule

The exact type of the SubModule to be patched.

Subscribe(Type, MBSubModuleBase, string, SubscriptionType, EventHandler<SubscriptionEventArgs>)

public static void Subscribe(Type mbSubModuleType, MBSubModuleBase caller, string method, SubscriptionType subscriptionType, EventHandler<SubscriptionEventArgs> @delegate)

Parameters

mbSubModuleType Type
caller MBSubModuleBase
method string
subscriptionType SubscriptionType
delegate EventHandler<SubscriptionEventArgs>

Subscribe<T>(MBSubModuleBase, string, SubscriptionType, EventHandler<SubscriptionEventArgs>)

public static void Subscribe<T>(MBSubModuleBase caller, string method, SubscriptionType subscriptionType, EventHandler<SubscriptionEventArgs> @delegate) where T : MBSubModuleBase

Parameters

caller MBSubModuleBase
method string
subscriptionType SubscriptionType
delegate EventHandler<SubscriptionEventArgs>

Type Parameters

T

Subscribe<T1, T2>(string, SubscriptionType, EventHandler<SubscriptionEventArgs>)

public static void Subscribe<T1, T2>(string method, SubscriptionType subscriptionType, EventHandler<SubscriptionEventArgs> @delegate) where T1 : MBSubModuleBase where T2 : MBSubModuleBase

Parameters

method string
subscriptionType SubscriptionType
delegate EventHandler<SubscriptionEventArgs>

Type Parameters

T1
T2