/// <summary> /// Called by the game when level loading is complete. /// </summary> /// <param name="mode">Loading mode (e.g. game, editor, scenario, etc.)</param> public override void OnLevelLoaded(LoadMode mode) { Logging.Message("commencing loading checks"); base.OnLevelLoaded(mode); // Don't do anything further if we're not operating. if (!isModEnabled) { Logging.Message("exiting"); return; } // Check to see that Harmony 2 was properly loaded. if (!Patcher.Patched) { // Harmony 2 wasn't loaded; abort. Logging.Error("Harmony patches not applied; aborting"); isModEnabled = false; // Display warning message. ListMessageBox harmonyBox = MessageBoxBase.ShowModal <ListMessageBox>(); // Key text items. harmonyBox.AddParas(Translations.Translate("ERR_HAR0"), Translations.Translate("BOB_ERR_HAR"), Translations.Translate("BOB_ERR_FAT"), Translations.Translate("ERR_HAR1")); // List of dot points. harmonyBox.AddList(Translations.Translate("ERR_HAR2"), Translations.Translate("ERR_HAR3")); // Closing para. harmonyBox.AddParas(Translations.Translate("MES_PAGE")); // Don't do anything further. return; } Logging.Message("loading checks passed"); // Build lists of loaded prefabs. PrefabLists.BuildLists(); // Load prop packs. new PackReplacement(); // Load configuration file. ConfigurationUtils.LoadConfig(); // Initialise select tool. ToolsModifierControl.toolController.gameObject.AddComponent <BOBTool>(); // Display update notification. WhatsNew.ShowWhatsNew(); // Set up Network Skins 2 reflection. ModUtils.NS2Reflection(); // Force update of any dirty net or building prefabs from replacement process. Logging.Message("updating dirty prefabs"); BuildingData.Update(); NetData.Update(); // Set up options panel event handler. OptionsPanel.OptionsEventHook(); Logging.Message("loading complete"); }