/// <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) { // Alert the user to any mod conflicts. ModUtils.NotifyConflict(); // Don't do anything further if mod hasn't activated (conflicting mod detected, or loading into editor instead of game). if (!isModEnabled) { return; } base.OnLevelLoaded(mode); // Don't do anything if in asset editor. if (mode == LoadMode.NewAsset || mode == LoadMode.LoadAsset) { return; } // Wait for loading to fully complete. while (!LoadingManager.instance.m_loadingComplete) { } // Check watchdog flag. if (!patchOperating) { // Patch wasn't operating; display warning notification and exit. HarmonyNotification notification = new HarmonyNotification(); notification.Create(); notification.Show(); return; } // Init Ploppable Tool panel. PloppableTool.Initialize(); // Add buttons to access building details from zoned building info panels. SettingsPanel.AddInfoPanelButtons(); // Deactivate the ploppable panel as it starts hidden. Don't need to deactivate the settings panel as it's not instantiated until first shown. PloppableTool.Instance.gameObject.SetActive(false); // Report any loading errors. Debugging.ReportErrors(); Debugging.Message("loading complete"); // Load settings file and check if we need to display update notification. settingsFile = Configuration <SettingsFile> .Load(); if (settingsFile.NotificationVersion != 2) { // No update notification "Don't show again" flag found; show the notification. UpdateNotification notification = new UpdateNotification(); notification.Create(); notification.Show(); } }
/// <summary> /// Harmony postfix to perform actions require after the level has loaded. /// </summary> public static void Postfix() { // Don't do anything if mod hasn't activated for whatever reason (mod conflict, harmony error, something else). if (!Loading.isModEnabled) { return; } // Report any 'soft' mod conflicts. if (Loading.softModConflct) { // Soft conflict detected - display warning notification for each one. foreach (string mod in ModUtils.conflictingModNames) { if (mod.Equals("PTG") && ModSettings.dsaPTG == 0) { // Plop the Growables. DontShowAgainMessageBox softConflictBox = MessageBoxBase.ShowModal <DontShowAgainMessageBox>(); softConflictBox.AddParas(Translations.Translate("PRR_CON_PTG0"), Translations.Translate("PRR_CON_PTG1"), Translations.Translate("PRR_CON_PTG2")); softConflictBox.DSAButton.eventClicked += (component, clickEvent) => { ModSettings.dsaPTG = 1; SettingsUtils.SaveSettings(); }; } } } // Report any broken assets and remove from our prefab dictionary. foreach (BuildingInfo prefab in Loading.brokenPrefabs) { Logging.Error("broken prefab: ", prefab.name); Loading.xmlManager.prefabHash.Remove(prefab); } Loading.brokenPrefabs.Clear(); // Init Ploppable Tool panel. PloppableTool.Initialize(); // Add buttons to access building details from zoned building info panels. SettingsPanel.AddInfoPanelButtons(); // Display update notification. try { WhatsNew.ShowWhatsNew(); } catch (Exception e) { Logging.LogException(e, "exception showing WhatsNew panel"); } // Set up options panel event handler. try { OptionsPanel.OptionsEventHook(); } catch (Exception e) { Logging.LogException(e, "exception hooking options panel"); } Logging.KeyMessage("loading complete"); }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); //if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame) //return; //Load xml only from main menu. if (xmlManager == null) { xmlManager = new RICOPrefabManager(); xmlManager.Run(); } //Assign xml settings to prefabs. convertPrefabs = new ConvertPrefabs(); convertPrefabs.run(); //Init GUI PloppableTool.Initialize(); RICOSettingsPanel.Initialize(); //Deploy Detour Detour.BuildingToolDetour.Deploy(); Debug.Log("Detour Deployed"); }
public override void OnLevelLoaded(LoadMode mode) { base.OnLevelLoaded(mode); if (mode != LoadMode.LoadGame && mode != LoadMode.NewGame) { return; } //Load xml xmlManager = new XMLManager(); xmlManager.Run(); //Assign xml settings to prefabs. convertPrefabs = new ConvertPrefabs(); convertPrefabs.run(); //Init GUI PloppableTool.Initialize(); RICOSettingsPanel.Initialize(); //Deploy Detour Detour.BuildingToolDetour.Deploy(); }
/// <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) { // Alert the user to any mod conflicts. ModUtils.NotifyConflict(); // Don't do anything further if mod hasn't activated (conflicting mod detected, or loading into editor instead of game). if (!isModEnabled) { return; } base.OnLevelLoaded(mode); // Don't do anything if in asset editor. if (mode == LoadMode.NewAsset || mode == LoadMode.LoadAsset) { return; } // Wait for loading to fully complete. while (!LoadingManager.instance.m_loadingComplete) { } // Check watchdog flag. if (!patchOperating) { // Patch wasn't operating; display warning notification and exit. HarmonyNotification notification = new HarmonyNotification(); notification.Create(); notification.Show(); return; } // Report any broken assets and remove from our prefab dictionary. foreach (BuildingInfo prefab in brokenPrefabs) { Debugging.Message("broken prefab: " + prefab.name); xmlManager.prefabHash.Remove(prefab); } brokenPrefabs.Clear(); // Init Ploppable Tool panel. PloppableTool.Initialize(); // Add buttons to access building details from zoned building info panels. SettingsPanel.AddInfoPanelButtons(); // Report any loading errors. Debugging.ReportErrors(); Debugging.Message("loading complete"); // Load settings file and check if we need to display update notification. if (UpdateNotification.notificationVersion != 3) { // No update notification "Don't show again" flag found; show the notification. UpdateNotification notification = new UpdateNotification(); notification.Create(); notification.Show(); } // Set up options panel event handler. OptionsPanel.OptionsEventHook(); }