/// <summary> /// Executed whenever a level completes its loading process. /// This mod the activates and patches the game using Hramony library. /// </summary> /// <param name="mode">The loading mode.</param> public override void OnLevelLoaded(LoadMode mode) { /* * This function can still be called when loading up the asset editor, * so we have to check where we are right now. */ switch (mode) { case LoadMode.LoadGame: case LoadMode.NewGame: case LoadMode.LoadScenario: case LoadMode.NewGameFromScenario: break; default: return; } // we write settings first so that settings can be updated in case harmony fails UnifyHarmonyVersions(); PatchController.Activate(); }
/// <summary> /// Executed whenever a map is being unloaded. /// This mod then undoes the changes using the Harmony library. /// </summary> public override void OnLevelUnloading() { // we write settings first so that settings can be updated in case harmony fails UnifyHarmonyVersions(); PatchController.Deactivate(); }